From f473cbcc99e403b3d932f63679b1bcfae3be0ec3 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Sun, 1 Apr 2018 14:08:23 -0400 Subject: [PATCH] Add reset and close buttons for upload widget when selecting rules. --- .../mvc/upload/collection/rules-input-view.js | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/client/galaxy/scripts/mvc/upload/collection/rules-input-view.js b/client/galaxy/scripts/mvc/upload/collection/rules-input-view.js index c79221ffc040..54ebf904e4f4 100644 --- a/client/galaxy/scripts/mvc/upload/collection/rules-input-view.js +++ b/client/galaxy/scripts/mvc/upload/collection/rules-input-view.js @@ -17,7 +17,18 @@ export default Backbone.View.extend({ this._eventBuild(); } }); - _.each([this.btnBuild], button => { + this.btnBuild.$el.addClass("btn-primary"); + this.btnReset = new Ui.Button({ + id: "btn-reset", + title: _l("Reset"), + onclick: () => this._eventReset(), + }); + this.btnClose = new Ui.Button({ + id: "btn-close", + title: _l("Close"), + onclick: () => this.app.modal.hide(), + }); + _.each([this.btnReset, this.btnBuild, this.btnClose], button => { this.$(".upload-buttons").prepend(button.$el); }); const dataTypeOptions = [{ id: "datasets", text: "Datasets" }, { id: "collections", text: "Collection(s)" }]; @@ -106,6 +117,15 @@ export default Backbone.View.extend({ .catch(error => console.log(error)); }, + /** Remove all */ + _eventReset: function() { + if (this.datasetSelectorView) { + this.datasetSelectorView.value(null); + } + $(".upload-rule-source-content").val(''); + this._updateScreen(); + }, + _eventBuild: function() { const selection = this.$(".upload-rule-source-content").val(); this._buildSelection(selection);