commit/galaxy-central: guerler: Ui: Unify checkboxes and radio buttons, extend functionality, Upload: Fix code style, ToolForm: Extend dataset filtering
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/673228acc8ab/ Changeset: 673228acc8ab User: guerler Date: 2014-09-16 07:46:17 Summary: Ui: Unify checkboxes and radio buttons, extend functionality, Upload: Fix code style, ToolForm: Extend dataset filtering Affected #: 31 files diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/tools/tools-datasets.js --- a/static/scripts/mvc/tools/tools-datasets.js +++ b/static/scripts/mvc/tools/tools-datasets.js @@ -25,21 +25,26 @@ }, // filter datasets by data type - filterType: function(filter_type) { - // return matched datasets - return this.currHistoryContents.filter( function( content ){ - // link details - var history_content_type = content.get( 'history_content_type' ); - var data_type = content.get( 'file_ext'); + filterType: function(options) { + options = options || {}; + return this.currHistoryContents.filter(function(content){ + // match datatypes + var found = false; + for (var i in options.data_types) { + if (content.get('data_type').indexOf(options.data_types[i]) != -1) { + found = true; + break; + } + } - // apply filter - return history_content_type === 'dataset';// && (data_type === filter_type || filter_type === ''); + // final match result + return (content.get('history_content_type') === options.content_type || !options.content_type) && + (found || !options.data_types) && !content.get('deleted'); }); }, // filter datasets by id filter: function(filter_id) { - // return matched datasets return _.first( this.currHistoryContents.filter( function( content ){ return content.get( 'id' ) === filter_id; }) ); } }); diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/tools/tools-form.js --- a/static/scripts/mvc/tools/tools-form.js +++ b/static/scripts/mvc/tools/tools-form.js @@ -56,6 +56,12 @@ }); }, + // message + message: function(options) { + $(this.main_el).empty(); + $(this.main_el).append(ToolTemplate.message(options)); + }, + // reset form reset: function() { for (var i in this.element_list) { @@ -63,6 +69,20 @@ } }, + // refresh + refresh: function() { + // recreate tree structure + this.tree.refresh(); + + // trigger change + for (var id in this.field_list) { + this.field_list[id].trigger('change'); + } + + // log + console.debug('tools-form::refresh() - Recreated tree structure. Refresh.'); + }, + // initialize tool form _initializeToolForm: function() { // link this @@ -135,10 +155,6 @@ button_search.$el.hide(); } - // create message - self.message = new Ui.Message(); - self.portlet.append(self.message.$el); - // append form $(self.main_el).append(self.portlet.$el); @@ -174,22 +190,9 @@ // trigger refresh self.refresh(); //self.job_handler.submit(); + self.tree.finalize(); } }); - }, - - // refresh - refresh: function() { - // recreate tree structure - this.tree.refresh(); - - // trigger change - for (var id in this.field_list) { - this.field_list[id].trigger('change'); - } - - // log - console.debug('tools-form::refresh() - Recreated tree structure. Refresh.'); } }); diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/tools/tools-jobs.js --- a/static/scripts/mvc/tools/tools-jobs.js +++ b/static/scripts/mvc/tools/tools-jobs.js @@ -31,12 +31,16 @@ // success handler function(response) { if (!response.outputs || response.outputs.length == 0) { - console.log(response); + console.debug(response); } + self.app.message({ + text : 'A job has been successfully added to the queue. You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from \'running\' to \'finished\' if completed successfully or \'error\' if problems were encountered.' + }); self._refreshHdas(); }, // error handler function(response) { + console.debug(response); if (response && response.message && response.message.data) { var error_messages = self.app.tree.match(response.message.data); for (var id in error_messages) { diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/tools/tools-section.js --- a/static/scripts/mvc/tools/tools-section.js +++ b/static/scripts/mvc/tools/tools-section.js @@ -16,13 +16,11 @@ // set text this.$el.find('.ui-table-form-error-text').html(text); this.$el.find('.ui-table-form-error').fadeIn(); - this.$el.addClass('ui-table-row-error'); }, // reset reset: function() { this.$el.find('.ui-table-form-error').hide(); - this.$el.removeClass('ui-table-form-error'); }, // template @@ -35,7 +33,7 @@ } // add error - $input.append('<div class="ui-table-form-error"><span class="fa fa-arrow-down"/><span class="ui-table-form-error-text"></div>'); + $input.append('<div class="ui-table-form-error ui-error"><span class="fa fa-arrow-down"/><span class="ui-table-form-error-text"></div>'); // add label if (options.label) { @@ -274,7 +272,7 @@ // dataset column case 'data_column': - field = this._field_data_colum(input_def); + field = this._field_select(input_def); break; // conditional select field diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/tools/tools-select-dataset.js --- a/static/scripts/mvc/tools/tools-select-dataset.js +++ b/static/scripts/mvc/tools/tools-select-dataset.js @@ -6,54 +6,6 @@ initialize : function(app, options) { // link this var self = this; - - // get datasets - var datasets = app.datasets.filterType(); - - // configure options fields - var select_data = []; - for (var i in datasets) { - select_data.push({ - label: datasets[i].get('name'), - value: datasets[i].get('id') - }); - } - - // create select field - this.select = new Ui.Select.View({ - data : select_data, - value : select_data[0].value, - onchange : function() { - self.trigger('change'); - } - }); - - // create select field for multiple files - this.select_multiple = new Ui.Select.View({ - multiple : true, - data : select_data, - value : select_data[0].value, - onchange : function() { - self.trigger('change'); - } - }); - - - // create select field for multiple files - this.select_collection = new Ui.Select.View({ - data : select_data, - value : select_data[0].value, - onchange : function() { - self.trigger('change'); - } - }); - - // add change event. fires on trigger - this.on('change', function() { - if (options.onchange) { - options.onchange(self.value()); - } - }); // tabs this.tabs = new Tabs.View({ @@ -62,20 +14,66 @@ } }); - // add tab - this.tabs.add({ - id : 'single', - title : 'Select a dataset', - $el : this.select.$el + // + // datasets + // + var datasets = app.datasets.filterType({ + content_type : 'dataset', + data_types : options.extensions + }); + + // configure options fields + var dataset_options = []; + for (var i in datasets) { + dataset_options.push({ + label: datasets[i].get('name'), + value: datasets[i].get('id') + }); + } + + // select field + this.select_datasets = new Ui.Select.View({ + multiple : true, + data : dataset_options, + value : dataset_options[0] && dataset_options[0].value, + onchange : function() { + self.trigger('change'); + } }); // add tab this.tabs.add({ - id : 'multiple', - title : 'Select multiple datasets', - $el : this.select_multiple.$el + id : 'datasets', + title : 'Select datasets', + $el : this.select_datasets.$el }); - + + // + // collections + // + var collections = app.datasets.filterType({ + content_type : 'collection', + data_types : options.extensions + }); + + // configure options fields + var collection_options = []; + for (var i in collections) { + collection_options.push({ + label: collections[i].get('name'), + value: collections[i].get('id') + }); + } + + // create select field for collections + this.select_collection = new Ui.Select.View({ + data : collection_options, + value : collection_options[0] && collection_options[0].value, + onchange : function() { + self.trigger('change'); + } + }); + // add tab this.tabs.add({ id : 'collection', @@ -85,18 +83,23 @@ // add element this.setElement(this.tabs.$el); + + // add change event. fires on trigger + this.on('change', function() { + if (options.onchange) { + options.onchange(self.value()); + } + }); }, // value value : function (new_value) { var current_tab = this.tabs.current(); switch(current_tab) { - case 'multiple' : - return this.select_multiple.value(); - case 'collection' : + case 'datasets': + return this.select_datasets.value(); + case 'collection': return this.select_collection.value(); - default : - return this.select.value(); } }, diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/tools/tools-template.js --- a/static/scripts/mvc/tools/tools-template.js +++ b/static/scripts/mvc/tools/tools-template.js @@ -13,6 +13,12 @@ citations: function() { return '<div id="citations"></div>'; + }, + + message: function(options) { + return '<div class="donemessagelarge">' + + '<p>' + options.text + '</p>' + + '</div>'; } }; diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/tools/tools-tree.js --- a/static/scripts/mvc/tools/tools-tree.js +++ b/static/scripts/mvc/tools/tools-tree.js @@ -50,8 +50,8 @@ // converter between raw dictionary and job dictionary function convert(identifier, head) { - for (var i in head) { - var node = head[i]; + for (var index in head) { + var node = head[index]; if (node.input) { // get node var input = node.input; @@ -68,9 +68,9 @@ // handle repeats case 'repeat': var index = 0; - for (var j in node) { - if (j.indexOf('section') != -1) { - convert(job_input_id + '_' + index++, node[j]); + for (var i in node) { + if (i.indexOf('section') != -1) { + convert(job_input_id + '_' + index++, node[i]); } } break; @@ -83,20 +83,38 @@ add (job_input_id + '|' + input.test_param.name, input.id, value); // find selected case - for (var j in input.cases) { - if (input.cases[j].value == value) { - convert(job_input_id, head[input.id + '-section-' + j]); + for (var i in input.cases) { + if (input.cases[i].value == value) { + convert(job_input_id, head[input.id + '-section-' + i]); break; } } break; // handle data inputs case 'data': - var value = { - id : self.app.field_list[input.id].value(), - src : 'hda' + // create array for dataset ids + var dataset_selection = null; + + // collect dataset ids from input field + var value = self.app.field_list[input.id].value(); + if (typeof value === 'string') { + dataset_selection = { + id : value, + src : 'hda' + }; + } else { + // create array of dataset dictionaries for api submission + dataset_selection = []; + for (var i in value) { + dataset_selection.push({ + id : value[i], + src : 'hda' + }); + } } - add(job_input_id, input.id, value); + + // add final array to job definition + add(job_input_id, input.id, dataset_selection); break; // handle boolean input case 'boolean': @@ -118,7 +136,7 @@ // start conversion convert('', this.dict); - + console.log(this.job_def); // return result return this.job_def; }, diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/ui/ui-checkbox.js --- a/static/scripts/mvc/ui/ui-checkbox.js +++ /dev/null @@ -1,91 +0,0 @@ -// dependencies -define(['utils/utils'], function(Utils) { - -// plugin -var View = Backbone.View.extend({ - // options - optionsDefault: { - value : '', - visible : true, - cls : '', - data : [], - id : Utils.uuid() - }, - - // initialize - initialize : function(options) { - // configure options - this.options = Utils.merge(options, this.optionsDefault); - - // create new element - this.setElement(this._template(this.options)); - - // hide input field - if (!this.options.visible) { - this.$el.hide(); - } - - // set initial value - if (this.options.value) { - this.value(this.options.value); - } - - // current value - this.current = this.options.value; - - // onchange event handler. fires on user activity. - var self = this; - this.$el.find('input').on('change', function() { - self.value(self._getValue()); - }); - }, - - // value - value : function (new_val) { - // get current value - var before = this.current; - - // set new value - if (new_val !== undefined) { - this.$el.find('label').removeClass('active'); - this.$el.find('[value="' + new_val + '"]').closest('label').addClass('active'); - this.current = new_val; - } - - // check value - var after = this.current; - if (after != before && this.options.onchange) { - this.options.onchange(this.current); - } - - // get and return value - return this.current; - }, - - // get value - _getValue: function() { - var selected = this.$el.find(':checked'); - var value = null; - if (selected.length > 0) { - value = selected.val(); - } - return value; - }, - - // element - _template: function(options) { - var tmpl = '<div class="ui-checkbox">'; - for (key in options.data) { - var pair = options.data[key]; - tmpl += '<input type="checkbox" name="' + options.id + '" value="' + pair.value + '" selected>' + pair.label + '<br>'; - } - tmpl += '</div>'; - return tmpl; - } -}); - -return { - View : View -}; - -}); diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/ui/ui-misc.js --- a/static/scripts/mvc/ui/ui-misc.js +++ b/static/scripts/mvc/ui/ui-misc.js @@ -1,6 +1,6 @@ // dependencies -define(['utils/utils', 'mvc/ui/ui-select-default', 'mvc/ui/ui-slider', 'mvc/ui/ui-checkbox', 'mvc/ui/ui-radiobutton', 'mvc/ui/ui-button-menu', 'mvc/ui/ui-modal'], - function(Utils, Select, Slider, Checkbox, RadioButton, ButtonMenu, Modal) { +define(['utils/utils', 'mvc/ui/ui-select-default', 'mvc/ui/ui-slider', 'mvc/ui/ui-options', 'mvc/ui/ui-button-menu', 'mvc/ui/ui-modal'], + function(Utils, Select, Slider, Options, ButtonMenu, Modal) { /** * This class contains backbone wrappers for basic ui elements such as Images, Labels, Buttons, Input fields etc. @@ -403,8 +403,8 @@ Label : Label, Message : Message, Modal : Modal, - RadioButton : RadioButton, - Checkbox : Checkbox, + RadioButton : Options.RadioButton, + Checkbox : Options.Checkbox, Searchbox : Searchbox, Select : Select, Hidden : Hidden, diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/ui/ui-options.js --- /dev/null +++ b/static/scripts/mvc/ui/ui-options.js @@ -0,0 +1,225 @@ +// dependencies +define(['utils/utils'], function(Utils) { + +/** base class for options based ui elements **/ +var OptionsBase = Backbone.View.extend({ + // settings + settings : { + multiple : false + }, + + // options + optionsDefault: { + value : [], + visible : true, + data : [], + id : Utils.uuid(), + empty : 'No data available' + }, + + // initialize + initialize: function(options) { + // configure options + this.options = Utils.merge(options, this.optionsDefault); + + // create new element + this.setElement(this._template(this.options)); + + // hide input field + if (!this.options.visible) { + this.$el.hide(); + } + + // initialize data + this.update(this.options.data); + + // set initial value + if (this.options.value) { + this.value(this.options.value); + } + + // add change event. fires on trigger + var self = this; + this.on('change', function() { + self._change(); + }); + }, + + // update options + update: function(options) { + // backup current value + var current = this._getValue(); + + // remove all options + this.$el.find('.ui-option').remove(); + + // add new options + for (var key in options) { + this.$el.append(this._templateOption(options[key])); + } + + // add change events + var self = this; + this.$el.find('input').on('change', function() { + self.value(self._getValue()); + self._change(); + }); + + // refresh + this._refresh(); + + // set previous value + this.value(current); + }, + + // check if selected value exists (or any if multiple) + exists: function(value) { + if (typeof value === 'string') { + value = [value]; + } + for (var i in value) { + if (this.$el.find('input[value="' + value[i] + '"]').length > 0) { + return true; + } + } + return false; + }, + + // first + first: function() { + var options = this.$el.find('input'); + if (options.length > 0) { + return options.val(); + } else { + return undefined; + } + }, + + // change + _change: function() { + if (this.options.onchange) { + this.options.onchange(this._getValue()); + } + }, + + // refresh + _refresh: function() { + // remove placeholder + this.$el.find('.ui-error').remove(); + + // count remaining options + var remaining = this.$el.find('input').length; + if (remaining == 0) { + this.$el.append(this._templateEmpty()); + } + }, + + // get value + _getValue: function() { + // get selected values + var selected = this.$el.find(':checked'); + if (selected.length == 0) { + return null; + } + + // return multiple or single value + if (this.settings.multiple) { + var values = []; + selected.each(function() { + values.push($(this).val()); + }); + return values; + } else { + return selected.val(); + } + }, + + // template for options + _templateEmpty: function() { + return '<div class="ui-error">' + this.options.empty + '</div>'; + } +}); + +/** checkbox options field **/ +var Checkbox = {}; +Checkbox.View = OptionsBase.extend({ + // initialize + initialize: function(options) { + this.settings.multiple = true; + OptionsBase.prototype.initialize.call(this, options); + }, + + // value + value: function (new_val) { + // check if its an array + if (typeof new_val === 'string') { + new_val = [new_val]; + } + + // set new value + if (new_val !== undefined) { + // reset selection + this.$el.find('input').prop('checked', false); + + // update to new selection + for (var i in new_val) { + this.$el.find('input[value=' + new_val[i] + ']').prop('checked', true); + }; + } + + // get and return value + return this._getValue(); + }, + + // template for options + _templateOption: function(pair) { + return '<div class="ui-option">' + + '<input type="checkbox" name="' + this.options.id + '" value="' + pair.value + '"/>' + pair.label + '<br>' + + '</div>'; + }, + + // template + _template: function() { + return '<div class="ui-checkbox"/>'; + } +}); + +/** radio button options field **/ +var RadioButton = {}; +RadioButton.View = OptionsBase.extend({ + // initialize + initialize: function(options) { + OptionsBase.prototype.initialize.call(this, options); + }, + + // value + value: function (new_val) { + // set new value + if (new_val !== undefined) { + this.$el.find('label').removeClass('active'); + this.$el.find('[value="' + new_val + '"]').closest('label').addClass('active'); + } + + // get and return value + return this._getValue(); + }, + + // template for options + _templateOption: function(pair) { + return '<label class="btn btn-default">' + + '<input type="radio" name="' + this.options.id + '" value="' + pair.value + '">' + pair.label + + '</label>'; + }, + + // template + _template: function() { + return '<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'; + } +}); + +return { + Checkbox : Checkbox, + RadioButton : RadioButton +}; + +}); diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/ui/ui-radiobutton.js --- a/static/scripts/mvc/ui/ui-radiobutton.js +++ /dev/null @@ -1,93 +0,0 @@ -// dependencies -define(['utils/utils'], function(Utils) { - -// plugin -var View = Backbone.View.extend({ - // options - optionsDefault: { - value : '', - visible : true, - cls : '', - data : [], - id : Utils.uuid() - }, - - // initialize - initialize : function(options) { - // configure options - this.options = Utils.merge(options, this.optionsDefault); - - // create new element - this.setElement(this._template(this.options)); - - // hide input field - if (!this.options.visible) { - this.$el.hide(); - } - - // set initial value - if (this.options.value) { - this.value(this.options.value); - } - - // current value - this.current = this.options.value; - - // onchange event handler. fires on user activity. - var self = this; - this.$el.find('input').on('change', function() { - self.value(self._getValue()); - }); - }, - - // value - value : function (new_val) { - // get current value - var before = this.current; - - // set new value - if (new_val !== undefined) { - this.$el.find('label').removeClass('active'); - this.$el.find('[value="' + new_val + '"]').closest('label').addClass('active'); - this.current = new_val; - } - - // check value - var after = this.current; - if (after != before && this.options.onchange) { - this.options.onchange(this.current); - } - - // get and return value - return this.current; - }, - - // get value - _getValue: function() { - var selected = this.$el.find(':checked'); - var value = null; - if (selected.length > 0) { - value = selected.val(); - } - return value; - }, - - // element - _template: function(options) { - var tmpl = '<div class="btn-group ui-radiobutton" data-toggle="buttons">'; - for (key in options.data) { - var pair = options.data[key]; - tmpl += '<label class="btn btn-default">' + - '<input type="radio" name="' + options.id + '" value="' + pair.value + '" selected>' + pair.label + - '</label>'; - } - tmpl += '</div>'; - return tmpl; - } -}); - -return { - View : View -}; - -}); diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/ui/ui-select-default.js --- a/static/scripts/mvc/ui/ui-select-default.js +++ b/static/scripts/mvc/ui/ui-select-default.js @@ -172,7 +172,7 @@ // check if selected value exists exists: function(value) { - return this.$select.find('option[value=' + value + ']').length > 0; + return this.$select.find('option[value="' + value + '"]').length > 0; }, // change diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -31,10 +31,9 @@ // fill table _fill: function(ftp_files) { - if (ftp_files.length > 0) { // add table - this.$el.find('#upload-ftp-content').html($(this._template_table())); + this.$el.find('#upload-ftp-content').html($(this._templateTable())); // add files to table var size = 0; @@ -48,7 +47,7 @@ this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true)); } else { // add info - this.$el.find('#upload-ftp-content').html($(this._template_info())); + this.$el.find('#upload-ftp-content').html($(this._templateInfo())); } // hide spinner @@ -58,7 +57,7 @@ // add add: function(ftp_file) { // create new item - var $it = $(this._template_row(ftp_file)); + var $it = $(this._templateRow(ftp_file)); // append to table $(this.el).find('tbody').append($it); @@ -118,7 +117,7 @@ }, // template row - _template_row: function(options) { + _templateRow: function(options) { return '<tr>' + '<td><div id="upload-ftp-add"/></td>' + '<td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">' + options.path + '</p></td>' + @@ -128,8 +127,7 @@ }, // load table template - _template_table: function() - { + _templateTable: function() { return '<span style="whitespace: nowrap; float: left;">Available files: </span>' + '<span style="whitespace: nowrap; float: right;">' + '<span class="upload-icon fa fa-file-text-o"/>' + @@ -151,16 +149,14 @@ }, // load table template - _template_info: function() - { + _templateInfo: function() { return '<div class="upload-ftp-warning warningmessage">' + 'Your FTP directory does not contain any files.' + '</div>'; }, // load html template - _template: function() - { + _template: function() { return '<div class="upload-ftp">' + '<div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/>' + '<div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>' + this.app.options.ftp_upload_site + '</strong> using your Galaxy credentials (email address and password).</div>' + diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/upload/upload-row.js --- a/static/scripts/mvc/upload/upload-row.js +++ b/static/scripts/mvc/upload/upload-row.js @@ -214,16 +214,14 @@ // // genome - _refreshGenome: function() - { + _refreshGenome: function() { // update genome info on screen var genome = this.model.get('genome'); this.select_genome.value(genome); }, // progress - _refreshInfo: function() - { + _refreshInfo: function() { // write error message var info = this.model.get('info'); if (info) { @@ -234,8 +232,7 @@ }, // progress - _refreshPercentage : function() - { + _refreshPercentage : function() { var percentage = parseInt(this.model.get('percentage')); this.$el.find('.progress-bar').css({ width : percentage + '%' }); if (percentage != 100) @@ -245,8 +242,7 @@ }, // status - _refreshStatus : function() - { + _refreshStatus : function() { // get element var it = this.$el; @@ -315,8 +311,7 @@ }, // attach file info popup - _showExtensionInfo : function() - { + _showExtensionInfo : function() { // initialize var $el = $(this.el).find('#extension-info'); var extension = this.model.get('extension'); @@ -343,8 +338,7 @@ }, // attach file info popup - _showSettings : function() - { + _showSettings : function() { // check if popover is visible if (!this.settings.visible) { // show popover @@ -371,8 +365,7 @@ }, // template - _template: function(options) - { + _template: function(options) { return '<tr id="upload-item-' + options.id + '" class="upload-item">' + '<td>' + '<div style="position: relative;">' + diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/upload/upload-settings.js --- a/static/scripts/mvc/upload/upload-settings.js +++ b/static/scripts/mvc/upload/upload-settings.js @@ -25,12 +25,12 @@ // ui event: space to tabs this.$el.find('#upload-space-to-tabs').on('click', function() { - self._switch_state('#upload-space-to-tabs', 'space_to_tabs'); + self._switchState('#upload-space-to-tabs', 'space_to_tabs'); }); // ui event: to posix this.$el.find('#upload-to-posix-lines').on('click', function() { - self._switch_state('#upload-to-posix-lines', 'to_posix_lines'); + self._switchState('#upload-to-posix-lines', 'to_posix_lines'); }); // render @@ -45,8 +45,8 @@ // render render: function() { // render states - this._render_state('#upload-space-to-tabs', this.model.get('space_to_tabs')); - this._render_state('#upload-to-posix-lines', this.model.get('to_posix_lines')); + this._renderState('#upload-space-to-tabs', this.model.get('space_to_tabs')); + this._renderState('#upload-to-posix-lines', this.model.get('to_posix_lines')); // disable options var $cover = this.$el.find('#upload-settings-cover'); @@ -58,16 +58,16 @@ }, // switch state - _switch_state: function (element_id, parameter_id) { + _switchState: function (element_id, parameter_id) { if (this.model.get('status') == 'init') { var checked = !this.model.get(parameter_id); this.model.set(parameter_id, checked); - this._render_state(element_id, checked); + this._renderState(element_id, checked); } }, // render state - _render_state: function (element_id, checked) { + _renderState: function (element_id, checked) { // swith icon class var $it = this.$el.find(element_id); $it.removeClass(); @@ -79,8 +79,7 @@ }, // load template - _template: function() - { + _template: function() { return '<div class="upload-settings" style="position: relative;">' + '<div id="upload-settings-cover" class="upload-settings-cover"/>' + '<table class="table table-striped">' + diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/mvc/upload/upload-view.js --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -19,8 +19,7 @@ ) { // galaxy upload -return Backbone.View.extend( -{ +return Backbone.View.extend({ // options options : { nginx_upload_path : '' diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/tools/tools-datasets.js --- a/static/scripts/packed/mvc/tools/tools-datasets.js +++ b/static/scripts/packed/mvc/tools/tools-datasets.js @@ -1,1 +1,1 @@ -define(["mvc/history/history-contents"],function(a){return Backbone.Model.extend({initialize:function(c){this.currHistoryContents=new a.HistoryContents({});this.currHistoryContents.historyId=c.history_id;var b=this;var d=this.currHistoryContents.fetchAllDetails().done(function(){console.debug("tools-datasets::initialize() - Completed.");c.success&&c.success()}).fail(function(){console.debug("tools-datasets::initialize() - Ajax request failed.")})},filterType:function(b){return this.currHistoryContents.filter(function(c){var d=c.get("history_content_type");var e=c.get("file_ext");return d==="dataset"})},filter:function(b){return _.first(this.currHistoryContents.filter(function(c){return c.get("id")===b}))}})}); \ No newline at end of file +define(["mvc/history/history-contents"],function(a){return Backbone.Model.extend({initialize:function(c){this.currHistoryContents=new a.HistoryContents({});this.currHistoryContents.historyId=c.history_id;var b=this;var d=this.currHistoryContents.fetchAllDetails().done(function(){console.debug("tools-datasets::initialize() - Completed.");c.success&&c.success()}).fail(function(){console.debug("tools-datasets::initialize() - Ajax request failed.")})},filterType:function(b){b=b||{};return this.currHistoryContents.filter(function(d){var e=false;for(var c in b.data_types){if(d.get("data_type").indexOf(b.data_types[c])!=-1){e=true;break}}return(d.get("history_content_type")===b.content_type||!b.content_type)&&(e||!b.data_types)&&!d.get("deleted")})},filter:function(b){return _.first(this.currHistoryContents.filter(function(c){return c.get("id")===b}))}})}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/tools/tools-form.js --- a/static/scripts/packed/mvc/tools/tools-form.js +++ b/static/scripts/packed/mvc/tools/tools-form.js @@ -1,1 +1,1 @@ -define(["mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-datasets","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(h,l,j,a,f,d,i,k,c,g){var e=Backbone.Model.extend({initialize:function(m){this.url=galaxy_config.root+"api/tools/"+m.id+"?io_details=true"}});var b=Backbone.View.extend({main_el:"body",initialize:function(n){var m=this;this.options=n;this.model=new e({id:n.id});this.tree=new c(this);this.job_handler=new g(this);this.field_list={};this.input_list={};this.element_list={};this.datasets=new i({history_id:this.options.history_id,success:function(){m._initializeToolForm()}})},reset:function(){for(var m in this.element_list){this.element_list[m].reset()}},_initializeToolForm:function(){var n=this;var o=new l.ButtonIcon({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(n.options.biostar_url+"/p/new/post/")}});var p=new l.ButtonIcon({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(n.options.biostar_url+"/t/"+n.options.id+"/")}});var m=new l.ButtonIcon({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",galaxy_config.root+"root?tool_id="+n.options.id)}});this.model.fetch({error:function(q){console.debug("tools-form::_initializeToolForm() : Attempt to fetch tool model failed.")},success:function(){n.inputs=n.model.get("inputs");n.portlet=new h.View({icon:"fa-wrench",title:"<b>"+n.model.get("name")+"</b> "+n.model.get("description"),buttons:{execute:new l.ButtonIcon({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",floating:"clear",onclick:function(){n.job_handler.submit()}})},operations:{button_question:o,button_search:p,button_share:m}});if(!n.options.biostar_url){o.$el.hide();p.$el.hide()}n.message=new l.Message();n.portlet.append(n.message.$el);$(n.main_el).append(n.portlet.$el);if(n.options.help!=""){$(n.main_el).append(d.help(n.options.help))}if(n.options.citations){$(n.main_el).append(d.citations());var q=new j.ToolCitationCollection();q.tool_id=n.options.id;var r=new a.CitationListView({collection:q});r.render();q.fetch()}n.setElement(n.portlet.content());n.section=new k.View(n,{inputs:n.model.get("inputs")});n.portlet.append(n.section.$el);n.refresh()}})},refresh:function(){this.tree.refresh();for(var m in this.field_list){this.field_list[m].trigger("change")}console.debug("tools-form::refresh() - Recreated tree structure. Refresh.")}});return{View:b}}); \ No newline at end of file +define(["mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-datasets","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(h,l,j,a,f,d,i,k,c,g){var e=Backbone.Model.extend({initialize:function(m){this.url=galaxy_config.root+"api/tools/"+m.id+"?io_details=true"}});var b=Backbone.View.extend({main_el:"body",initialize:function(n){var m=this;this.options=n;this.model=new e({id:n.id});this.tree=new c(this);this.job_handler=new g(this);this.field_list={};this.input_list={};this.element_list={};this.datasets=new i({history_id:this.options.history_id,success:function(){m._initializeToolForm()}})},message:function(m){$(this.main_el).empty();$(this.main_el).append(d.message(m))},reset:function(){for(var m in this.element_list){this.element_list[m].reset()}},refresh:function(){this.tree.refresh();for(var m in this.field_list){this.field_list[m].trigger("change")}console.debug("tools-form::refresh() - Recreated tree structure. Refresh.")},_initializeToolForm:function(){var n=this;var o=new l.ButtonIcon({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(n.options.biostar_url+"/p/new/post/")}});var p=new l.ButtonIcon({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(n.options.biostar_url+"/t/"+n.options.id+"/")}});var m=new l.ButtonIcon({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",galaxy_config.root+"root?tool_id="+n.options.id)}});this.model.fetch({error:function(q){console.debug("tools-form::_initializeToolForm() : Attempt to fetch tool model failed.")},success:function(){n.inputs=n.model.get("inputs");n.portlet=new h.View({icon:"fa-wrench",title:"<b>"+n.model.get("name")+"</b> "+n.model.get("description"),buttons:{execute:new l.ButtonIcon({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",floating:"clear",onclick:function(){n.job_handler.submit()}})},operations:{button_question:o,button_search:p,button_share:m}});if(!n.options.biostar_url){o.$el.hide();p.$el.hide()}$(n.main_el).append(n.portlet.$el);if(n.options.help!=""){$(n.main_el).append(d.help(n.options.help))}if(n.options.citations){$(n.main_el).append(d.citations());var q=new j.ToolCitationCollection();q.tool_id=n.options.id;var r=new a.CitationListView({collection:q});r.render();q.fetch()}n.setElement(n.portlet.content());n.section=new k.View(n,{inputs:n.model.get("inputs")});n.portlet.append(n.section.$el);n.refresh();n.tree.finalize()}})}});return{View:b}}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/tools/tools-jobs.js --- a/static/scripts/packed/mvc/tools/tools-jobs.js +++ b/static/scripts/packed/mvc/tools/tools-jobs.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(c,b){this.app=c;this.options=a.merge(b,this.optionsDefault)},submit:function(){var b=this;var c={tool_id:this.app.options.id,inputs:this.app.tree.finalize()};this.app.reset();a.request("POST",galaxy_config.root+"api/tools",c,function(d){if(!d.outputs||d.outputs.length==0){console.log(d)}b._refreshHdas()},function(d){if(d&&d.message&&d.message.data){var g=b.app.tree.match(d.message.data);for(var f in g){var e=g[f];if(!e){e="Please verify this parameter."}b.app.element_list[f].error(e)}}})},_refreshHdas:function(){if(parent.Galaxy&&parent.Galaxy.currHistoryPanel){parent.Galaxy.currHistoryPanel.refreshContents()}}})}); \ No newline at end of file +define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(c,b){this.app=c;this.options=a.merge(b,this.optionsDefault)},submit:function(){var b=this;var c={tool_id:this.app.options.id,inputs:this.app.tree.finalize()};this.app.reset();a.request("POST",galaxy_config.root+"api/tools",c,function(d){if(!d.outputs||d.outputs.length==0){console.debug(d)}b.app.message({text:"A job has been successfully added to the queue. You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from 'running' to 'finished' if completed successfully or 'error' if problems were encountered."});b._refreshHdas()},function(d){console.debug(d);if(d&&d.message&&d.message.data){var g=b.app.tree.match(d.message.data);for(var f in g){var e=g[f];if(!e){e="Please verify this parameter."}b.app.element_list[f].error(e)}}})},_refreshHdas:function(){if(parent.Galaxy&&parent.Galaxy.currHistoryPanel){parent.Galaxy.currHistoryPanel.refreshContents()}}})}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/tools/tools-section.js --- a/static/scripts/packed/mvc/tools/tools-section.js +++ b/static/scripts/packed/mvc/tools/tools-section.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-select-dataset"],function(d,b,g,a,c){var e=Backbone.View.extend({initialize:function(h){this.setElement(this._template(h))},error:function(h){this.$el.find(".ui-table-form-error-text").html(h);this.$el.find(".ui-table-form-error").fadeIn();this.$el.addClass("ui-table-row-error")},reset:function(){this.$el.find(".ui-table-form-error").hide();this.$el.removeClass("ui-table-form-error")},_template:function(h){var i;if(h.highlight){i=$('<div class="ui-table-element ui-table-form-section"/>')}else{i=$('<div class="ui-table-element"/>')}i.append('<div class="ui-table-form-error"><span class="fa fa-arrow-down"/><span class="ui-table-form-error-text"></div>');if(h.label){i.append('<div class="ui-table-form-title-strong">'+h.label+"</div>")}i.append(h.$el);if(h.help){i.append('<div class="ui-table-form-info">'+h.help+"</div>")}return i}});var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new b.View(h);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var h in this.inputs){this._add(this.inputs[h])}},_add:function(j){var i=this;var h=jQuery.extend(true,{},j);h.id=d.uuid();this.app.input_list[h.id]=h;var k=h.type;switch(k){case"conditional":this._addConditional(h);break;case"repeat":this._addRepeat(h);break;default:this._addRow(k,h)}},_addConditional:function(h){h.label=h.test_param.label;h.value=h.test_param.value;var j=this._addRow("conditional",h);for(var l in h.cases){var k=h.id+"-section-"+l;var n=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});var m=new e({label:"",help:h.help,$el:n.$el,highlight:true});this.table.add(m.$el);this.table.append(k)}},_addRepeat:function(h){var j=this;var m=new a.View({title_new:"Add "+h.title,max:h.max,onnew:function(){var i=h.id+"-section-"+d.uuid();var p=new f(j.app,{inputs:h.inputs,cls:"ui-table-plain"});m.add({id:i,title:h.title,$el:p.$el,ondel:function(){m.del(i);m.retitle(h.title);j.app.refresh()}});m.retitle(h.title);m.show(i);j.app.refresh()}});for(var l=0;l<h.min;l++){var k=h.id+"-section-"+d.uuid();var o=new f(j.app,{inputs:h.inputs,cls:"ui-table-plain"});m.add({id:k,title:h.title,$el:o.$el})}m.retitle(h.title);var n=new e({label:h.title,help:h.help,$el:m.$el,highlight:true});this.table.add(n.$el);this.table.append(h.id)},_addRow:function(j,h){var l=h.id;var i=null;switch(j){case"text":i=this._field_text(h);break;case"select":i=this._field_select(h);break;case"data":i=this._field_data(h);break;case"data_column":i=this._field_data_colum(h);break;case"conditional":i=this._field_conditional(h);break;case"hidden":i=this._field_hidden(h);break;case"integer":i=this._field_slider(h);break;case"float":i=this._field_slider(h);break;case"boolean":i=this._field_boolean(h);break}if(!i){if(h.options){i=this._field_select(h)}else{i=this._field_text(h)}console.debug("tools-form::_addRow() : Auto matched field type ("+j+").")}if(h.value!==undefined){i.value(h.value)}this.app.field_list[l]=i;var k=new e({label:h.label,help:h.help,$el:i.$el});this.app.element_list[l]=k;this.table.add(k.$el);this.table.append(l);return this.table.get(l)},_field_conditional:function(h){var j=this;var k=[];for(var l in h.test_param.options){var m=h.test_param.options[l];k.push({label:m[0],value:m[1]})}return new g.Select.View({id:"field-"+h.id,data:k,onchange:function(u){for(var s in h.cases){var o=h.cases[s];var r=h.id+"-section-"+s;var n=j.table.get(r);var q=false;for(var p in o.inputs){var t=o.inputs[p].type;if(t&&t!=="hidden"){q=true;break}}if(o.value==u&&q){n.fadeIn("fast")}else{n.hide()}}}})},_field_data:function(h){var i=this;var j=h.id;return new c.View(this.app,{id:"field-"+j,extensions:h.extensions,multiple:h.multiple,onchange:function(u){if(u instanceof Array){u=u[0]}var s=i.app.tree.references(j,"data_column");var m=i.app.datasets.filter(u);if(m&&s.length>0){console.debug("tool-form::field_data() - Selected dataset "+u+".");var w=m.get("metadata_column_types");if(!w){console.debug("tool-form::field_data() - FAILED: Could not find metadata for dataset "+u+".")}for(var o in s){var q=i.app.input_list[s[o]];var r=i.app.field_list[s[o]];if(!q||!r){console.debug("tool-form::field_data() - FAILED: Column not found.")}var n=q.numerical;var l=[];for(var v in w){var t=w[v];var k=(parseInt(v)+1);var p="Text";if(t=="int"||t=="float"){p="Number"}if(t=="int"||t=="float"||!n){l.push({label:"Column: "+k+" ["+p+"]",value:k})}}if(r){r.update(l);if(!r.exists(r.value())){r.value(r.first())}}}}else{console.debug("tool-form::field_data() - FAILED: Could not find dataset "+u+".")}}})},_field_select:function(h){var j=[];for(var k in h.options){var l=h.options[k];j.push({label:l[0],value:l[1]})}var m=g.Select;switch(h.display){case"checkboxes":m=g.Checkbox;break;case"radio":m=g.RadioButton;break}return new m.View({id:"field-"+h.id,data:j,multiple:h.multiple})},_field_data_colum:function(h){return new g.Select.View({id:"field-"+h.id,multiple:h.multiple})},_field_text:function(h){return new g.Input({id:"field-"+h.id,area:h.area})},_field_slider:function(h){var i=1;if(h.type=="float"){i=(h.max-h.min)/10000}return new g.Slider.View({id:"field-"+h.id,min:h.min||0,max:h.max||1000,step:i})},_field_hidden:function(h){return new g.Hidden({id:"field-"+h.id})},_field_boolean:function(h){return new g.RadioButton.View({id:"field-"+h.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]})}});return{View:f}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-select-dataset"],function(d,b,g,a,c){var e=Backbone.View.extend({initialize:function(h){this.setElement(this._template(h))},error:function(h){this.$el.find(".ui-table-form-error-text").html(h);this.$el.find(".ui-table-form-error").fadeIn()},reset:function(){this.$el.find(".ui-table-form-error").hide()},_template:function(h){var i;if(h.highlight){i=$('<div class="ui-table-element ui-table-form-section"/>')}else{i=$('<div class="ui-table-element"/>')}i.append('<div class="ui-table-form-error ui-error"><span class="fa fa-arrow-down"/><span class="ui-table-form-error-text"></div>');if(h.label){i.append('<div class="ui-table-form-title-strong">'+h.label+"</div>")}i.append(h.$el);if(h.help){i.append('<div class="ui-table-form-info">'+h.help+"</div>")}return i}});var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new b.View(h);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var h in this.inputs){this._add(this.inputs[h])}},_add:function(j){var i=this;var h=jQuery.extend(true,{},j);h.id=d.uuid();this.app.input_list[h.id]=h;var k=h.type;switch(k){case"conditional":this._addConditional(h);break;case"repeat":this._addRepeat(h);break;default:this._addRow(k,h)}},_addConditional:function(h){h.label=h.test_param.label;h.value=h.test_param.value;var j=this._addRow("conditional",h);for(var l in h.cases){var k=h.id+"-section-"+l;var n=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});var m=new e({label:"",help:h.help,$el:n.$el,highlight:true});this.table.add(m.$el);this.table.append(k)}},_addRepeat:function(h){var j=this;var m=new a.View({title_new:"Add "+h.title,max:h.max,onnew:function(){var i=h.id+"-section-"+d.uuid();var p=new f(j.app,{inputs:h.inputs,cls:"ui-table-plain"});m.add({id:i,title:h.title,$el:p.$el,ondel:function(){m.del(i);m.retitle(h.title);j.app.refresh()}});m.retitle(h.title);m.show(i);j.app.refresh()}});for(var l=0;l<h.min;l++){var k=h.id+"-section-"+d.uuid();var o=new f(j.app,{inputs:h.inputs,cls:"ui-table-plain"});m.add({id:k,title:h.title,$el:o.$el})}m.retitle(h.title);var n=new e({label:h.title,help:h.help,$el:m.$el,highlight:true});this.table.add(n.$el);this.table.append(h.id)},_addRow:function(j,h){var l=h.id;var i=null;switch(j){case"text":i=this._field_text(h);break;case"select":i=this._field_select(h);break;case"data":i=this._field_data(h);break;case"data_column":i=this._field_select(h);break;case"conditional":i=this._field_conditional(h);break;case"hidden":i=this._field_hidden(h);break;case"integer":i=this._field_slider(h);break;case"float":i=this._field_slider(h);break;case"boolean":i=this._field_boolean(h);break}if(!i){if(h.options){i=this._field_select(h)}else{i=this._field_text(h)}console.debug("tools-form::_addRow() : Auto matched field type ("+j+").")}if(h.value!==undefined){i.value(h.value)}this.app.field_list[l]=i;var k=new e({label:h.label,help:h.help,$el:i.$el});this.app.element_list[l]=k;this.table.add(k.$el);this.table.append(l);return this.table.get(l)},_field_conditional:function(h){var j=this;var k=[];for(var l in h.test_param.options){var m=h.test_param.options[l];k.push({label:m[0],value:m[1]})}return new g.Select.View({id:"field-"+h.id,data:k,onchange:function(u){for(var s in h.cases){var o=h.cases[s];var r=h.id+"-section-"+s;var n=j.table.get(r);var q=false;for(var p in o.inputs){var t=o.inputs[p].type;if(t&&t!=="hidden"){q=true;break}}if(o.value==u&&q){n.fadeIn("fast")}else{n.hide()}}}})},_field_data:function(h){var i=this;var j=h.id;return new c.View(this.app,{id:"field-"+j,extensions:h.extensions,multiple:h.multiple,onchange:function(u){if(u instanceof Array){u=u[0]}var s=i.app.tree.references(j,"data_column");var m=i.app.datasets.filter(u);if(m&&s.length>0){console.debug("tool-form::field_data() - Selected dataset "+u+".");var w=m.get("metadata_column_types");if(!w){console.debug("tool-form::field_data() - FAILED: Could not find metadata for dataset "+u+".")}for(var o in s){var q=i.app.input_list[s[o]];var r=i.app.field_list[s[o]];if(!q||!r){console.debug("tool-form::field_data() - FAILED: Column not found.")}var n=q.numerical;var l=[];for(var v in w){var t=w[v];var k=(parseInt(v)+1);var p="Text";if(t=="int"||t=="float"){p="Number"}if(t=="int"||t=="float"||!n){l.push({label:"Column: "+k+" ["+p+"]",value:k})}}if(r){r.update(l);if(!r.exists(r.value())){r.value(r.first())}}}}else{console.debug("tool-form::field_data() - FAILED: Could not find dataset "+u+".")}}})},_field_select:function(h){var j=[];for(var k in h.options){var l=h.options[k];j.push({label:l[0],value:l[1]})}var m=g.Select;switch(h.display){case"checkboxes":m=g.Checkbox;break;case"radio":m=g.RadioButton;break}return new m.View({id:"field-"+h.id,data:j,multiple:h.multiple})},_field_data_colum:function(h){return new g.Select.View({id:"field-"+h.id,multiple:h.multiple})},_field_text:function(h){return new g.Input({id:"field-"+h.id,area:h.area})},_field_slider:function(h){var i=1;if(h.type=="float"){i=(h.max-h.min)/10000}return new g.Slider.View({id:"field-"+h.id,min:h.min||0,max:h.max||1000,step:i})},_field_hidden:function(h){return new g.Hidden({id:"field-"+h.id})},_field_boolean:function(h){return new g.RadioButton.View({id:"field-"+h.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]})}});return{View:f}}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/tools/tools-select-dataset.js --- a/static/scripts/packed/mvc/tools/tools-select-dataset.js +++ b/static/scripts/packed/mvc/tools/tools-select-dataset.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs"],function(b,d,a){var c=Backbone.View.extend({initialize:function(k,f){var e=this;var h=k.datasets.filterType();var j=[];for(var g in h){j.push({label:h[g].get("name"),value:h[g].get("id")})}this.select=new d.Select.View({data:j,value:j[0].value,onchange:function(){e.trigger("change")}});this.select_multiple=new d.Select.View({multiple:true,data:j,value:j[0].value,onchange:function(){e.trigger("change")}});this.select_collection=new d.Select.View({data:j,value:j[0].value,onchange:function(){e.trigger("change")}});this.on("change",function(){if(f.onchange){f.onchange(e.value())}});this.tabs=new a.View({onchange:function(){e.trigger("change")}});this.tabs.add({id:"single",title:"Select a dataset",$el:this.select.$el});this.tabs.add({id:"multiple",title:"Select multiple datasets",$el:this.select_multiple.$el});this.tabs.add({id:"collection",title:"Select a dataset collection",$el:this.select_collection.$el});this.setElement(this.tabs.$el)},value:function(e){var f=this.tabs.current();switch(f){case"multiple":return this.select_multiple.value();case"collection":return this.select_collection.value();default:return this.select.value()}},update:function(e){this.select.update(e)}});return{View:c}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs"],function(b,d,a){var c=Backbone.View.extend({initialize:function(m,g){var f=this;this.tabs=new a.View({onchange:function(){f.trigger("change")}});var k=m.datasets.filterType({content_type:"dataset",data_types:g.extensions});var j=[];for(var h in k){j.push({label:k[h].get("name"),value:k[h].get("id")})}this.select_datasets=new d.Select.View({multiple:true,data:j,value:j[0]&&j[0].value,onchange:function(){f.trigger("change")}});this.tabs.add({id:"datasets",title:"Select datasets",$el:this.select_datasets.$el});var l=m.datasets.filterType({content_type:"collection",data_types:g.extensions});var e=[];for(var h in l){e.push({label:l[h].get("name"),value:l[h].get("id")})}this.select_collection=new d.Select.View({data:e,value:e[0]&&e[0].value,onchange:function(){f.trigger("change")}});this.tabs.add({id:"collection",title:"Select a dataset collection",$el:this.select_collection.$el});this.setElement(this.tabs.$el);this.on("change",function(){if(g.onchange){g.onchange(f.value())}})},value:function(e){var f=this.tabs.current();switch(f){case"datasets":return this.select_datasets.value();case"collection":return this.select_collection.value()}},update:function(e){this.select.update(e)}});return{View:c}}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/tools/tools-template.js --- a/static/scripts/packed/mvc/tools/tools-template.js +++ b/static/scripts/packed/mvc/tools/tools-template.js @@ -1,1 +1,1 @@ -define([],function(){return{help:function(a){return'<div class="toolHelp"><div class="toolHelpBody">'+a+"</div></div>"},citations:function(){return'<div id="citations"></div>'}}}); \ No newline at end of file +define([],function(){return{help:function(a){return'<div class="toolHelp"><div class="toolHelpBody">'+a+"</div></div>"},citations:function(){return'<div id="citations"></div>'},message:function(a){return'<div class="donemessagelarge"><p>'+a.text+"</p></div>"}}}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/tools/tools-tree.js --- a/static/scripts/packed/mvc/tools/tools-tree.js +++ b/static/scripts/packed/mvc/tools/tools-tree.js @@ -1,1 +1,1 @@ -define([],function(){return Backbone.Model.extend({initialize:function(a){this.app=a},refresh:function(){this.dict={};this.xml=$("<div/>");if(!this.app.section){return{}}this._iterate(this.app.section.$el,this.dict,this.xml)},finalize:function(){var a=this;this.job_def={};this.job_ids={};function c(f,e,d){a.job_def[f]=d;a.job_ids[f]=e}function b(k,l){for(var f in l){var d=l[f];if(d.input){var m=d.input;var h=k;if(k!=""){h+="|"}h+=m.name;switch(m.type){case"repeat":var g=0;for(var e in d){if(e.indexOf("section")!=-1){b(h+"_"+g++,d[e])}}break;case"conditional":var n=a.app.field_list[m.id].value();c(h+"|"+m.test_param.name,m.id,n);for(var e in m.cases){if(m.cases[e].value==n){b(h,l[m.id+"-section-"+e]);break}}break;case"data":var n={id:a.app.field_list[m.id].value(),src:"hda"};c(h,m.id,n);break;case"boolean":var n=a.app.field_list[m.id].value();if(n==="true"){n=m.truevalue}else{n=m.falsevalue}c(h,m.id,n);break;default:c(h,m.id,a.app.field_list[m.id].value())}}}}b("",this.dict);return this.job_def},match:function(c){var a={};var b=this;function d(j,h){if(typeof h==="string"){var f=b.app.tree.job_ids[j];if(f){a[f]=h}}else{for(var g in h){var e=g;if(j!==""){e=j+"|"+e}d(e,h[g])}}}d("",c);return a},references:function(c,e){var g=[];var b=this;function d(h,j){var i=$(j).children();var l=[];var k=false;i.each(function(){var o=this;var n=$(o).attr("id");if(n!==c){var m=b.app.input_list[n];if(m){if(m.name==h){k=true;return false}if(m.data_ref==h&&m.type==e){l.push(n)}}}});if(!k){g=g.concat(l);i.each(function(){d(h,this)})}}var f=this.xml.find("#"+c);if(f.length>0){var a=this.app.input_list[c];if(a){d(a.name,f.parent())}}return g},_iterate:function(d,e,b){var a=this;var c=$(d).children();c.each(function(){var i=this;var h=$(i).attr("id");if($(i).hasClass("section-row")||$(i).hasClass("tab-pane")){e[h]={};var f=a.app.input_list[h];if(f){e[h]={input:f}}var g=$('<div id="'+h+'"/>');b.append(g);a._iterate(i,e[h],g)}else{a._iterate(i,e,b)}})}})}); \ No newline at end of file +define([],function(){return Backbone.Model.extend({initialize:function(a){this.app=a},refresh:function(){this.dict={};this.xml=$("<div/>");if(!this.app.section){return{}}this._iterate(this.app.section.$el,this.dict,this.xml)},finalize:function(){var a=this;this.job_def={};this.job_ids={};function c(f,e,d){a.job_def[f]=d;a.job_ids[f]=e}function b(h,j){for(var f in j){var d=j[f];if(d.input){var k=d.input;var g=h;if(h!=""){g+="|"}g+=k.name;switch(k.type){case"repeat":var f=0;for(var e in d){if(e.indexOf("section")!=-1){b(g+"_"+f++,d[e])}}break;case"conditional":var l=a.app.field_list[k.id].value();c(g+"|"+k.test_param.name,k.id,l);for(var e in k.cases){if(k.cases[e].value==l){b(g,j[k.id+"-section-"+e]);break}}break;case"data":var m=null;var l=a.app.field_list[k.id].value();if(typeof l==="string"){m={id:l,src:"hda"}}else{m=[];for(var e in l){m.push({id:l[e],src:"hda"})}}c(g,k.id,m);break;case"boolean":var l=a.app.field_list[k.id].value();if(l==="true"){l=k.truevalue}else{l=k.falsevalue}c(g,k.id,l);break;default:c(g,k.id,a.app.field_list[k.id].value())}}}}b("",this.dict);console.log(this.job_def);return this.job_def},match:function(c){var a={};var b=this;function d(j,h){if(typeof h==="string"){var f=b.app.tree.job_ids[j];if(f){a[f]=h}}else{for(var g in h){var e=g;if(j!==""){e=j+"|"+e}d(e,h[g])}}}d("",c);return a},references:function(c,e){var g=[];var b=this;function d(h,j){var i=$(j).children();var l=[];var k=false;i.each(function(){var o=this;var n=$(o).attr("id");if(n!==c){var m=b.app.input_list[n];if(m){if(m.name==h){k=true;return false}if(m.data_ref==h&&m.type==e){l.push(n)}}}});if(!k){g=g.concat(l);i.each(function(){d(h,this)})}}var f=this.xml.find("#"+c);if(f.length>0){var a=this.app.input_list[c];if(a){d(a.name,f.parent())}}return g},_iterate:function(d,e,b){var a=this;var c=$(d).children();c.each(function(){var i=this;var h=$(i).attr("id");if($(i).hasClass("section-row")||$(i).hasClass("tab-pane")){e[h]={};var f=a.app.input_list[h];if(f){e[h]={input:f}}var g=$('<div id="'+h+'"/>');b.append(g);a._iterate(i,e[h],g)}else{a._iterate(i,e,b)}})}})}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/ui/ui-checkbox.js --- a/static/scripts/packed/mvc/ui/ui-checkbox.js +++ /dev/null @@ -1,1 +0,0 @@ -define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{value:"",visible:true,cls:"",data:[],id:a.uuid()},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));if(!this.options.visible){this.$el.hide()}if(this.options.value){this.value(this.options.value)}this.current=this.options.value;var c=this;this.$el.find("input").on("change",function(){c.value(c._getValue())})},value:function(c){var d=this.current;if(c!==undefined){this.$el.find("label").removeClass("active");this.$el.find('[value="'+c+'"]').closest("label").addClass("active");this.current=c}var e=this.current;if(e!=d&&this.options.onchange){this.options.onchange(this.current)}return this.current},_getValue:function(){var c=this.$el.find(":checked");var d=null;if(c.length>0){d=c.val()}return d},_template:function(d){var c='<div class="ui-checkbox">';for(key in d.data){var e=d.data[key];c+='<input type="checkbox" name="'+d.id+'" value="'+e.value+'" selected>'+e.label+"<br>"}c+="</div>";return c}});return{View:b}}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/ui/ui-misc.js --- a/static/scripts/packed/mvc/ui/ui-misc.js +++ b/static/scripts/packed/mvc/ui/ui-misc.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/ui/ui-select-default","mvc/ui/ui-slider","mvc/ui/ui-checkbox","mvc/ui/ui-radiobutton","mvc/ui/ui-button-menu","mvc/ui/ui-modal"],function(l,b,f,e,m,q,n){var d=Backbone.View.extend({optionsDefault:{url:"",cls:""},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options))},_template:function(r){return'<img class="ui-image '+r.cls+'" src="'+r.url+'"/>'}});var k=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options))},title:function(r){this.$el.html(r)},_template:function(r){return'<label class="ui-label '+r.cls+'">'+r.title+"</label>"},value:function(){return options.title}});var c=Backbone.View.extend({optionsDefault:{floating:"right",icon:"",tooltip:"",placement:"bottom",title:"",cls:""},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).tooltip({title:r.tooltip,placement:"bottom"})},_template:function(r){return'<div><span class="fa '+r.icon+'" class="ui-icon"/> '+r.title+"</div>"}});var h=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"btn btn-default",icon:""},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",r.onclick);$(this.el).tooltip({title:r.tooltip,placement:"bottom"})},_template:function(r){var s='<button id="'+r.id+'" type="submit" style="float: '+r.floating+';" type="button" class="ui-button '+r.cls+'">';if(r.icon){s+='<i class="icon fa '+r.icon+'"></i> '}s+=r.title+"</button>";return s}});var i=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"icon-btn",icon:"",tooltip:"",onclick:null},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",r.onclick);$(this.el).tooltip({title:r.tooltip,placement:"bottom"})},_template:function(r){var s="";if(r.title){s="width: auto;"}var t='<div id="'+r.id+'" style="float: '+r.floating+"; "+s+'" class="ui-button-icon '+r.cls+'">';if(r.title){t+='<div class="button"><i class="icon fa '+r.icon+'"/> <span class="title">'+r.title+"</span></div>"}else{t+='<i class="icon fa '+r.icon+'"/>'}t+="</div>";return t}});var g=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",r.onclick)},_template:function(r){return'<div><a href="javascript:void(0)" class="ui-anchor '+r.cls+'">'+r.title+"</a></div>"}});var o=Backbone.View.extend({optionsDefault:{message:"",status:"info",persistent:false},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement("<div></div>")},update:function(s){this.options=l.merge(s,this.optionsDefault);if(s.message!=""){this.$el.html(this._template(this.options));this.$el.find(".alert").append(s.message);this.$el.fadeIn();if(!s.persistent){var r=this;window.setTimeout(function(){if(r.$el.is(":visible")){r.$el.fadeOut()}else{r.$el.hide()}},3000)}}else{this.$el.fadeOut()}},_template:function(r){return'<div class="ui-message alert alert-'+r.status+'"/>'}});var a=Backbone.View.extend({optionsDefault:{onclick:null,searchword:""},initialize:function(s){this.options=l.merge(s,this.optionsDefault);this.setElement(this._template(this.options));var r=this;if(this.options.onclick){this.$el.on("submit",function(u){var t=r.$el.find("#search");r.options.onclick(t.val())})}},_template:function(r){return'<div class="ui-search"><form onsubmit="return false;"><input id="search" class="form-control input-sm" type="text" name="search" placeholder="Search..." value="'+r.searchword+'"><button type="submit" class="btn search-btn"><i class="fa fa-search"></i></button></form></div>'}});var j=Backbone.View.extend({optionsDefault:{value:"",type:"text",placeholder:"",disabled:false,visible:true,cls:"",area:false},initialize:function(s){this.options=l.merge(s,this.optionsDefault);this.setElement(this._template(this.options));if(this.options.disabled){this.$el.prop("disabled",true)}if(!this.options.visible){this.$el.hide()}var r=this;this.$el.on("input",function(){if(r.options.onchange){r.options.onchange(r.$el.val())}})},value:function(r){if(r!==undefined){this.$el.val(r)}return this.$el.val()},_template:function(r){if(r.area){return'<textarea id="'+r.id+'" class="ui-textarea '+r.cls+'"></textarea>'}else{return'<input id="'+r.id+'" type="'+r.type+'" value="'+r.value+'" placeholder="'+r.placeholder+'" class="ui-input '+r.cls+'">'}}});var p=Backbone.View.extend({optionsDefault:{value:""},initialize:function(r){this.options=l.merge(r,this.optionsDefault);this.setElement(this._template(this.options))},value:function(r){if(r!==undefined){this.$el.val(r)}return this.$el.val()},_template:function(r){return'<hidden id="'+r.id+'" value="'+r.value+'"/>'}});return{Anchor:g,Button:h,ButtonIcon:i,ButtonMenu:q,Icon:c,Image:d,Input:j,Label:k,Message:o,Modal:n,RadioButton:m,Checkbox:e,Searchbox:a,Select:b,Hidden:p,Slider:f}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-select-default","mvc/ui/ui-slider","mvc/ui/ui-options","mvc/ui/ui-button-menu","mvc/ui/ui-modal"],function(k,b,e,n,p,l){var d=Backbone.View.extend({optionsDefault:{url:"",cls:""},initialize:function(q){this.options=k.merge(q,this.optionsDefault);this.setElement(this._template(this.options))},_template:function(q){return'<img class="ui-image '+q.cls+'" src="'+q.url+'"/>'}});var j=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(q){this.options=k.merge(q,this.optionsDefault);this.setElement(this._template(this.options))},title:function(q){this.$el.html(q)},_template:function(q){return'<label class="ui-label '+q.cls+'">'+q.title+"</label>"},value:function(){return options.title}});var c=Backbone.View.extend({optionsDefault:{floating:"right",icon:"",tooltip:"",placement:"bottom",title:"",cls:""},initialize:function(q){this.options=k.merge(q,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).tooltip({title:q.tooltip,placement:"bottom"})},_template:function(q){return'<div><span class="fa '+q.icon+'" class="ui-icon"/> '+q.title+"</div>"}});var g=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"btn btn-default",icon:""},initialize:function(q){this.options=k.merge(q,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",q.onclick);$(this.el).tooltip({title:q.tooltip,placement:"bottom"})},_template:function(q){var r='<button id="'+q.id+'" type="submit" style="float: '+q.floating+';" type="button" class="ui-button '+q.cls+'">';if(q.icon){r+='<i class="icon fa '+q.icon+'"></i> '}r+=q.title+"</button>";return r}});var h=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"icon-btn",icon:"",tooltip:"",onclick:null},initialize:function(q){this.options=k.merge(q,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",q.onclick);$(this.el).tooltip({title:q.tooltip,placement:"bottom"})},_template:function(q){var r="";if(q.title){r="width: auto;"}var s='<div id="'+q.id+'" style="float: '+q.floating+"; "+r+'" class="ui-button-icon '+q.cls+'">';if(q.title){s+='<div class="button"><i class="icon fa '+q.icon+'"/> <span class="title">'+q.title+"</span></div>"}else{s+='<i class="icon fa '+q.icon+'"/>'}s+="</div>";return s}});var f=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(q){this.options=k.merge(q,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",q.onclick)},_template:function(q){return'<div><a href="javascript:void(0)" class="ui-anchor '+q.cls+'">'+q.title+"</a></div>"}});var m=Backbone.View.extend({optionsDefault:{message:"",status:"info",persistent:false},initialize:function(q){this.options=k.merge(q,this.optionsDefault);this.setElement("<div></div>")},update:function(r){this.options=k.merge(r,this.optionsDefault);if(r.message!=""){this.$el.html(this._template(this.options));this.$el.find(".alert").append(r.message);this.$el.fadeIn();if(!r.persistent){var q=this;window.setTimeout(function(){if(q.$el.is(":visible")){q.$el.fadeOut()}else{q.$el.hide()}},3000)}}else{this.$el.fadeOut()}},_template:function(q){return'<div class="ui-message alert alert-'+q.status+'"/>'}});var a=Backbone.View.extend({optionsDefault:{onclick:null,searchword:""},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement(this._template(this.options));var q=this;if(this.options.onclick){this.$el.on("submit",function(t){var s=q.$el.find("#search");q.options.onclick(s.val())})}},_template:function(q){return'<div class="ui-search"><form onsubmit="return false;"><input id="search" class="form-control input-sm" type="text" name="search" placeholder="Search..." value="'+q.searchword+'"><button type="submit" class="btn search-btn"><i class="fa fa-search"></i></button></form></div>'}});var i=Backbone.View.extend({optionsDefault:{value:"",type:"text",placeholder:"",disabled:false,visible:true,cls:"",area:false},initialize:function(r){this.options=k.merge(r,this.optionsDefault);this.setElement(this._template(this.options));if(this.options.disabled){this.$el.prop("disabled",true)}if(!this.options.visible){this.$el.hide()}var q=this;this.$el.on("input",function(){if(q.options.onchange){q.options.onchange(q.$el.val())}})},value:function(q){if(q!==undefined){this.$el.val(q)}return this.$el.val()},_template:function(q){if(q.area){return'<textarea id="'+q.id+'" class="ui-textarea '+q.cls+'"></textarea>'}else{return'<input id="'+q.id+'" type="'+q.type+'" value="'+q.value+'" placeholder="'+q.placeholder+'" class="ui-input '+q.cls+'">'}}});var o=Backbone.View.extend({optionsDefault:{value:""},initialize:function(q){this.options=k.merge(q,this.optionsDefault);this.setElement(this._template(this.options))},value:function(q){if(q!==undefined){this.$el.val(q)}return this.$el.val()},_template:function(q){return'<hidden id="'+q.id+'" value="'+q.value+'"/>'}});return{Anchor:f,Button:g,ButtonIcon:h,ButtonMenu:p,Icon:c,Image:d,Input:i,Label:j,Message:m,Modal:l,RadioButton:n.RadioButton,Checkbox:n.Checkbox,Searchbox:a,Select:b,Hidden:o,Slider:e}}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/ui/ui-radiobutton.js --- a/static/scripts/packed/mvc/ui/ui-radiobutton.js +++ /dev/null @@ -1,1 +0,0 @@ -define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{value:"",visible:true,cls:"",data:[],id:a.uuid()},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));if(!this.options.visible){this.$el.hide()}if(this.options.value){this.value(this.options.value)}this.current=this.options.value;var c=this;this.$el.find("input").on("change",function(){c.value(c._getValue())})},value:function(c){var d=this.current;if(c!==undefined){this.$el.find("label").removeClass("active");this.$el.find('[value="'+c+'"]').closest("label").addClass("active");this.current=c}var e=this.current;if(e!=d&&this.options.onchange){this.options.onchange(this.current)}return this.current},_getValue:function(){var c=this.$el.find(":checked");var d=null;if(c.length>0){d=c.val()}return d},_template:function(d){var c='<div class="btn-group ui-radiobutton" data-toggle="buttons">';for(key in d.data){var e=d.data[key];c+='<label class="btn btn-default"><input type="radio" name="'+d.id+'" value="'+e.value+'" selected>'+e.label+"</label>"}c+="</div>";return c}});return{View:b}}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/ui/ui-select-default.js --- a/static/scripts/packed/mvc/ui/ui-select-default.js +++ b/static/scripts/packed/mvc/ui/ui-select-default.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{id:"",cls:"",empty:"No data available",visible:true,wait:false,multiple:false},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.$select=this.$el.find("#select");this.$icon=this.$el.find("#icon");if(this.options.multiple){this.$select.prop("multiple",true);this.$select.addClass("ui-select-multiple");this.$icon.remove()}else{this.$el.addClass("ui-select")}this.update(this.options.data);if(!this.options.visible){this.hide()}if(this.options.wait){this.wait()}else{this.show()}var c=this;this.$select.on("change",function(){c._change()});this.on("change",function(){c._change()})},value:function(c){if(c!==undefined){this.$select.val(c)}return this.$select.val()},first:function(){var c=this.$select.find("option");if(c.length>0){return c.val()}else{return undefined}},text:function(){return this.$select.find("option:selected").text()},show:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-caret-down");this.$select.show();this.$el.show()},hide:function(){this.$el.hide()},wait:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-spinner fa-spin");this.$select.hide()},disabled:function(){return this.$select.is(":disabled")},enable:function(){this.$select.prop("disabled",false)},disable:function(){this.$select.prop("disabled",true)},add:function(c){this.$select.append(this._templateOption(c));this._refresh()},del:function(c){this.$select.find("option[value="+c+"]").remove();this.$select.trigger("change");this._refresh()},update:function(c){var e=this.$select.val();this.$select.find("option").remove();for(var d in c){this.$select.append(this._templateOption(c[d]))}this._refresh();this.$select.val(e);if(!this.$select.val()){this.$select.val(this.first())}},setOnChange:function(c){this.options.onchange=c},exists:function(c){return this.$select.find("option[value="+c+"]").length>0},_change:function(){if(this.options.onchange){this.options.onchange(this.$select.val())}},_refresh:function(){this.$select.find("option[value=null]").remove();var c=this.$select.find("option").length;if(c==0){this.disable();this.$select.append(this._templateOption({value:"null",label:this.options.empty}))}else{this.enable()}},_templateOption:function(c){return'<option value="'+c.value+'">'+c.label+"</option>"},_template:function(c){return'<div id="'+c.id+'"><div class="button"><i id="icon"/></div><select id="select" class="select '+c.cls+" "+c.id+'"></select></div>'}});return{View:b}}); \ No newline at end of file +define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{id:"",cls:"",empty:"No data available",visible:true,wait:false,multiple:false},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.$select=this.$el.find("#select");this.$icon=this.$el.find("#icon");if(this.options.multiple){this.$select.prop("multiple",true);this.$select.addClass("ui-select-multiple");this.$icon.remove()}else{this.$el.addClass("ui-select")}this.update(this.options.data);if(!this.options.visible){this.hide()}if(this.options.wait){this.wait()}else{this.show()}var c=this;this.$select.on("change",function(){c._change()});this.on("change",function(){c._change()})},value:function(c){if(c!==undefined){this.$select.val(c)}return this.$select.val()},first:function(){var c=this.$select.find("option");if(c.length>0){return c.val()}else{return undefined}},text:function(){return this.$select.find("option:selected").text()},show:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-caret-down");this.$select.show();this.$el.show()},hide:function(){this.$el.hide()},wait:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-spinner fa-spin");this.$select.hide()},disabled:function(){return this.$select.is(":disabled")},enable:function(){this.$select.prop("disabled",false)},disable:function(){this.$select.prop("disabled",true)},add:function(c){this.$select.append(this._templateOption(c));this._refresh()},del:function(c){this.$select.find("option[value="+c+"]").remove();this.$select.trigger("change");this._refresh()},update:function(c){var e=this.$select.val();this.$select.find("option").remove();for(var d in c){this.$select.append(this._templateOption(c[d]))}this._refresh();this.$select.val(e);if(!this.$select.val()){this.$select.val(this.first())}},setOnChange:function(c){this.options.onchange=c},exists:function(c){return this.$select.find('option[value="'+c+'"]').length>0},_change:function(){if(this.options.onchange){this.options.onchange(this.$select.val())}},_refresh:function(){this.$select.find("option[value=null]").remove();var c=this.$select.find("option").length;if(c==0){this.disable();this.$select.append(this._templateOption({value:"null",label:this.options.empty}))}else{this.enable()}},_templateOption:function(c){return'<option value="'+c.value+'">'+c.label+"</option>"},_template:function(c){return'<div id="'+c.id+'"><div class="button"><i id="icon"/></div><select id="select" class="select '+c.cls+" "+c.id+'"></select></div>'}});return{View:b}}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/upload/upload-ftp.js --- a/static/scripts/packed/mvc/upload/upload-ftp.js +++ b/static/scripts/packed/mvc/upload/upload-ftp.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());a.get(galaxy_config.root+"api/ftp_files",function(d){b._fill(d)})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(c){if(c.length>0){this.$el.find("#upload-ftp-content").html($(this._template_table()));var b=0;for(key in c){this.add(c[key]);b+=c[key].size}this.$el.find("#upload-ftp-number").html(c.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(b,true))}else{this.$el.find("#upload-ftp-content").html($(this._template_info()))}this.$el.find("#upload-ftp-wait").hide()},add:function(e){var d=$(this._template_row(e));$(this.el).find("tbody").append(d);var c="";if(this._find(e)){c=this.options.class_remove}else{c=this.options.class_add}d.find("#upload-ftp-add").addClass(c);var b=this;d.find("#upload-ftp-add").on("click",function(){var f=b._find(e);$(this).removeClass();if(!f){b.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]);$(this).addClass(b.options.class_remove)}else{b.app.collection.remove(f);$(this).addClass(b.options.class_add)}})},_find:function(f){var c=this.app.collection.where({file_path:f.path});var b=null;for(var d in c){var e=c[d];if(e.get("status")=="init"&&e.get("file_mode")=="ftp"){b=e.get("id")}}return b},_template_row:function(b){return'<tr><td><div id="upload-ftp-add"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+b.path+'</p></td><td style="white-space: nowrap;">'+a.bytesToString(b.size)+'</td><td style="white-space: nowrap;">'+b.ctime+"</td></tr>"},_template_table:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_template_info:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})}); \ No newline at end of file +define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());a.get(galaxy_config.root+"api/ftp_files",function(d){b._fill(d)})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(c){if(c.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var b=0;for(key in c){this.add(c[key]);b+=c[key].size}this.$el.find("#upload-ftp-number").html(c.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(b,true))}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},add:function(e){var d=$(this._templateRow(e));$(this.el).find("tbody").append(d);var c="";if(this._find(e)){c=this.options.class_remove}else{c=this.options.class_add}d.find("#upload-ftp-add").addClass(c);var b=this;d.find("#upload-ftp-add").on("click",function(){var f=b._find(e);$(this).removeClass();if(!f){b.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]);$(this).addClass(b.options.class_remove)}else{b.app.collection.remove(f);$(this).addClass(b.options.class_add)}})},_find:function(f){var c=this.app.collection.where({file_path:f.path});var b=null;for(var d in c){var e=c[d];if(e.get("status")=="init"&&e.get("file_mode")=="ftp"){b=e.get("id")}}return b},_templateRow:function(b){return'<tr><td><div id="upload-ftp-add"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+b.path+'</p></td><td style="white-space: nowrap;">'+a.bytesToString(b.size)+'</td><td style="white-space: nowrap;">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/scripts/packed/mvc/upload/upload-settings.js --- a/static/scripts/packed/mvc/upload/upload-settings.js +++ b/static/scripts/packed/mvc/upload/upload-settings.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_check:"upload-icon-button fa fa-check-square-o",class_uncheck:"upload-icon-button fa fa-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());this.model=this.app.model;this.$el.find("#upload-space-to-tabs").on("click",function(){b._switch_state("#upload-space-to-tabs","space_to_tabs")});this.$el.find("#upload-to-posix-lines").on("click",function(){b._switch_state("#upload-to-posix-lines","to_posix_lines")});this.render()},events:{mousedown:function(b){b.preventDefault()}},render:function(){this._render_state("#upload-space-to-tabs",this.model.get("space_to_tabs"));this._render_state("#upload-to-posix-lines",this.model.get("to_posix_lines"));var b=this.$el.find("#upload-settings-cover");if(this.model.get("status")!="init"){b.show()}else{b.hide()}},_switch_state:function(c,b){if(this.model.get("status")=="init"){var d=!this.model.get(b);this.model.set(b,d);this._render_state(c,d)}},_render_state:function(b,d){var c=this.$el.find(b);c.removeClass();if(d){c.addClass(this.options.class_check)}else{c.addClass(this.options.class_uncheck)}},_template:function(){return'<div class="upload-settings" style="position: relative;"><div id="upload-settings-cover" class="upload-settings-cover"/><table class="table table-striped"><tbody><tr><td><div id="upload-space-to-tabs"/></td><td>Convert spaces to tabs</td></tr><tr><td><div id="upload-to-posix-lines"/></td><td>Use POSIX standard</td></tr></tbody></table></div>'}})}); \ No newline at end of file +define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_check:"upload-icon-button fa fa-check-square-o",class_uncheck:"upload-icon-button fa fa-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());this.model=this.app.model;this.$el.find("#upload-space-to-tabs").on("click",function(){b._switchState("#upload-space-to-tabs","space_to_tabs")});this.$el.find("#upload-to-posix-lines").on("click",function(){b._switchState("#upload-to-posix-lines","to_posix_lines")});this.render()},events:{mousedown:function(b){b.preventDefault()}},render:function(){this._renderState("#upload-space-to-tabs",this.model.get("space_to_tabs"));this._renderState("#upload-to-posix-lines",this.model.get("to_posix_lines"));var b=this.$el.find("#upload-settings-cover");if(this.model.get("status")!="init"){b.show()}else{b.hide()}},_switchState:function(c,b){if(this.model.get("status")=="init"){var d=!this.model.get(b);this.model.set(b,d);this._renderState(c,d)}},_renderState:function(b,d){var c=this.$el.find(b);c.removeClass();if(d){c.addClass(this.options.class_check)}else{c.addClass(this.options.class_uncheck)}},_template:function(){return'<div class="upload-settings" style="position: relative;"><div id="upload-settings-cover" class="upload-settings-cover"/><table class="table table-striped"><tbody><tr><td><div id="upload-space-to-tabs"/></td><td>Convert spaces to tabs</td></tr><tr><td><div id="upload-to-posix-lines"/></td><td>Use POSIX standard</td></tr></tbody></table></div>'}})}); \ No newline at end of file diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/style/blue/base.css --- a/static/style/blue/base.css +++ b/static/style/blue/base.css @@ -1278,7 +1278,7 @@ .upload-ftp .upload-ftp-help{margin-bottom:10px} .upload-ftp .upload-ftp-warning{text-align:center;margin-top:20px} .upload-settings .upload-settings-cover{position:absolute;width:100%;height:100%;top:0px;left:0px;background:#fff;opacity:0.4;cursor:no-drop} -.ui-table-row-error{-moz-border-radius:3px;border-radius:3px;background:#f9c7c5;padding:5px} +.ui-error{-moz-border-radius:3px;border-radius:3px;background:#f9c7c5;padding:5px} .ui-table-form-error{display:none}.ui-table-form-error .ui-table-form-error-text{padding-left:5px} .ui-form-slider .ui-form-slider-text{width:100px;float:left} .ui-form-slider .ui-form-slider-element{width:calc(100% - 110px);float:left;top:8px;left:10px} diff -r cb6dffff27973cff0afd22d9907e675fea948113 -r 673228acc8abfeb724c3e5306ff5b2da24d70858 static/style/src/less/ui.less --- a/static/style/src/less/ui.less +++ b/static/style/src/less/ui.less @@ -1,4 +1,4 @@ -.ui-table-row-error { +.ui-error { -moz-border-radius: @border-radius-base; border-radius: @border-radius-base; background: @state-danger-bg; Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org