Merge pull request #21 from discourse/click_to_sort_queries

FEATURE: Sort queries by names, last_run_at by clicking table headers
This commit is contained in:
Arpit Jalan 2018-08-31 09:47:43 +05:30 committed by GitHub
commit c077a389e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View File

@ -119,6 +119,14 @@ export default Ember.Controller.extend({
this.save().then(() => this.send('run'));
},
sortByProperty(property) {
if (this.sortBy[0] === `${property}:desc`) {
this.set('sortBy', [`${property}:asc`]);
} else {
this.set('sortBy', [`${property}:desc`]);
}
},
create() {
const name = this.get("newQueryName").trim();
this.set('loading', true);

View File

@ -147,9 +147,18 @@
{{#if sortedQueries.length}}
<table class="recent-queries">
<thead class="heading-container">
<th class="col heading name">{{i18n 'explorer.query_name'}}</th>
<th class="col heading user">{{i18n 'explorer.query_user'}}</th>
<th class="col heading time">{{i18n 'explorer.query_time'}}</th>
<th {{action "sortByProperty" "name"}} class="col heading name">
{{d-icon "sort"}}
{{i18n 'explorer.query_name'}}
</th>
<th {{action "sortByProperty" "username"}} class="col heading user">
{{d-icon "sort"}}
{{i18n 'explorer.query_user'}}
</th>
<th {{action "sortByProperty" "last_run_at"}} class="col heading time">
{{d-icon "sort"}}
{{i18n 'explorer.query_time'}}
</th>
</thead>
<tr></tr>
{{#each sortedQueries as |query|}}

View File

@ -260,6 +260,9 @@
.query-desc {
color: $primary-high;
}
th:hover{
cursor: pointer;
}
}
.explorer-pad-bottom {