mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
ToolForm: Show spinner during job submission, hide the modal
This commit is contained in:
@@ -8,6 +8,21 @@ define(['utils/utils', 'mvc/ui/ui-misc', 'mvc/tools/tools-form-base', 'mvc/tools
|
||||
var View = ToolFormBase.extend({
|
||||
// initialize
|
||||
initialize: function(options) {
|
||||
// execute button
|
||||
var self = this;
|
||||
var execute = new Ui.Button({
|
||||
icon : 'fa-check',
|
||||
tooltip : 'Execute: ' + options.name,
|
||||
title : 'Execute',
|
||||
cls : 'btn btn-primary',
|
||||
floating : 'clear',
|
||||
onclick : function() {
|
||||
execute.wait();
|
||||
ToolJobs.submit(self.form, options, function() {
|
||||
execute.unwait();
|
||||
});
|
||||
}
|
||||
});
|
||||
// add remap button
|
||||
if (options.job_id && options.job_remap) {
|
||||
options.inputs['rerun_remap_job_id'] = {
|
||||
@@ -22,20 +37,10 @@ define(['utils/utils', 'mvc/ui/ui-misc', 'mvc/tools/tools-form-base', 'mvc/tools
|
||||
}
|
||||
}
|
||||
// create options dictionary
|
||||
var self = this;
|
||||
options = Utils.merge(options, {
|
||||
update_url : galaxy_config.root + 'api/tools/' + options.id + '/build',
|
||||
buttons : {
|
||||
execute : new Ui.Button({
|
||||
icon : 'fa-check',
|
||||
tooltip : 'Execute: ' + options.name,
|
||||
title : 'Execute',
|
||||
cls : 'btn btn-primary',
|
||||
floating : 'clear',
|
||||
onclick : function() {
|
||||
ToolJobs.submit(self.form, options);
|
||||
}
|
||||
})
|
||||
execute : execute
|
||||
}
|
||||
});
|
||||
ToolFormBase.prototype.initialize.call(this, options);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
define(['utils/utils', 'mvc/tools/tools-template'], function(Utils, ToolTemplate) {
|
||||
return {
|
||||
submit: function(form, options) {
|
||||
submit: function(form, options, callback) {
|
||||
// link this
|
||||
var self = this;
|
||||
|
||||
@@ -20,33 +20,25 @@ return {
|
||||
// validate job definition
|
||||
if (!this._validation(form, job_def)) {
|
||||
console.debug('tools-jobs::submit - Submission canceled. Validation failed.');
|
||||
callback && callback();
|
||||
return;
|
||||
}
|
||||
|
||||
// debug
|
||||
console.debug(job_def);
|
||||
|
||||
// show progress modal
|
||||
var user_is_waiting = true;
|
||||
form.modal.show({title: 'Please wait...', body: 'progress', buttons: {
|
||||
'Close' : function () {
|
||||
form.modal.hide();
|
||||
user_is_waiting = false;
|
||||
}
|
||||
}});
|
||||
|
||||
// post job
|
||||
Utils.request({
|
||||
type : 'POST',
|
||||
url : galaxy_config.root + 'api/tools',
|
||||
data : job_def,
|
||||
success : function(response) {
|
||||
form.modal.hide();
|
||||
callback && callback();
|
||||
form.reciept(ToolTemplate.success(response));
|
||||
self._refreshHdas();
|
||||
},
|
||||
error : function(response, response_full) {
|
||||
form.modal.hide();
|
||||
callback && callback();
|
||||
if (response && response.message && response.message.data) {
|
||||
var error_messages = form.data.matchResponse(response.message.data);
|
||||
for (var input_id in error_messages) {
|
||||
@@ -56,7 +48,7 @@ return {
|
||||
} else {
|
||||
// show error message with details
|
||||
console.debug(response);
|
||||
user_is_waiting && form.modal.show({
|
||||
response && form.modal.show({
|
||||
title : 'Job submission failed',
|
||||
body : ToolTemplate.error(job_def),
|
||||
buttons : {
|
||||
|
||||
@@ -12,7 +12,7 @@ define(['utils/utils',
|
||||
/**
|
||||
* This class contains backbone wrappers for basic ui elements such as Images, Labels, Buttons, Input fields etc.
|
||||
*/
|
||||
|
||||
|
||||
// plugin
|
||||
var Image = Backbone.View.extend({
|
||||
// options
|
||||
@@ -20,7 +20,7 @@ var Image = Backbone.View.extend({
|
||||
url : '',
|
||||
cls : ''
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// get options
|
||||
@@ -29,7 +29,7 @@ var Image = Backbone.View.extend({
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
},
|
||||
|
||||
|
||||
// template
|
||||
_template: function(options) {
|
||||
return '<img class="ui-image ' + options.cls + '" src="' + options.url + '"/>';
|
||||
@@ -43,7 +43,7 @@ var Label = Backbone.View.extend({
|
||||
title : '',
|
||||
cls : ''
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// get options
|
||||
@@ -52,17 +52,17 @@ var Label = Backbone.View.extend({
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
},
|
||||
|
||||
|
||||
// title
|
||||
title: function(new_title) {
|
||||
this.$el.html(new_title);
|
||||
},
|
||||
|
||||
|
||||
// template
|
||||
_template: function(options) {
|
||||
return '<label class="ui-label ' + options.cls + '">' + options.title + '</label>';
|
||||
},
|
||||
|
||||
|
||||
// value
|
||||
value: function() {
|
||||
return options.title;
|
||||
@@ -80,19 +80,19 @@ var Icon = Backbone.View.extend({
|
||||
title : '',
|
||||
cls : ''
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// get options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// add tooltip
|
||||
$(this.el).tooltip({title: options.tooltip, placement: 'bottom'});
|
||||
},
|
||||
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
return '<div>' +
|
||||
@@ -112,37 +112,51 @@ var Button = Backbone.View.extend({
|
||||
cls : 'ui-button btn btn-default',
|
||||
icon : ''
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// get options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// add event
|
||||
$(this.el).on('click', function() {
|
||||
// hide all tooltips
|
||||
$('.tooltip').hide();
|
||||
|
||||
|
||||
// execute onclick callback
|
||||
if (options.onclick) {
|
||||
options.onclick();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// add tooltip
|
||||
$(this.el).tooltip({title: options.tooltip, placement: 'bottom'});
|
||||
},
|
||||
|
||||
|
||||
// show spinner
|
||||
wait: function() {
|
||||
this.$el.removeClass(this.options.cls).addClass('btn btn-info').prop('disabled', true);
|
||||
this.$('.icon').removeClass(this.options.icon).addClass('fa-spinner fa-spin');
|
||||
this.$('.title').html('Sending...');
|
||||
},
|
||||
|
||||
// hide spinner
|
||||
unwait: function() {
|
||||
this.$el.removeClass('btn btn-info').addClass(this.options.cls).prop('disabled', false);
|
||||
this.$('.icon').removeClass('fa-spinner fa-spin').addClass(this.options.icon);
|
||||
this.$('.title').html(this.options.title);
|
||||
},
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
var str = '<button id="' + options.id + '" type="submit" style="float: ' + options.floating + ';" type="button" class="' + options.cls + '">';
|
||||
if (options.icon) {
|
||||
str += '<i class="icon fa ' + options.icon + '"></i> ' ;
|
||||
str += '<i class="icon fa ' + options.icon + '"></i> ';
|
||||
}
|
||||
str += options.title +
|
||||
str += '<span class="title">' + options.title + '</span>' +
|
||||
'</button>';
|
||||
return str;
|
||||
}
|
||||
@@ -160,52 +174,52 @@ var ButtonIcon = Backbone.View.extend({
|
||||
tooltip : '',
|
||||
onclick : null
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// get options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// link button element
|
||||
this.$button = this.$el.find('.button');
|
||||
|
||||
|
||||
// add event
|
||||
var self = this;
|
||||
$(this.el).on('click', function() {
|
||||
// hide all tooltips
|
||||
$('.tooltip').hide();
|
||||
|
||||
|
||||
// execute onclick callback
|
||||
if (options.onclick && !self.disabled) {
|
||||
options.onclick();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// add tooltip
|
||||
$(this.el).tooltip({title: options.tooltip, placement: 'bottom'});
|
||||
},
|
||||
|
||||
|
||||
// disable
|
||||
disable: function() {
|
||||
this.$button.addClass('disabled');
|
||||
this.disabled = true;
|
||||
},
|
||||
|
||||
|
||||
// enable
|
||||
enable: function() {
|
||||
this.$button.removeClass('disabled');
|
||||
this.disabled = false;
|
||||
},
|
||||
|
||||
|
||||
// change icon
|
||||
setIcon: function(icon_cls) {
|
||||
this.$('i').removeClass(this.options.icon).addClass(icon_cls);
|
||||
this.options.icon = icon_cls;
|
||||
},
|
||||
|
||||
|
||||
// template
|
||||
_template: function(options) {
|
||||
// width
|
||||
@@ -213,10 +227,10 @@ var ButtonIcon = Backbone.View.extend({
|
||||
if (options.title) {
|
||||
width = 'width: auto;';
|
||||
}
|
||||
|
||||
|
||||
// string
|
||||
var str = '<div id="' + options.uid+ '" style="float: ' + options.floating + '; ' + width + '" class="' + options.cls + '">';
|
||||
|
||||
|
||||
// title
|
||||
if (options.title) {
|
||||
str += '<div class="button">' +
|
||||
@@ -238,19 +252,19 @@ var Anchor = Backbone.View.extend({
|
||||
title : '',
|
||||
cls : ''
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// get options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// add event
|
||||
$(this.el).on('click', options.onclick);
|
||||
},
|
||||
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
return '<div><a href="javascript:void(0)" class="ui-anchor ' + options.cls + '">' + options.title + '</a></div>';
|
||||
@@ -265,37 +279,37 @@ var Message = Backbone.View.extend({
|
||||
status : 'info',
|
||||
persistent : false
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// configure options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement('<div></div>');
|
||||
|
||||
|
||||
// show initial message
|
||||
if (this.options.message) {
|
||||
this.update(this.options);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// update
|
||||
update : function(options) {
|
||||
// get options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// show message
|
||||
if (options.message != '') {
|
||||
this.$el.html(this._template(this.options));
|
||||
this.$el.find('.alert').append(options.message);
|
||||
this.$el.fadeIn();
|
||||
|
||||
|
||||
// clear previous timeouts
|
||||
if (this.timeout) {
|
||||
window.clearTimeout(this.timeout);
|
||||
}
|
||||
|
||||
|
||||
// set timeout if message is not persistent
|
||||
if (!options.persistent) {
|
||||
var self = this;
|
||||
@@ -311,7 +325,7 @@ var Message = Backbone.View.extend({
|
||||
this.$el.fadeOut();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
return '<div class="ui-message alert alert-' + options.status + '"/>';
|
||||
@@ -325,15 +339,15 @@ var Searchbox = Backbone.View.extend({
|
||||
onclick : null,
|
||||
searchword : ''
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// configure options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// add click event
|
||||
var self = this;
|
||||
if (this.options.onclick) {
|
||||
@@ -343,7 +357,7 @@ var Searchbox = Backbone.View.extend({
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
return '<div class="ui-search">' +
|
||||
@@ -368,30 +382,30 @@ var Input = Backbone.View.extend({
|
||||
cls : '',
|
||||
area : false
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// configure options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// set initial value
|
||||
if (this.options.value !== undefined) {
|
||||
this.value(this.options.value);
|
||||
}
|
||||
|
||||
|
||||
// disable input field
|
||||
if (this.options.disabled) {
|
||||
this.$el.prop('disabled', true);
|
||||
}
|
||||
|
||||
|
||||
// hide input field
|
||||
if (!this.options.visible) {
|
||||
this.$el.hide();
|
||||
}
|
||||
|
||||
|
||||
// onchange event handler. fires on user activity.
|
||||
var self = this;
|
||||
this.$el.on('input', function() {
|
||||
@@ -400,7 +414,7 @@ var Input = Backbone.View.extend({
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// value
|
||||
value : function (new_val) {
|
||||
if (new_val !== undefined) {
|
||||
@@ -408,7 +422,7 @@ var Input = Backbone.View.extend({
|
||||
}
|
||||
return this.$el.val();
|
||||
},
|
||||
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
if (options.area) {
|
||||
@@ -425,16 +439,16 @@ var Hidden = Backbone.View.extend({
|
||||
initialize : function(options) {
|
||||
// configure options
|
||||
this.options = options;
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// set initial value
|
||||
if (this.options.value !== undefined) {
|
||||
this.value(this.options.value);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// value
|
||||
value : function (new_val) {
|
||||
if (new_val !== undefined) {
|
||||
@@ -442,7 +456,7 @@ var Hidden = Backbone.View.extend({
|
||||
}
|
||||
return this.$('hidden').val();
|
||||
},
|
||||
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
var tmpl = '<div id="' + options.id + '" >';
|
||||
|
||||
@@ -8,6 +8,21 @@ define(['utils/utils', 'mvc/ui/ui-misc', 'mvc/tools/tools-form-base', 'mvc/tools
|
||||
var View = ToolFormBase.extend({
|
||||
// initialize
|
||||
initialize: function(options) {
|
||||
// execute button
|
||||
var self = this;
|
||||
var execute = new Ui.Button({
|
||||
icon : 'fa-check',
|
||||
tooltip : 'Execute: ' + options.name,
|
||||
title : 'Execute',
|
||||
cls : 'btn btn-primary',
|
||||
floating : 'clear',
|
||||
onclick : function() {
|
||||
execute.wait();
|
||||
ToolJobs.submit(self.form, options, function() {
|
||||
execute.unwait();
|
||||
});
|
||||
}
|
||||
});
|
||||
// add remap button
|
||||
if (options.job_id && options.job_remap) {
|
||||
options.inputs['rerun_remap_job_id'] = {
|
||||
@@ -22,20 +37,10 @@ define(['utils/utils', 'mvc/ui/ui-misc', 'mvc/tools/tools-form-base', 'mvc/tools
|
||||
}
|
||||
}
|
||||
// create options dictionary
|
||||
var self = this;
|
||||
options = Utils.merge(options, {
|
||||
update_url : galaxy_config.root + 'api/tools/' + options.id + '/build',
|
||||
buttons : {
|
||||
execute : new Ui.Button({
|
||||
icon : 'fa-check',
|
||||
tooltip : 'Execute: ' + options.name,
|
||||
title : 'Execute',
|
||||
cls : 'btn btn-primary',
|
||||
floating : 'clear',
|
||||
onclick : function() {
|
||||
ToolJobs.submit(self.form, options);
|
||||
}
|
||||
})
|
||||
execute : execute
|
||||
}
|
||||
});
|
||||
ToolFormBase.prototype.initialize.call(this, options);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
define(['utils/utils', 'mvc/tools/tools-template'], function(Utils, ToolTemplate) {
|
||||
return {
|
||||
submit: function(form, options) {
|
||||
submit: function(form, options, callback) {
|
||||
// link this
|
||||
var self = this;
|
||||
|
||||
@@ -20,33 +20,25 @@ return {
|
||||
// validate job definition
|
||||
if (!this._validation(form, job_def)) {
|
||||
console.debug('tools-jobs::submit - Submission canceled. Validation failed.');
|
||||
callback && callback();
|
||||
return;
|
||||
}
|
||||
|
||||
// debug
|
||||
console.debug(job_def);
|
||||
|
||||
// show progress modal
|
||||
var user_is_waiting = true;
|
||||
form.modal.show({title: 'Please wait...', body: 'progress', buttons: {
|
||||
'Close' : function () {
|
||||
form.modal.hide();
|
||||
user_is_waiting = false;
|
||||
}
|
||||
}});
|
||||
|
||||
// post job
|
||||
Utils.request({
|
||||
type : 'POST',
|
||||
url : galaxy_config.root + 'api/tools',
|
||||
data : job_def,
|
||||
success : function(response) {
|
||||
form.modal.hide();
|
||||
callback && callback();
|
||||
form.reciept(ToolTemplate.success(response));
|
||||
self._refreshHdas();
|
||||
},
|
||||
error : function(response, response_full) {
|
||||
form.modal.hide();
|
||||
callback && callback();
|
||||
if (response && response.message && response.message.data) {
|
||||
var error_messages = form.data.matchResponse(response.message.data);
|
||||
for (var input_id in error_messages) {
|
||||
@@ -56,7 +48,7 @@ return {
|
||||
} else {
|
||||
// show error message with details
|
||||
console.debug(response);
|
||||
user_is_waiting && form.modal.show({
|
||||
response && form.modal.show({
|
||||
title : 'Job submission failed',
|
||||
body : ToolTemplate.error(job_def),
|
||||
buttons : {
|
||||
|
||||
@@ -12,7 +12,7 @@ define(['utils/utils',
|
||||
/**
|
||||
* This class contains backbone wrappers for basic ui elements such as Images, Labels, Buttons, Input fields etc.
|
||||
*/
|
||||
|
||||
|
||||
// plugin
|
||||
var Image = Backbone.View.extend({
|
||||
// options
|
||||
@@ -20,7 +20,7 @@ var Image = Backbone.View.extend({
|
||||
url : '',
|
||||
cls : ''
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// get options
|
||||
@@ -29,7 +29,7 @@ var Image = Backbone.View.extend({
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
},
|
||||
|
||||
|
||||
// template
|
||||
_template: function(options) {
|
||||
return '<img class="ui-image ' + options.cls + '" src="' + options.url + '"/>';
|
||||
@@ -43,7 +43,7 @@ var Label = Backbone.View.extend({
|
||||
title : '',
|
||||
cls : ''
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// get options
|
||||
@@ -52,17 +52,17 @@ var Label = Backbone.View.extend({
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
},
|
||||
|
||||
|
||||
// title
|
||||
title: function(new_title) {
|
||||
this.$el.html(new_title);
|
||||
},
|
||||
|
||||
|
||||
// template
|
||||
_template: function(options) {
|
||||
return '<label class="ui-label ' + options.cls + '">' + options.title + '</label>';
|
||||
},
|
||||
|
||||
|
||||
// value
|
||||
value: function() {
|
||||
return options.title;
|
||||
@@ -80,19 +80,19 @@ var Icon = Backbone.View.extend({
|
||||
title : '',
|
||||
cls : ''
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// get options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// add tooltip
|
||||
$(this.el).tooltip({title: options.tooltip, placement: 'bottom'});
|
||||
},
|
||||
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
return '<div>' +
|
||||
@@ -112,37 +112,51 @@ var Button = Backbone.View.extend({
|
||||
cls : 'ui-button btn btn-default',
|
||||
icon : ''
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// get options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// add event
|
||||
$(this.el).on('click', function() {
|
||||
// hide all tooltips
|
||||
$('.tooltip').hide();
|
||||
|
||||
|
||||
// execute onclick callback
|
||||
if (options.onclick) {
|
||||
options.onclick();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// add tooltip
|
||||
$(this.el).tooltip({title: options.tooltip, placement: 'bottom'});
|
||||
},
|
||||
|
||||
|
||||
// show spinner
|
||||
wait: function() {
|
||||
this.$el.removeClass(this.options.cls).addClass('btn btn-info').prop('disabled', true);
|
||||
this.$('.icon').removeClass(this.options.icon).addClass('fa-spinner fa-spin');
|
||||
this.$('.title').html('Sending...');
|
||||
},
|
||||
|
||||
// hide spinner
|
||||
unwait: function() {
|
||||
this.$el.removeClass('btn btn-info').addClass(this.options.cls).prop('disabled', false);
|
||||
this.$('.icon').removeClass('fa-spinner fa-spin').addClass(this.options.icon);
|
||||
this.$('.title').html(this.options.title);
|
||||
},
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
var str = '<button id="' + options.id + '" type="submit" style="float: ' + options.floating + ';" type="button" class="' + options.cls + '">';
|
||||
if (options.icon) {
|
||||
str += '<i class="icon fa ' + options.icon + '"></i> ' ;
|
||||
str += '<i class="icon fa ' + options.icon + '"></i> ';
|
||||
}
|
||||
str += options.title +
|
||||
str += '<span class="title">' + options.title + '</span>' +
|
||||
'</button>';
|
||||
return str;
|
||||
}
|
||||
@@ -160,52 +174,52 @@ var ButtonIcon = Backbone.View.extend({
|
||||
tooltip : '',
|
||||
onclick : null
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// get options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// link button element
|
||||
this.$button = this.$el.find('.button');
|
||||
|
||||
|
||||
// add event
|
||||
var self = this;
|
||||
$(this.el).on('click', function() {
|
||||
// hide all tooltips
|
||||
$('.tooltip').hide();
|
||||
|
||||
|
||||
// execute onclick callback
|
||||
if (options.onclick && !self.disabled) {
|
||||
options.onclick();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// add tooltip
|
||||
$(this.el).tooltip({title: options.tooltip, placement: 'bottom'});
|
||||
},
|
||||
|
||||
|
||||
// disable
|
||||
disable: function() {
|
||||
this.$button.addClass('disabled');
|
||||
this.disabled = true;
|
||||
},
|
||||
|
||||
|
||||
// enable
|
||||
enable: function() {
|
||||
this.$button.removeClass('disabled');
|
||||
this.disabled = false;
|
||||
},
|
||||
|
||||
|
||||
// change icon
|
||||
setIcon: function(icon_cls) {
|
||||
this.$('i').removeClass(this.options.icon).addClass(icon_cls);
|
||||
this.options.icon = icon_cls;
|
||||
},
|
||||
|
||||
|
||||
// template
|
||||
_template: function(options) {
|
||||
// width
|
||||
@@ -213,10 +227,10 @@ var ButtonIcon = Backbone.View.extend({
|
||||
if (options.title) {
|
||||
width = 'width: auto;';
|
||||
}
|
||||
|
||||
|
||||
// string
|
||||
var str = '<div id="' + options.uid+ '" style="float: ' + options.floating + '; ' + width + '" class="' + options.cls + '">';
|
||||
|
||||
|
||||
// title
|
||||
if (options.title) {
|
||||
str += '<div class="button">' +
|
||||
@@ -238,19 +252,19 @@ var Anchor = Backbone.View.extend({
|
||||
title : '',
|
||||
cls : ''
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// get options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// add event
|
||||
$(this.el).on('click', options.onclick);
|
||||
},
|
||||
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
return '<div><a href="javascript:void(0)" class="ui-anchor ' + options.cls + '">' + options.title + '</a></div>';
|
||||
@@ -265,37 +279,37 @@ var Message = Backbone.View.extend({
|
||||
status : 'info',
|
||||
persistent : false
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// configure options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement('<div></div>');
|
||||
|
||||
|
||||
// show initial message
|
||||
if (this.options.message) {
|
||||
this.update(this.options);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// update
|
||||
update : function(options) {
|
||||
// get options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// show message
|
||||
if (options.message != '') {
|
||||
this.$el.html(this._template(this.options));
|
||||
this.$el.find('.alert').append(options.message);
|
||||
this.$el.fadeIn();
|
||||
|
||||
|
||||
// clear previous timeouts
|
||||
if (this.timeout) {
|
||||
window.clearTimeout(this.timeout);
|
||||
}
|
||||
|
||||
|
||||
// set timeout if message is not persistent
|
||||
if (!options.persistent) {
|
||||
var self = this;
|
||||
@@ -311,7 +325,7 @@ var Message = Backbone.View.extend({
|
||||
this.$el.fadeOut();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
return '<div class="ui-message alert alert-' + options.status + '"/>';
|
||||
@@ -325,15 +339,15 @@ var Searchbox = Backbone.View.extend({
|
||||
onclick : null,
|
||||
searchword : ''
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// configure options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// add click event
|
||||
var self = this;
|
||||
if (this.options.onclick) {
|
||||
@@ -343,7 +357,7 @@ var Searchbox = Backbone.View.extend({
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
return '<div class="ui-search">' +
|
||||
@@ -368,30 +382,30 @@ var Input = Backbone.View.extend({
|
||||
cls : '',
|
||||
area : false
|
||||
},
|
||||
|
||||
|
||||
// initialize
|
||||
initialize : function(options) {
|
||||
// configure options
|
||||
this.options = Utils.merge(options, this.optionsDefault);
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// set initial value
|
||||
if (this.options.value !== undefined) {
|
||||
this.value(this.options.value);
|
||||
}
|
||||
|
||||
|
||||
// disable input field
|
||||
if (this.options.disabled) {
|
||||
this.$el.prop('disabled', true);
|
||||
}
|
||||
|
||||
|
||||
// hide input field
|
||||
if (!this.options.visible) {
|
||||
this.$el.hide();
|
||||
}
|
||||
|
||||
|
||||
// onchange event handler. fires on user activity.
|
||||
var self = this;
|
||||
this.$el.on('input', function() {
|
||||
@@ -400,7 +414,7 @@ var Input = Backbone.View.extend({
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// value
|
||||
value : function (new_val) {
|
||||
if (new_val !== undefined) {
|
||||
@@ -408,7 +422,7 @@ var Input = Backbone.View.extend({
|
||||
}
|
||||
return this.$el.val();
|
||||
},
|
||||
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
if (options.area) {
|
||||
@@ -425,16 +439,16 @@ var Hidden = Backbone.View.extend({
|
||||
initialize : function(options) {
|
||||
// configure options
|
||||
this.options = options;
|
||||
|
||||
|
||||
// create new element
|
||||
this.setElement(this._template(this.options));
|
||||
|
||||
|
||||
// set initial value
|
||||
if (this.options.value !== undefined) {
|
||||
this.value(this.options.value);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// value
|
||||
value : function (new_val) {
|
||||
if (new_val !== undefined) {
|
||||
@@ -442,7 +456,7 @@ var Hidden = Backbone.View.extend({
|
||||
}
|
||||
return this.$('hidden').val();
|
||||
},
|
||||
|
||||
|
||||
// element
|
||||
_template: function(options) {
|
||||
var tmpl = '<div id="' + options.id + '" >';
|
||||
|
||||
@@ -1 +1 @@
|
||||
define(["utils/utils","mvc/ui/ui-misc","mvc/tools/tools-form-base","mvc/tools/tools-jobs"],function(c,e,b,a){var d=b.extend({initialize:function(g){if(g.job_id&&g.job_remap){g.inputs.rerun_remap_job_id={label:"Resume dependencies from this job",name:"rerun_remap_job_id",type:"select",display:"radio",ignore:"__ignore__",value:"__ignore__",options:[["Yes",g.job_id],["No","__ignore__"]],help:"The previous run of this tool failed and other tools were waiting for it to finish successfully. Use this option to resume those tools using the new output(s) of this tool run."}}var f=this;g=c.merge(g,{update_url:galaxy_config.root+"api/tools/"+g.id+"/build",buttons:{execute:new e.Button({icon:"fa-check",tooltip:"Execute: "+g.name,title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){a.submit(f.form,g)}})}});b.prototype.initialize.call(this,g)}});return{View:d}});
|
||||
define(["utils/utils","mvc/ui/ui-misc","mvc/tools/tools-form-base","mvc/tools/tools-jobs"],function(c,e,b,a){var d=b.extend({initialize:function(g){var f=this;var h=new e.Button({icon:"fa-check",tooltip:"Execute: "+g.name,title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){h.wait();a.submit(f.form,g,function(){h.unwait()})}});if(g.job_id&&g.job_remap){g.inputs.rerun_remap_job_id={label:"Resume dependencies from this job",name:"rerun_remap_job_id",type:"select",display:"radio",ignore:"__ignore__",value:"__ignore__",options:[["Yes",g.job_id],["No","__ignore__"]],help:"The previous run of this tool failed and other tools were waiting for it to finish successfully. Use this option to resume those tools using the new output(s) of this tool run."}}g=c.merge(g,{update_url:galaxy_config.root+"api/tools/"+g.id+"/build",buttons:{execute:h}});b.prototype.initialize.call(this,g)}});return{View:d}});
|
||||
@@ -1 +1 @@
|
||||
define(["utils/utils","mvc/tools/tools-template"],function(b,a){return{submit:function(g,e){var c=this;var f={tool_id:e.id,tool_version:e.version,inputs:g.data.create()};g.trigger("reset");if(!this._validation(g,f)){console.debug("tools-jobs::submit - Submission canceled. Validation failed.");return}console.debug(f);var d=true;g.modal.show({title:"Please wait...",body:"progress",buttons:{Close:function(){g.modal.hide();d=false}}});b.request({type:"POST",url:galaxy_config.root+"api/tools",data:f,success:function(h){g.modal.hide();g.reciept(a.success(h));c._refreshHdas()},error:function(h,j){g.modal.hide();if(h&&h.message&&h.message.data){var k=g.data.matchResponse(h.message.data);for(var i in k){g.highlight(i,k[i]);break}}else{console.debug(h);d&&g.modal.show({title:"Job submission failed",body:a.error(f),buttons:{Close:function(){g.modal.hide()}}})}}})},_validation:function(e,i){var f=i.inputs;var o=-1;var j=null;for(var l in f){var g=f[l];var m=e.data.match(l);var d=e.field_list[m];var k=e.input_list[m];if(!m||!k||!d){console.debug("tools-jobs::_validation - Retrieving input objects failed.");continue}if(!k.optional&&g==null){e.highlight(m);return false}if(g&&g.batch){var h=g.values.length;var c=null;if(h>0){c=g.values[0]&&g.values[0].src}if(c){if(j===null){j=c}else{if(j!==c){e.highlight(m,"Please select either dataset or dataset list fields for all batch mode fields.");return false}}}if(o===-1){o=h}else{if(o!==h){e.highlight(m,"Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>"+h+"</b> selection(s) while a previous field contains <b>"+o+"</b>.");return false}}}}return true},_refreshHdas:function(){if(parent.Galaxy&&parent.Galaxy.currHistoryPanel){parent.Galaxy.currHistoryPanel.refreshContents()}}}});
|
||||
define(["utils/utils","mvc/tools/tools-template"],function(b,a){return{submit:function(f,d,g){var c=this;var e={tool_id:d.id,tool_version:d.version,inputs:f.data.create()};f.trigger("reset");if(!this._validation(f,e)){console.debug("tools-jobs::submit - Submission canceled. Validation failed.");g&&g();return}console.debug(e);b.request({type:"POST",url:galaxy_config.root+"api/tools",data:e,success:function(h){g&&g();f.reciept(a.success(h));c._refreshHdas()},error:function(h,j){g&&g();if(h&&h.message&&h.message.data){var k=f.data.matchResponse(h.message.data);for(var i in k){f.highlight(i,k[i]);break}}else{console.debug(h);h&&f.modal.show({title:"Job submission failed",body:a.error(e),buttons:{Close:function(){f.modal.hide()}}})}}})},_validation:function(e,i){var f=i.inputs;var o=-1;var j=null;for(var l in f){var g=f[l];var m=e.data.match(l);var d=e.field_list[m];var k=e.input_list[m];if(!m||!k||!d){console.debug("tools-jobs::_validation - Retrieving input objects failed.");continue}if(!k.optional&&g==null){e.highlight(m);return false}if(g&&g.batch){var h=g.values.length;var c=null;if(h>0){c=g.values[0]&&g.values[0].src}if(c){if(j===null){j=c}else{if(j!==c){e.highlight(m,"Please select either dataset or dataset list fields for all batch mode fields.");return false}}}if(o===-1){o=h}else{if(o!==h){e.highlight(m,"Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>"+h+"</b> selection(s) while a previous field contains <b>"+o+"</b>.");return false}}}}return true},_refreshHdas:function(){if(parent.Galaxy&&parent.Galaxy.currHistoryPanel){parent.Galaxy.currHistoryPanel.refreshContents()}}}});
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user