List all previous queries on Data Explorer homepage
This commit is contained in:
@@ -20,6 +20,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
editing: false,
|
||||
everEditing: false,
|
||||
showRecentQueries: true,
|
||||
|
||||
createDisabled: function() {
|
||||
return (this.get('newQueryName') || "").trim().length === 0;
|
||||
@@ -28,6 +29,9 @@ export default Ember.Controller.extend({
|
||||
selectedItem: function() {
|
||||
const id = parseInt(this.get('selectedQueryId'));
|
||||
const item = this.get('content').find(q => q.get('id') === id);
|
||||
if (!isNaN(id)) {
|
||||
this.set('showRecentQueries', false);
|
||||
}
|
||||
return item || NoQuery;
|
||||
}.property('selectedQueryId'),
|
||||
|
||||
@@ -76,6 +80,11 @@ export default Ember.Controller.extend({
|
||||
|
||||
showCreate() {
|
||||
this.set('showCreate', true);
|
||||
this.set('showRecentQueries', false);
|
||||
},
|
||||
|
||||
showRecentQueries() {
|
||||
this.set('showRecentQueries', true);
|
||||
},
|
||||
|
||||
editName() {
|
||||
@@ -106,6 +115,7 @@ export default Ember.Controller.extend({
|
||||
const name = this.get("newQueryName").trim();
|
||||
this.set('loading', true);
|
||||
this.set('showCreate', false);
|
||||
this.set('showRecentQueries', false);
|
||||
this.store
|
||||
.createRecord('query', { name })
|
||||
.save()
|
||||
|
||||
@@ -133,6 +133,33 @@
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
|
||||
{{#if showRecentQueries}}
|
||||
{{#if model.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>
|
||||
</thead>
|
||||
<tr></tr>
|
||||
{{#each model as |query|}}
|
||||
<tr>
|
||||
<td>
|
||||
<a>
|
||||
<b class="query-name">{{query.name}}</b>
|
||||
<br>
|
||||
<medium class="query-desc">{{query.description}}</medium>
|
||||
<br>
|
||||
</a>
|
||||
</td>
|
||||
<td><medium class="query-user">{{query.user}}</medium></td>
|
||||
<td><medium class="query-time">{{query.time}}</medium></td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<div class="explorer-pad-bottom"></div>
|
||||
|
||||
{{else}}
|
||||
|
||||
Reference in New Issue
Block a user