commit/galaxy-central: guerler: ToolForm: Load history summary and metadata separately, add file extension to history api, fix spinner style for select field
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/6aad6ad39a04/ Changeset: 6aad6ad39a04 User: guerler Date: 2014-10-01 17:36:46+00:00 Summary: ToolForm: Load history summary and metadata separately, add file extension to history api, fix spinner style for select field Affected #: 17 files diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e client/galaxy/scripts/mvc/tools/tools-datasets.js --- a/client/galaxy/scripts/mvc/tools/tools-datasets.js +++ b/client/galaxy/scripts/mvc/tools/tools-datasets.js @@ -1,15 +1,10 @@ -define([ 'mvc/history/history-contents', 'utils/utils' ], function( HistoryContents, Utils ){ +define(['utils/utils'], function(Utils){ return Backbone.Model.extend({ // initialize initialize: function(options) { - // create history contents container - this.currHistoryContents = new HistoryContents.HistoryContents({}); - - // identify current history id - this.currHistoryContents.historyId = options.history_id; - - // prepare datatype structure - this.typedict = {}; + // prepare datasets obects + this.datatypes = {}; + this.summary = {}; // link this var self = this; @@ -18,70 +13,99 @@ Utils.get({ url : galaxy_config.root + 'api/datatypes/mapping', cache : true, - success : function(typedict) { + success : function(response) { // backup datatype dictionary - self.typedict = typedict; + self.datatypes = response; - // make request - var xhr = self.currHistoryContents.fetchAllDetails() - .done( function(){ - // log request success + // get history summary + Utils.get({ + url : galaxy_config.root + 'api/histories/' + options.history_id + '/contents?deleted=false', + success : function(response) { + // backup summary + self.summary = response; + + // log console.debug('tools-datasets::initialize() - Completed.'); // callback options.success && options.success(); - }) - .fail( function(){ + }, + error : function(response) { // log request failure - console.debug('tools-datasets::initialize() - Ajax request for history datasets failed.'); - }); + console.debug('tools-datasets::initialize() - Ajax request for summary failed.'); + console.debug(response); + } + }); }, error : function(response) { // log request failure - console.debug('tools-datasets::initialize() - Ajax request for datatype dictionary failed.'); + console.debug('tools-datasets::initialize() - Ajax request for datatypes failed.'); + console.debug(response); } }); }, - /** Filters datasets by data type. + /** + * Filters datasets by data type. */ filterType: function(options) { options = options || {}; - var self = this; - return this.currHistoryContents.filter(function(content){ + var result = []; + for (var i in this.summary) { + var dataset = this.summary[i]; + // match datatypes var found = false; for (var i in options.data_types) { - if (self._matchType(content.get('data_type'), options.data_types[i])) { + if (this._matchType(options.data_types[i], dataset.extension)) { found = true; break; } } // final match result - return (content.get('history_content_type') === options.content_type || !options.content_type) && - (found || !options.data_types) && !content.get('deleted'); - }); + if ((dataset.history_content_type === options.content_type || !options.content_type) && (found || !options.data_types)) { + result.push(dataset); + } + } + return result; }, - /** Filter datasets by id. + /** Get details of a dataset by id. + * @param{String} Dataset id */ - filter: function(filter_id) { - return _.first( this.currHistoryContents.filter( function( content ){ return content.get( 'id' ) === filter_id; }) ); + getDetails: function(dataset_id, callback) { + Utils.get({ + url : galaxy_config.root + 'api/datasets/' + dataset_id, + success : function(response) { + callback && callback(response); + }, + error : function(response) { + console.debug('tools-datasets::getDetails() - Ajax request for dataset failed.'); + console.debug(response); + } + }); }, /** Check if datatypes match */ - _matchType: function(reference, target) { + _matchType: function(target, reference) { // check if target class is available - var target_class = this.typedict.ext_to_class_name[target]; + var target_class = this.datatypes.ext_to_class_name[target]; if (!target_class) { console.debug('tools-datasets::_matchType() - Specific target class unavailable. Accepting all formats.'); return true; } + // check if reference class is available + var reference_class = this.datatypes.ext_to_class_name[reference]; + if (!reference_class) { + console.debug('tools-datasets::_matchType() - Specific reference class unavailable. Accepting all formats.'); + return true; + } + // check reference group - var reference_group = this.typedict.class_to_classes[reference]; + var reference_group = this.datatypes.class_to_classes[reference_class]; if (reference_group[target_class]) { return true; } diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e client/galaxy/scripts/mvc/tools/tools-section.js --- a/client/galaxy/scripts/mvc/tools/tools-section.js +++ b/client/galaxy/scripts/mvc/tools/tools-section.js @@ -414,7 +414,7 @@ extensions : input_def.extensions, multiple : input_def.multiple, onchange : function(dict) { - // pick the first dataset if multiple might be selected + // pick the first dataset only (todo: maybe collect multiple meta information) var value = dict.values[0].id; // get referenced columns @@ -426,72 +426,79 @@ return; } - // find selected dataset - var dataset = self.app.datasets.filter(value); - - // meta data - var meta = null; - - // check dataset - if (dataset) { - // log selection - console.debug('tool-form::field_data() - Selected dataset ' + value + '.'); - - // get meta data - meta = dataset.get('metadata_column_types'); - - // check meta data - if (!meta) { - console.debug('tool-form::field_data() - FAILED: Could not find metadata for dataset ' + value + '.'); - } - } else { - console.debug('tool-form::field_data() - FAILED: Could not find dataset ' + value + '.'); + // set wait mode + for (var i in column_list) { + var column_field = self.app.field_list[column_list[i]]; + column_field.wait && column_field.wait(); } - // update referenced columns - for (var i in column_list) { - // get column input/field - var column_input = self.app.input_list[column_list[i]]; - var column_field = self.app.field_list[column_list[i]]; - if (!column_input || !column_field) { - console.debug('tool-form::field_data() - FAILED: Column not found.'); + // find selected dataset + self.app.datasets.getDetails(value, function(dataset) { + // meta data + var meta = null; + + // check dataset + if (dataset) { + // log selection + console.debug('tool-form::field_data() - Selected dataset ' + value + '.'); + + // get meta data + meta = dataset.metadata_column_types; + + // check meta data + if (!meta) { + console.debug('tool-form::field_data() - FAILED: Could not find metadata for dataset ' + value + '.'); + } + } else { + console.debug('tool-form::field_data() - FAILED: Could not find dataset ' + value + '.'); } - - // is numerical? - var numerical = column_input.numerical; - // identify column options - var columns = []; - for (var key in meta) { - // get column type - var column_type = meta[key]; + // update referenced columns + for (var i in column_list) { + // get column input/field + var column_input = self.app.input_list[column_list[i]]; + var column_field = self.app.field_list[column_list[i]]; + if (!column_input || !column_field) { + console.debug('tool-form::field_data() - FAILED: Column not found.'); + } + + // is numerical? + var numerical = column_input.numerical; - // column index - var column_index = (parseInt(key) + 1); - - // column type label - var column_label = 'Text'; - if (column_type == 'int' || column_type == 'float') { - column_label = 'Number'; + // identify column options + var columns = []; + for (var key in meta) { + // get column type + var column_type = meta[key]; + + // column index + var column_index = (parseInt(key) + 1); + + // column type label + var column_label = 'Text'; + if (column_type == 'int' || column_type == 'float') { + column_label = 'Number'; + } + + // add to selection + if (column_type == 'int' || column_type == 'float' || !numerical) { + columns.push({ + 'label' : 'Column: ' + column_index + ' [' + column_label + ']', + 'value' : column_index + }); + } } - // add to selection - if (column_type == 'int' || column_type == 'float' || !numerical) { - columns.push({ - 'label' : 'Column: ' + column_index + ' [' + column_label + ']', - 'value' : column_index - }); + // update field + if (column_field) { + column_field.update(columns); + if (!column_field.exists(column_field.value())) { + column_field.value(column_field.first()); + } + column_field.show(); } } - - // update field - if (column_field) { - column_field.update(columns); - if (!column_field.exists(column_field.value())) { - column_field.value(column_field.first()); - } - } - } + }); } }); }, diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e client/galaxy/scripts/mvc/tools/tools-select-dataset.js --- a/client/galaxy/scripts/mvc/tools/tools-select-dataset.js +++ b/client/galaxy/scripts/mvc/tools/tools-select-dataset.js @@ -40,8 +40,8 @@ var dataset_options = []; for (var i in datasets) { dataset_options.push({ - label: datasets[i].get('name'), - value: datasets[i].get('id') + label: datasets[i].name, + value: datasets[i].id }); } @@ -67,8 +67,8 @@ var collection_options = []; for (var i in collections) { collection_options.push({ - label: collections[i].get('name'), - value: collections[i].get('id') + label: collections[i].name, + value: collections[i].id }); } diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e client/galaxy/scripts/mvc/ui/ui-select-default.js --- a/client/galaxy/scripts/mvc/ui/ui-select-default.js +++ b/client/galaxy/scripts/mvc/ui/ui-select-default.js @@ -124,7 +124,6 @@ wait: function() { this.$icon.removeClass(); this.$icon.addClass('fa fa-spinner fa-spin'); - this.$select.hide(); }, /** Returns true if the field is disabled diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e client/galaxy/scripts/utils/utils.js --- a/client/galaxy/scripts/utils/utils.js +++ b/client/galaxy/scripts/utils/utils.js @@ -6,12 +6,13 @@ // dependencies define(["libs/underscore"], function(_) { -/* request handler for GET - param{string} url - param{function} success - param{function} error - param{boolean} cache -*/ +/** + * Request handler for GET + * @param{String} url - Url request is made to + * @param{Function} success - Callback on success + * @param{Function} error - Callback on error + * @param{Boolean} cache - Use cached data if available + */ function get (options) { top.__utils__get__ = top.__utils__get__ || {}; if (options.cache && top.__utils__get__[options.url]) { @@ -32,13 +33,14 @@ } }; -/* request handler - param{string} method - param{string} url - param{object} data - param{function} success - param{function} error -*/ +/** + * Request handler + * @param{String} method - Request method ['GET', 'POST', 'DELETE', 'PUT'] + * @param{String} url - Url request is made to + * @param{Object} data - Data send to url + * @param{Function} success - Callback on success + * @param{Function} error - Callback on error + */ function request (options) { // prepare ajax var ajaxConfig = { @@ -79,7 +81,11 @@ }); }; -// get css value +/** + * Read a property value from CSS + * @param{String} classname - CSS class + * @param{String} name - CSS property + */ function cssGetAttribute (classname, name) { // place dummy element var el = $('<div class="' + classname + '"></div>'); @@ -97,14 +103,21 @@ return value; }; -// load css +/** + * Load a CSS file + * @param{String} url - Url of CSS file + */ function cssLoadFile (url) { // check if css is already available if (!$('link[href^="' + url + '"]').length) $('<link href="' + galaxy_config.root + url + '" rel="stylesheet">').appendTo('head'); }; -// merge +/** + * Safely merge to dictionaries + * @param{Object} options - Target dictionary + * @param{Object} optionsDefault - Source dictionary + */ function merge (options, optionsDefault) { if (options) return _.defaults(options, optionsDefault); @@ -112,7 +125,11 @@ return optionsDefault; }; -// to string +/** + * Format byte size to string with units + * @param{Integer} size - Size in bytes + * @param{Boolean} normal_font - Switches font between normal and bold + */ function bytesToString (size, normal_font) { // identify unit var unit = ""; @@ -132,19 +149,26 @@ } }; -// unique ide +/** + * Create a unique id + */ function uuid(){ return 'x' + Math.random().toString(36).substring(2, 9); }; -// wrap +/** + * Wrap an dom element into a paragraph + * @param{Element} $el - DOM element to be wrapped + */ function wrap($el) { var wrapper = $('<p></p>'); wrapper.append($el); return wrapper; }; -// time +/** + * Create a time stamp + */ function time() { // get date object var d = new Date(); @@ -162,7 +186,6 @@ return datetime; }; -// return return { cssLoadFile : cssLoadFile, cssGetAttribute : cssGetAttribute, diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e lib/galaxy/webapps/galaxy/api/history_contents.py --- a/lib/galaxy/webapps/galaxy/api/history_contents.py +++ b/lib/galaxy/webapps/galaxy/api/history_contents.py @@ -139,6 +139,7 @@ 'type' : api_type, 'state' : hda.dataset.state, 'deleted': hda.deleted, + 'extension': hda.extension, 'visible': hda.visible, 'purged': hda.purged, 'resubmitted': hda._state == trans.app.model.Dataset.states.RESUBMITTED, diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e static/scripts/mvc/tools/tools-datasets.js --- a/static/scripts/mvc/tools/tools-datasets.js +++ b/static/scripts/mvc/tools/tools-datasets.js @@ -1,15 +1,10 @@ -define([ 'mvc/history/history-contents', 'utils/utils' ], function( HistoryContents, Utils ){ +define(['utils/utils'], function(Utils){ return Backbone.Model.extend({ // initialize initialize: function(options) { - // create history contents container - this.currHistoryContents = new HistoryContents.HistoryContents({}); - - // identify current history id - this.currHistoryContents.historyId = options.history_id; - - // prepare datatype structure - this.typedict = {}; + // prepare datasets obects + this.datatypes = {}; + this.summary = {}; // link this var self = this; @@ -18,70 +13,99 @@ Utils.get({ url : galaxy_config.root + 'api/datatypes/mapping', cache : true, - success : function(typedict) { + success : function(response) { // backup datatype dictionary - self.typedict = typedict; + self.datatypes = response; - // make request - var xhr = self.currHistoryContents.fetchAllDetails() - .done( function(){ - // log request success + // get history summary + Utils.get({ + url : galaxy_config.root + 'api/histories/' + options.history_id + '/contents?deleted=false', + success : function(response) { + // backup summary + self.summary = response; + + // log console.debug('tools-datasets::initialize() - Completed.'); // callback options.success && options.success(); - }) - .fail( function(){ + }, + error : function(response) { // log request failure - console.debug('tools-datasets::initialize() - Ajax request for history datasets failed.'); - }); + console.debug('tools-datasets::initialize() - Ajax request for summary failed.'); + console.debug(response); + } + }); }, error : function(response) { // log request failure - console.debug('tools-datasets::initialize() - Ajax request for datatype dictionary failed.'); + console.debug('tools-datasets::initialize() - Ajax request for datatypes failed.'); + console.debug(response); } }); }, - /** Filters datasets by data type. + /** + * Filters datasets by data type. */ filterType: function(options) { options = options || {}; - var self = this; - return this.currHistoryContents.filter(function(content){ + var result = []; + for (var i in this.summary) { + var dataset = this.summary[i]; + // match datatypes var found = false; for (var i in options.data_types) { - if (self._matchType(content.get('data_type'), options.data_types[i])) { + if (this._matchType(options.data_types[i], dataset.extension)) { found = true; break; } } // final match result - return (content.get('history_content_type') === options.content_type || !options.content_type) && - (found || !options.data_types) && !content.get('deleted'); - }); + if ((dataset.history_content_type === options.content_type || !options.content_type) && (found || !options.data_types)) { + result.push(dataset); + } + } + return result; }, - /** Filter datasets by id. + /** Get details of a dataset by id. + * @param{String} Dataset id */ - filter: function(filter_id) { - return _.first( this.currHistoryContents.filter( function( content ){ return content.get( 'id' ) === filter_id; }) ); + getDetails: function(dataset_id, callback) { + Utils.get({ + url : galaxy_config.root + 'api/datasets/' + dataset_id, + success : function(response) { + callback && callback(response); + }, + error : function(response) { + console.debug('tools-datasets::getDetails() - Ajax request for dataset failed.'); + console.debug(response); + } + }); }, /** Check if datatypes match */ - _matchType: function(reference, target) { + _matchType: function(target, reference) { // check if target class is available - var target_class = this.typedict.ext_to_class_name[target]; + var target_class = this.datatypes.ext_to_class_name[target]; if (!target_class) { console.debug('tools-datasets::_matchType() - Specific target class unavailable. Accepting all formats.'); return true; } + // check if reference class is available + var reference_class = this.datatypes.ext_to_class_name[reference]; + if (!reference_class) { + console.debug('tools-datasets::_matchType() - Specific reference class unavailable. Accepting all formats.'); + return true; + } + // check reference group - var reference_group = this.typedict.class_to_classes[reference]; + var reference_group = this.datatypes.class_to_classes[reference_class]; if (reference_group[target_class]) { return true; } diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e static/scripts/mvc/tools/tools-section.js --- a/static/scripts/mvc/tools/tools-section.js +++ b/static/scripts/mvc/tools/tools-section.js @@ -414,7 +414,7 @@ extensions : input_def.extensions, multiple : input_def.multiple, onchange : function(dict) { - // pick the first dataset if multiple might be selected + // pick the first dataset only (todo: maybe collect multiple meta information) var value = dict.values[0].id; // get referenced columns @@ -426,72 +426,79 @@ return; } - // find selected dataset - var dataset = self.app.datasets.filter(value); - - // meta data - var meta = null; - - // check dataset - if (dataset) { - // log selection - console.debug('tool-form::field_data() - Selected dataset ' + value + '.'); - - // get meta data - meta = dataset.get('metadata_column_types'); - - // check meta data - if (!meta) { - console.debug('tool-form::field_data() - FAILED: Could not find metadata for dataset ' + value + '.'); - } - } else { - console.debug('tool-form::field_data() - FAILED: Could not find dataset ' + value + '.'); + // set wait mode + for (var i in column_list) { + var column_field = self.app.field_list[column_list[i]]; + column_field.wait && column_field.wait(); } - // update referenced columns - for (var i in column_list) { - // get column input/field - var column_input = self.app.input_list[column_list[i]]; - var column_field = self.app.field_list[column_list[i]]; - if (!column_input || !column_field) { - console.debug('tool-form::field_data() - FAILED: Column not found.'); + // find selected dataset + self.app.datasets.getDetails(value, function(dataset) { + // meta data + var meta = null; + + // check dataset + if (dataset) { + // log selection + console.debug('tool-form::field_data() - Selected dataset ' + value + '.'); + + // get meta data + meta = dataset.metadata_column_types; + + // check meta data + if (!meta) { + console.debug('tool-form::field_data() - FAILED: Could not find metadata for dataset ' + value + '.'); + } + } else { + console.debug('tool-form::field_data() - FAILED: Could not find dataset ' + value + '.'); } - - // is numerical? - var numerical = column_input.numerical; - // identify column options - var columns = []; - for (var key in meta) { - // get column type - var column_type = meta[key]; + // update referenced columns + for (var i in column_list) { + // get column input/field + var column_input = self.app.input_list[column_list[i]]; + var column_field = self.app.field_list[column_list[i]]; + if (!column_input || !column_field) { + console.debug('tool-form::field_data() - FAILED: Column not found.'); + } + + // is numerical? + var numerical = column_input.numerical; - // column index - var column_index = (parseInt(key) + 1); - - // column type label - var column_label = 'Text'; - if (column_type == 'int' || column_type == 'float') { - column_label = 'Number'; + // identify column options + var columns = []; + for (var key in meta) { + // get column type + var column_type = meta[key]; + + // column index + var column_index = (parseInt(key) + 1); + + // column type label + var column_label = 'Text'; + if (column_type == 'int' || column_type == 'float') { + column_label = 'Number'; + } + + // add to selection + if (column_type == 'int' || column_type == 'float' || !numerical) { + columns.push({ + 'label' : 'Column: ' + column_index + ' [' + column_label + ']', + 'value' : column_index + }); + } } - // add to selection - if (column_type == 'int' || column_type == 'float' || !numerical) { - columns.push({ - 'label' : 'Column: ' + column_index + ' [' + column_label + ']', - 'value' : column_index - }); + // update field + if (column_field) { + column_field.update(columns); + if (!column_field.exists(column_field.value())) { + column_field.value(column_field.first()); + } + column_field.show(); } } - - // update field - if (column_field) { - column_field.update(columns); - if (!column_field.exists(column_field.value())) { - column_field.value(column_field.first()); - } - } - } + }); } }); }, diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e 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 @@ -40,8 +40,8 @@ var dataset_options = []; for (var i in datasets) { dataset_options.push({ - label: datasets[i].get('name'), - value: datasets[i].get('id') + label: datasets[i].name, + value: datasets[i].id }); } @@ -67,8 +67,8 @@ var collection_options = []; for (var i in collections) { collection_options.push({ - label: collections[i].get('name'), - value: collections[i].get('id') + label: collections[i].name, + value: collections[i].id }); } diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e 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 @@ -124,7 +124,6 @@ wait: function() { this.$icon.removeClass(); this.$icon.addClass('fa fa-spinner fa-spin'); - this.$select.hide(); }, /** Returns true if the field is disabled diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e 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","utils/utils"],function(b,a){return Backbone.Model.extend({initialize:function(d){this.currHistoryContents=new b.HistoryContents({});this.currHistoryContents.historyId=d.history_id;this.typedict={};var c=this;a.get({url:galaxy_config.root+"api/datatypes/mapping",cache:true,success:function(e){c.typedict=e;var f=c.currHistoryContents.fetchAllDetails().done(function(){console.debug("tools-datasets::initialize() - Completed.");d.success&&d.success()}).fail(function(){console.debug("tools-datasets::initialize() - Ajax request for history datasets failed.")})},error:function(e){console.debug("tools-datasets::initialize() - Ajax request for datatype dictionary failed.")}})},filterType:function(d){d=d||{};var c=this;return this.currHistoryContents.filter(function(f){var g=false;for(var e in d.data_types){if(c._matchType(f.get("data_type"),d.data_types[e])){g=true;break}}return(f.get("history_content_type")===d.content_type||!d.content_type)&&(g||!d.data_types)&&!f.get("deleted")})},filter:function(c){return _.first(this.currHistoryContents.filter(function(d){return d.get("id")===c}))},_matchType:function(c,f){var d=this.typedict.ext_to_class_name[f];if(!d){console.debug("tools-datasets::_matchType() - Specific target class unavailable. Accepting all formats.");return true}var e=this.typedict.class_to_classes[c];if(e[d]){return true}return false}})}); \ No newline at end of file +define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(c){this.datatypes={};this.summary={};var b=this;a.get({url:galaxy_config.root+"api/datatypes/mapping",cache:true,success:function(d){b.datatypes=d;a.get({url:galaxy_config.root+"api/histories/"+c.history_id+"/contents?deleted=false",success:function(e){b.summary=e;console.debug("tools-datasets::initialize() - Completed.");c.success&&c.success()},error:function(e){console.debug("tools-datasets::initialize() - Ajax request for summary failed.");console.debug(e)}})},error:function(d){console.debug("tools-datasets::initialize() - Ajax request for datatypes failed.");console.debug(d)}})},filterType:function(c){c=c||{};var b=[];for(var d in this.summary){var f=this.summary[d];var e=false;for(var d in c.data_types){if(this._matchType(c.data_types[d],f.extension)){e=true;break}}if((f.history_content_type===c.content_type||!c.content_type)&&(e||!c.data_types)){b.push(f)}}return b},getDetails:function(b,c){a.get({url:galaxy_config.root+"api/datasets/"+b,success:function(d){c&&c(d)},error:function(d){console.debug("tools-datasets::getDetails() - Ajax request for dataset failed.");console.debug(d)}})},_matchType:function(f,b){var c=this.datatypes.ext_to_class_name[f];if(!c){console.debug("tools-datasets::_matchType() - Specific target class unavailable. Accepting all formats.");return true}var d=this.datatypes.ext_to_class_name[b];if(!d){console.debug("tools-datasets::_matchType() - Specific reference class unavailable. Accepting all formats.");return true}var e=this.datatypes.class_to_classes[d];if(e[c]){return true}return false}})}); \ No newline at end of file diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e 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/tools/tools-repeat","mvc/tools/tools-select-dataset"],function(d,a,g,c,b){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-error")},reset:function(){this.$el.find(".ui-table-form-error").hide();this.$el.removeClass("ui-error")},_template:function(h){var 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 a.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 m=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});m.$el.addClass("ui-table-form-section");this.table.add(m.$el);this.table.append(k)}},_addRepeat:function(h){var j=this;var n=0;var m=new c.View({title_new:h.title,max:h.max,onnew:function(){var i=h.id+"-section-"+(n++);var q=new f(j.app,{inputs:h.inputs,cls:"ui-table-plain"});m.add({id:i,title:h.title,$el:q.$el,ondel:function(){m.del(i);m.retitle(h.title);j.app.refresh()}});m.retitle(h.title);j.app.refresh()}});for(var l=0;l<h.min;l++){var k=h.id+"-section-"+(n++);var p=new f(j.app,{inputs:h.inputs,cls:"ui-table-plain"});m.add({id:k,title:h.title,$el:p.$el})}m.retitle(h.title);var o=new e({label:h.title,help:h.help,$el:m.$el});o.$el.addClass("ui-table-form-section");this.table.add(o.$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 b.View(this.app,{id:"field-"+j,extensions:h.extensions,multiple:h.multiple,onchange:function(l){var v=l.values[0].id;var t=i.app.tree.references(j,"data_column");if(t.length<=0){console.debug("tool-form::field_data() - Data column parameters unavailable.");return}var o=i.app.datasets.filter(v);var x=null;if(o){console.debug("tool-form::field_data() - Selected dataset "+v+".");x=o.get("metadata_column_types");if(!x){console.debug("tool-form::field_data() - FAILED: Could not find metadata for dataset "+v+".")}}else{console.debug("tool-form::field_data() - FAILED: Could not find dataset "+v+".")}for(var p in t){var r=i.app.input_list[t[p]];var s=i.app.field_list[t[p]];if(!r||!s){console.debug("tool-form::field_data() - FAILED: Column not found.")}var n=r.numerical;var m=[];for(var w in x){var u=x[w];var k=(parseInt(w)+1);var q="Text";if(u=="int"||u=="float"){q="Number"}if(u=="int"||u=="float"||!n){m.push({label:"Column: "+k+" ["+q+"]",value:k})}}if(s){s.update(m);if(!s.exists(s.value())){s.value(s.first())}}}}})},_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.Radio;break}return new m.View({id:"field-"+h.id,data:j,multiple:h.multiple})},_field_text:function(h){return new g.Input({id:"field-"+h.id,area:h.area})},_field_slider:function(h){h.min=h.min||0;h.max=h.max||100000;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,max:h.max,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/tools/tools-repeat","mvc/tools/tools-select-dataset"],function(d,a,g,c,b){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-error")},reset:function(){this.$el.find(".ui-table-form-error").hide();this.$el.removeClass("ui-error")},_template:function(h){var 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 a.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 m=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});m.$el.addClass("ui-table-form-section");this.table.add(m.$el);this.table.append(k)}},_addRepeat:function(h){var j=this;var n=0;var m=new c.View({title_new:h.title,max:h.max,onnew:function(){var i=h.id+"-section-"+(n++);var q=new f(j.app,{inputs:h.inputs,cls:"ui-table-plain"});m.add({id:i,title:h.title,$el:q.$el,ondel:function(){m.del(i);m.retitle(h.title);j.app.refresh()}});m.retitle(h.title);j.app.refresh()}});for(var l=0;l<h.min;l++){var k=h.id+"-section-"+(n++);var p=new f(j.app,{inputs:h.inputs,cls:"ui-table-plain"});m.add({id:k,title:h.title,$el:p.$el})}m.retitle(h.title);var o=new e({label:h.title,help:h.help,$el:m.$el});o.$el.addClass("ui-table-form-section");this.table.add(o.$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 b.View(this.app,{id:"field-"+j,extensions:h.extensions,multiple:h.multiple,onchange:function(o){var n=o.values[0].id;var l=i.app.tree.references(j,"data_column");if(l.length<=0){console.debug("tool-form::field_data() - Data column parameters unavailable.");return}for(var m in l){var k=i.app.field_list[l[m]];k.wait&&k.wait()}i.app.datasets.getDetails(n,function(r){var z=null;if(r){console.debug("tool-form::field_data() - Selected dataset "+n+".");z=r.metadata_column_types;if(!z){console.debug("tool-form::field_data() - FAILED: Could not find metadata for dataset "+n+".")}}else{console.debug("tool-form::field_data() - FAILED: Could not find dataset "+n+".")}for(var t in l){var v=i.app.input_list[l[t]];var w=i.app.field_list[l[t]];if(!v||!w){console.debug("tool-form::field_data() - FAILED: Column not found.")}var s=v.numerical;var q=[];for(var y in z){var x=z[y];var p=(parseInt(y)+1);var u="Text";if(x=="int"||x=="float"){u="Number"}if(x=="int"||x=="float"||!s){q.push({label:"Column: "+p+" ["+u+"]",value:p})}}if(w){w.update(q);if(!w.exists(w.value())){w.value(w.first())}w.show()}}})}})},_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.Radio;break}return new m.View({id:"field-"+h.id,data:j,multiple:h.multiple})},_field_text:function(h){return new g.Input({id:"field-"+h.id,area:h.area})},_field_slider:function(h){h.min=h.min||0;h.max=h.max||100000;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,max:h.max,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 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e 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","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(n,h){this.options=h;var g=this;this.setElement("<div/>");this.current="hda";this.button_new=new e.RadioButton.View({value:this.current,data:[{icon:"fa-file-o",label:"Select datasets",value:"hda"},{icon:"fa-files-o",label:"Select a collection",value:"hdca"}],onchange:function(i){g.current=i;g.refresh();g.trigger("change")}});var l=n.datasets.filterType({content_type:"dataset",data_types:h.extensions});var k=[];for(var j in l){k.push({label:l[j].get("name"),value:l[j].get("id")})}this.select_datasets=new e.Select.View({multiple:true,data:k,value:k[0]&&k[0].value,onchange:function(){g.trigger("change")}});var m=n.datasets.filterType({content_type:"collection",data_types:h.extensions});var f=[];for(var j in m){f.push({label:m[j].get("name"),value:m[j].get("id")})}this.select_collection=new e.Select.View({data:f,value:f[0]&&f[0].value,onchange:function(){g.trigger("change")}});this.$el.append(c.wrap(this.button_new.$el));this.$el.append(this.select_datasets.$el);this.$el.append(this.select_collection.$el);if(!this.options.multiple){this.$el.append(a.batchMode())}this.refresh();this.on("change",function(){if(h.onchange){h.onchange(g.value())}})},value:function(){var g=null;switch(this.current){case"hda":g=this.select_datasets;break;case"hdca":g=this.select_collection;break}var j=g.value();if(!(j instanceof Array)){j=[j]}var f={batch:!this.options.multiple,values:[]};for(var h in j){f.values.push({id:j[h],src:this.current})}return f},validate:function(){switch(this.current){case"hda":return this.select_datasets.validate();case"hdca":return this.select_collection.validate()}},refresh:function(){switch(this.current){case"hda":this.select_datasets.$el.fadeIn();this.select_collection.$el.hide();break;case"hdca":this.select_datasets.$el.hide();this.select_collection.$el.fadeIn();break}}});return{View:d}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(n,h){this.options=h;var g=this;this.setElement("<div/>");this.current="hda";this.button_new=new e.RadioButton.View({value:this.current,data:[{icon:"fa-file-o",label:"Select datasets",value:"hda"},{icon:"fa-files-o",label:"Select a collection",value:"hdca"}],onchange:function(i){g.current=i;g.refresh();g.trigger("change")}});var l=n.datasets.filterType({content_type:"dataset",data_types:h.extensions});var k=[];for(var j in l){k.push({label:l[j].name,value:l[j].id})}this.select_datasets=new e.Select.View({multiple:true,data:k,value:k[0]&&k[0].value,onchange:function(){g.trigger("change")}});var m=n.datasets.filterType({content_type:"collection",data_types:h.extensions});var f=[];for(var j in m){f.push({label:m[j].name,value:m[j].id})}this.select_collection=new e.Select.View({data:f,value:f[0]&&f[0].value,onchange:function(){g.trigger("change")}});this.$el.append(c.wrap(this.button_new.$el));this.$el.append(this.select_datasets.$el);this.$el.append(this.select_collection.$el);if(!this.options.multiple){this.$el.append(a.batchMode())}this.refresh();this.on("change",function(){if(h.onchange){h.onchange(g.value())}})},value:function(){var g=null;switch(this.current){case"hda":g=this.select_datasets;break;case"hdca":g=this.select_collection;break}var j=g.value();if(!(j instanceof Array)){j=[j]}var f={batch:!this.options.multiple,values:[]};for(var h in j){f.values.push({id:j[h],src:this.current})}return f},validate:function(){switch(this.current){case"hda":return this.select_datasets.validate();case"hdca":return this.select_collection.validate()}},refresh:function(){switch(this.current){case"hda":this.select_datasets.$el.fadeIn();this.select_collection.$el.hide();break;case"hdca":this.select_datasets.$el.hide();this.select_collection.$el.fadeIn();break}}});return{View:d}}); \ No newline at end of file diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e 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}},validate:function(){var d=this.value();if(!(d instanceof Array)){d=[d]}for(var c in d){if(d[c]==="null"){return false}}return true},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}},validate:function(){var d=this.value();if(!(d instanceof Array)){d=[d]}for(var c in d){if(d[c]==="null"){return false}}return true},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")},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 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e static/scripts/utils/utils.js --- a/static/scripts/utils/utils.js +++ b/static/scripts/utils/utils.js @@ -6,12 +6,13 @@ // dependencies define(["libs/underscore"], function(_) { -/* request handler for GET - param{string} url - param{function} success - param{function} error - param{boolean} cache -*/ +/** + * Request handler for GET + * @param{String} url - Url request is made to + * @param{Function} success - Callback on success + * @param{Function} error - Callback on error + * @param{Boolean} cache - Use cached data if available + */ function get (options) { top.__utils__get__ = top.__utils__get__ || {}; if (options.cache && top.__utils__get__[options.url]) { @@ -32,13 +33,14 @@ } }; -/* request handler - param{string} method - param{string} url - param{object} data - param{function} success - param{function} error -*/ +/** + * Request handler + * @param{String} method - Request method ['GET', 'POST', 'DELETE', 'PUT'] + * @param{String} url - Url request is made to + * @param{Object} data - Data send to url + * @param{Function} success - Callback on success + * @param{Function} error - Callback on error + */ function request (options) { // prepare ajax var ajaxConfig = { @@ -79,7 +81,11 @@ }); }; -// get css value +/** + * Read a property value from CSS + * @param{String} classname - CSS class + * @param{String} name - CSS property + */ function cssGetAttribute (classname, name) { // place dummy element var el = $('<div class="' + classname + '"></div>'); @@ -97,14 +103,21 @@ return value; }; -// load css +/** + * Load a CSS file + * @param{String} url - Url of CSS file + */ function cssLoadFile (url) { // check if css is already available if (!$('link[href^="' + url + '"]').length) $('<link href="' + galaxy_config.root + url + '" rel="stylesheet">').appendTo('head'); }; -// merge +/** + * Safely merge to dictionaries + * @param{Object} options - Target dictionary + * @param{Object} optionsDefault - Source dictionary + */ function merge (options, optionsDefault) { if (options) return _.defaults(options, optionsDefault); @@ -112,7 +125,11 @@ return optionsDefault; }; -// to string +/** + * Format byte size to string with units + * @param{Integer} size - Size in bytes + * @param{Boolean} normal_font - Switches font between normal and bold + */ function bytesToString (size, normal_font) { // identify unit var unit = ""; @@ -132,19 +149,26 @@ } }; -// unique ide +/** + * Create a unique id + */ function uuid(){ return 'x' + Math.random().toString(36).substring(2, 9); }; -// wrap +/** + * Wrap an dom element into a paragraph + * @param{Element} $el - DOM element to be wrapped + */ function wrap($el) { var wrapper = $('<p></p>'); wrapper.append($el); return wrapper; }; -// time +/** + * Create a time stamp + */ function time() { // get date object var d = new Date(); @@ -162,7 +186,6 @@ return datetime; }; -// return return { cssLoadFile : cssLoadFile, cssGetAttribute : cssGetAttribute, diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e static/style/blue/base.css --- a/static/style/blue/base.css +++ b/static/style/blue/base.css @@ -1313,7 +1313,7 @@ .ui-form-slider .ui-form-slider-element{width:calc(100% - 110px);float:left;top:8px;left:10px} .ui-radiobutton{width:100%}.ui-radiobutton label{height:23px;line-height:1em} .ui-radiobutton i{padding-right:5px} -.ui-select{position:relative;height:27px;overflow:hidden;border:1px solid #bfbfbf;-moz-border-radius:3px;border-radius:3px}.ui-select .button{position:relative;width:25px;height:100%;float:right;border-left:1px solid #bfbfbf;padding-left:9px;padding-top:4px;background:#f2f2f2} +.ui-select{position:relative;height:27px;overflow:hidden;border:1px solid #bfbfbf;-moz-border-radius:3px;border-radius:3px}.ui-select .button{position:relative;width:25px;height:100%;float:right;border-left:1px solid #bfbfbf;background:#f2f2f2;text-align:center;line-height:25px} .ui-select select{position:absolute;top:0px;height:100%;width:100%;padding-left:5px;cursor:pointer;background:transparent;border:0;border-radius:0;-webkit-appearance:none} .ui-select-multiple{height:100% !important;width:100% !important} .libraryRow{background-color:#ebd9b2} diff -r 264079ecc6f0c3fe23b854791e22a181cd8ce11e -r 6aad6ad39a04c8897198f64af0797397a03d112e static/style/src/less/ui.less --- a/static/style/src/less/ui.less +++ b/static/style/src/less/ui.less @@ -280,9 +280,9 @@ height: 100%; float: right; border-left: 1px solid @border-default-color; - padding-left: 9px; - padding-top: 4px; background: @btn-default-bg; + text-align: center; + line-height: 25px; } select { 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