FEATURE: Sort queries by names, last_run_at by clicking table headers

This commit is contained in:
Rishabh Nambiar 2018-08-30 16:43:15 +05:30
parent 80f97d9514
commit d5d933c2a8
3 changed files with 22 additions and 3 deletions

View File

@ -119,6 +119,13 @@ export default Ember.Controller.extend({
this.save().then(() => this.send('run')); this.save().then(() => this.send('run'));
}, },
sortByProperty(property) {
if (this.sortBy == `${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);

View File

@ -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> <i class="fa fa-sort"></i>
<th class="col heading time">{{i18n 'explorer.query_time'}}</th> {{i18n 'explorer.query_name'}}
</th>
<th {{action "sortByProperty" "username"}} class="col heading user">
<i class="fa fa-sort"></i>
{{i18n 'explorer.query_user'}}
</th>
<th {{action "sortByProperty" "last_run_at"}} class="col heading time">
<i class="fa fa-sort"></i>
{{i18n 'explorer.query_time'}}
</th>
</thead> </thead>
<tr></tr> <tr></tr>
{{#each sortedQueries as |query|}} {{#each sortedQueries as |query|}}

View File

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