Merge pull request #10953 from guerler/add_workflow_create_button

Add cancel option to workflow create form
This commit is contained in:
John Chilton
2020-12-21 10:22:25 -05:00
committed by GitHub
3 changed files with 18 additions and 3 deletions
@@ -333,6 +333,9 @@ export const getAnalysisRouter = (Galaxy) =>
url: "workflow/create",
redirect: "workflow/editor",
active_tab: "workflow",
submit_title: "Create",
submit_icon: "fa-check",
cancel_redirect: "workflows/list",
})
);
},
+11 -1
View File
@@ -35,6 +35,16 @@ var View = Backbone.View.extend({
errors: options.errors,
inputs: options.inputs,
buttons: {
cancel:
options.cancel_redirect &&
new Ui.Button({
tooltip: options.cancel_tooltip,
title: options.cancel_title || "Cancel",
icon: options.cancel_icon || "fa-times",
onclick: function () {
window.location = `${getAppRoot()}${options.cancel_redirect}`;
},
}),
submit: new Ui.Button({
tooltip: options.submit_tooltip,
title: options.submit_title || "Save",
@@ -79,7 +89,7 @@ var View = Backbone.View.extend({
};
}
if (self.redirect) {
window.location = `${getAppRoot() + self.redirect}?${$.param(params)}`;
window.location = `${getAppRoot()}${self.redirect}?${$.param(params)}`;
} else {
form.data.matchModel(response, (input, input_id) => {
form.field_list[input_id].value(input.value);
+4 -2
View File
@@ -91,8 +91,10 @@ export var View = Backbone.View.extend({
if (options.buttons) {
this.$buttons.empty().show();
$.each(this.model.get("buttons"), (name, item) => {
item.$el.prop("id", name);
self.$buttons.append(item.$el);
if (item) {
item.$el.prop("id", name);
self.$buttons.append(item.$el);
}
});
} else {
this.$buttons.hide();