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:
commit
c077a389e7
|
@ -119,6 +119,14 @@ export default Ember.Controller.extend({
|
||||||
this.save().then(() => this.send('run'));
|
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() {
|
create() {
|
||||||
const name = this.get("newQueryName").trim();
|
const name = this.get("newQueryName").trim();
|
||||||
this.set('loading', true);
|
this.set('loading', true);
|
||||||
|
|
|
@ -147,9 +147,18 @@
|
||||||
{{#if sortedQueries.length}}
|
{{#if sortedQueries.length}}
|
||||||
<table class="recent-queries">
|
<table class="recent-queries">
|
||||||
<thead class="heading-container">
|
<thead class="heading-container">
|
||||||
<th class="col heading name">{{i18n 'explorer.query_name'}}</th>
|
<th {{action "sortByProperty" "name"}} class="col heading name">
|
||||||
<th class="col heading user">{{i18n 'explorer.query_user'}}</th>
|
{{d-icon "sort"}}
|
||||||
<th class="col heading time">{{i18n 'explorer.query_time'}}</th>
|
{{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>
|
</thead>
|
||||||
<tr></tr>
|
<tr></tr>
|
||||||
{{#each sortedQueries as |query|}}
|
{{#each sortedQueries as |query|}}
|
||||||
|
|
|
@ -260,6 +260,9 @@
|
||||||
.query-desc {
|
.query-desc {
|
||||||
color: $primary-high;
|
color: $primary-high;
|
||||||
}
|
}
|
||||||
|
th:hover{
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.explorer-pad-bottom {
|
.explorer-pad-bottom {
|
||||||
|
|
Loading…
Reference in New Issue