FEATURE: Add hide button (toggleable) for all queries (frontend only)
* Switches between hide/unhide on click * Works almost like the delete button, but toggles between the query's hidden attribute instead * So far this is only a frontend feature, the backend implementation still needs work
This commit is contained in:
parent
0c1a9aa4bc
commit
a8771d2ad5
|
@ -236,6 +236,32 @@ export default Ember.Controller.extend({
|
|||
});
|
||||
},
|
||||
|
||||
hide() {
|
||||
const query = this.selectedItem;
|
||||
this.setProperties({ loading: true, showResults: false });
|
||||
|
||||
query.set("isNew", true);
|
||||
|
||||
this.store
|
||||
.destroyRecord("query", query)
|
||||
.then(() => query.set("hidden", true))
|
||||
.catch(popupAjaxError)
|
||||
.finally(() => {
|
||||
query.set("isNew", false);
|
||||
this.set("loading", false);
|
||||
});
|
||||
},
|
||||
|
||||
unhide() {
|
||||
const query = this.selectedItem;
|
||||
this.setProperties({ loading: true, showResults: true });
|
||||
query
|
||||
.save()
|
||||
.then(() => query.set("hidden", false))
|
||||
.catch(popupAjaxError)
|
||||
.finally(() => this.set("loading", false));
|
||||
},
|
||||
|
||||
run() {
|
||||
if (this.get("selectedItem.dirty")) {
|
||||
return;
|
||||
|
|
|
@ -118,9 +118,14 @@
|
|||
{{#if everEditing}}
|
||||
{{d-button action=(action "discard") icon="undo" label="explorer.undo" disabled=saveDisabled}}
|
||||
{{/if}}
|
||||
{{#unless editDisabled}}
|
||||
{{d-button action=(action "destroy") class="btn-danger" icon="trash-alt" label="explorer.delete"}}
|
||||
{{/unless}}
|
||||
{{#if selectedItem.hidden}}
|
||||
{{d-button action=(action "unhide") icon="undo" label="explorer.unhide"}}
|
||||
{{else}}
|
||||
{{d-button action=(action "hide") icon="far-eye-slash" label="explorer.hide"}}
|
||||
{{#unless editDisabled}}
|
||||
{{d-button action=(action "destroy") class="btn-danger" icon="trash-alt" label="explorer.delete"}}
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
|
|
@ -49,6 +49,8 @@ en:
|
|||
edit: "Edit"
|
||||
delete: "Delete"
|
||||
recover: "Undelete Query"
|
||||
hide: "Hide"
|
||||
unhide: "Unhide Query"
|
||||
download_json: "JSON"
|
||||
download_csv: "CSV"
|
||||
others_dirty: "A query has unsaved changes that will be lost if you navigate away."
|
||||
|
|
Loading…
Reference in New Issue