1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/7cc092b92c96/ Changeset: 7cc092b92c96 User: guerler Date: 2014-10-17 17:32:24+00:00 Summary: ToolForm: Improve dataset filtering Affected #: 12 files diff -r d5f495c94ba1d558e492b2f9bae2b78b672cae66 -r 7cc092b92c966053f134caf7ef60077da2349486 client/galaxy/scripts/mvc/tools/tools-content.js --- a/client/galaxy/scripts/mvc/tools/tools-content.js +++ b/client/galaxy/scripts/mvc/tools/tools-content.js @@ -22,7 +22,7 @@ // get history summary Utils.get({ - url : self.base_url + '?deleted=false&state=ok', + url : self.base_url + '?deleted=false', success : function(response) { // backup summary self.summary = response; @@ -71,6 +71,11 @@ for (var i in this.summary) { var content = this.summary[i]; + // check ok state (TODO: should be implemented in the api) + if (content.state !== 'ok') { + continue; + } + // match datatypes var found = false; for (var i in options.extensions) { diff -r d5f495c94ba1d558e492b2f9bae2b78b672cae66 -r 7cc092b92c966053f134caf7ef60077da2349486 client/galaxy/scripts/mvc/tools/tools-select-content.js --- a/client/galaxy/scripts/mvc/tools/tools-select-content.js +++ b/client/galaxy/scripts/mvc/tools/tools-select-content.js @@ -126,6 +126,12 @@ this.select_collection.value(list[0]); break; } + + // check if value has been set + var select = this._select(); + if (!select.validate()) { + select.value(select.first()); + } } catch (err) { console.debug('tools-select-content::value() - Skipped.'); } diff -r d5f495c94ba1d558e492b2f9bae2b78b672cae66 -r 7cc092b92c966053f134caf7ef60077da2349486 client/galaxy/scripts/mvc/ui/ui-options.js --- a/client/galaxy/scripts/mvc/ui/ui-options.js +++ b/client/galaxy/scripts/mvc/ui/ui-options.js @@ -114,7 +114,7 @@ current = [current]; } for (var i in current) { - if (current[i] === 'null') { + if ([null, 'null', undefined].indexOf(current[i]) > -1) { return false; } } diff -r d5f495c94ba1d558e492b2f9bae2b78b672cae66 -r 7cc092b92c966053f134caf7ef60077da2349486 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 @@ -91,7 +91,7 @@ current = [current]; } for (var i in current) { - if (current[i] === 'null') { + if ([null, 'null', undefined].indexOf(current[i]) > -1) { return false; } } diff -r d5f495c94ba1d558e492b2f9bae2b78b672cae66 -r 7cc092b92c966053f134caf7ef60077da2349486 static/scripts/mvc/tools/tools-content.js --- a/static/scripts/mvc/tools/tools-content.js +++ b/static/scripts/mvc/tools/tools-content.js @@ -22,7 +22,7 @@ // get history summary Utils.get({ - url : self.base_url + '?deleted=false&state=ok', + url : self.base_url + '?deleted=false', success : function(response) { // backup summary self.summary = response; @@ -71,6 +71,11 @@ for (var i in this.summary) { var content = this.summary[i]; + // check ok state (TODO: should be implemented in the api) + if (content.state !== 'ok') { + continue; + } + // match datatypes var found = false; for (var i in options.extensions) { diff -r d5f495c94ba1d558e492b2f9bae2b78b672cae66 -r 7cc092b92c966053f134caf7ef60077da2349486 static/scripts/mvc/tools/tools-select-content.js --- a/static/scripts/mvc/tools/tools-select-content.js +++ b/static/scripts/mvc/tools/tools-select-content.js @@ -126,6 +126,12 @@ this.select_collection.value(list[0]); break; } + + // check if value has been set + var select = this._select(); + if (!select.validate()) { + select.value(select.first()); + } } catch (err) { console.debug('tools-select-content::value() - Skipped.'); } diff -r d5f495c94ba1d558e492b2f9bae2b78b672cae66 -r 7cc092b92c966053f134caf7ef60077da2349486 static/scripts/mvc/ui/ui-options.js --- a/static/scripts/mvc/ui/ui-options.js +++ b/static/scripts/mvc/ui/ui-options.js @@ -114,7 +114,7 @@ current = [current]; } for (var i in current) { - if (current[i] === 'null') { + if ([null, 'null', undefined].indexOf(current[i]) > -1) { return false; } } diff -r d5f495c94ba1d558e492b2f9bae2b78b672cae66 -r 7cc092b92c966053f134caf7ef60077da2349486 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 @@ -91,7 +91,7 @@ current = [current]; } for (var i in current) { - if (current[i] === 'null') { + if ([null, 'null', undefined].indexOf(current[i]) > -1) { return false; } } diff -r d5f495c94ba1d558e492b2f9bae2b78b672cae66 -r 7cc092b92c966053f134caf7ef60077da2349486 static/scripts/packed/mvc/tools/tools-content.js --- a/static/scripts/packed/mvc/tools/tools-content.js +++ b/static/scripts/packed/mvc/tools/tools-content.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(c){this.base_url=galaxy_config.root+"api/histories/"+c.history_id+"/contents";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:b.base_url+"?deleted=false&state=ok",success:function(e){b.summary=e;b.summary.sort(function(g,f){return g.hid>f.hid?-1:(g.hid<f.hid?1:0)});console.debug("tools-content::initialize() - Completed.");c.success&&c.success()},error:function(e){console.debug("tools-content::initialize() - Ajax request for summary failed.");console.debug(e)}})},error:function(d){console.debug("tools-content::initialize() - Ajax request for datatypes failed.");console.debug(d)}})},filterType:function(c){c=c||{};var b=[];var g="dataset";if(c.src=="hdca"){g="dataset_collection"}for(var d in this.summary){var e=this.summary[d];var f=false;for(var d in c.extensions){if(this._matchType(c.extensions[d],e.extension)){f=true;break}}if((e.history_content_type===g)&&(f||!c.extensions)){b.push(e)}}return b},get:function(b){return _.findWhere(this.summary,b)||{}},getDetails:function(b){if(!b.id||b.id==="null"){b.success&&b.success();return}var c=this.base_url+"/datasets/"+b.id;if(b.src=="hdca"){c=this.base_url+"/dataset_collections/"+b.id}a.get({url:c,success:function(d){b.success&&b.success(d)},error:function(d){b.success&&b.success();console.debug("tools-content::getDetails() - Ajax request for content failed.");console.debug(d)}})},_matchType:function(f,b){var c=this.datatypes.ext_to_class_name[f];if(!c){console.debug("tools-content::_matchType() - Specific target class unavailable. Accepting all formats.");return true}var d=this.datatypes.ext_to_class_name[b];if(!d){console.debug("tools-content::_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 +define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(c){this.base_url=galaxy_config.root+"api/histories/"+c.history_id+"/contents";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:b.base_url+"?deleted=false",success:function(e){b.summary=e;b.summary.sort(function(g,f){return g.hid>f.hid?-1:(g.hid<f.hid?1:0)});console.debug("tools-content::initialize() - Completed.");c.success&&c.success()},error:function(e){console.debug("tools-content::initialize() - Ajax request for summary failed.");console.debug(e)}})},error:function(d){console.debug("tools-content::initialize() - Ajax request for datatypes failed.");console.debug(d)}})},filterType:function(c){c=c||{};var b=[];var g="dataset";if(c.src=="hdca"){g="dataset_collection"}for(var d in this.summary){var e=this.summary[d];if(e.state!=="ok"){continue}var f=false;for(var d in c.extensions){if(this._matchType(c.extensions[d],e.extension)){f=true;break}}if((e.history_content_type===g)&&(f||!c.extensions)){b.push(e)}}return b},get:function(b){return _.findWhere(this.summary,b)||{}},getDetails:function(b){if(!b.id||b.id==="null"){b.success&&b.success();return}var c=this.base_url+"/datasets/"+b.id;if(b.src=="hdca"){c=this.base_url+"/dataset_collections/"+b.id}a.get({url:c,success:function(d){b.success&&b.success(d)},error:function(d){b.success&&b.success();console.debug("tools-content::getDetails() - Ajax request for content failed.");console.debug(d)}})},_matchType:function(f,b){var c=this.datatypes.ext_to_class_name[f];if(!c){console.debug("tools-content::_matchType() - Specific target class unavailable. Accepting all formats.");return true}var d=this.datatypes.ext_to_class_name[b];if(!d){console.debug("tools-content::_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 d5f495c94ba1d558e492b2f9bae2b78b672cae66 -r 7cc092b92c966053f134caf7ef60077da2349486 static/scripts/packed/mvc/tools/tools-select-content.js --- a/static/scripts/packed/mvc/tools/tools-select-content.js +++ b/static/scripts/packed/mvc/tools/tools-select-content.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.content.filterType({src:"hda",extensions:h.extensions});var k=[];for(var j in l){k.push({label:l[j].hid+": "+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.content.filterType({src:"hdca",extensions:h.extensions});var f=[];for(var j in m){f.push({label:m[j].hid+": "+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(l){if(l!==undefined){try{this.current=l.values[0].src;this.refresh();var k=[];for(var g in l.values){k.push(l.values[g].id)}switch(this.current){case"hda":this.select_datasets.value(k);break;case"hdca":this.select_collection.value(k[0]);break}}catch(j){console.debug("tools-select-content::value() - Skipped.")}}var h=this._select().value();if(!(h instanceof Array)){h=[h]}var f={batch:!this.options.multiple,values:[]};for(var g in h){f.values.push({id:h[g],src:this.current})}return f},validate:function(){return this._select().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}},_select:function(){switch(this.current){case"hdca":return this.select_collection;default:return this.select_datasets}}});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.content.filterType({src:"hda",extensions:h.extensions});var k=[];for(var j in l){k.push({label:l[j].hid+": "+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.content.filterType({src:"hdca",extensions:h.extensions});var f=[];for(var j in m){f.push({label:m[j].hid+": "+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(m){if(m!==undefined){try{this.current=m.values[0].src;this.refresh();var l=[];for(var h in m.values){l.push(m.values[h].id)}switch(this.current){case"hda":this.select_datasets.value(l);break;case"hdca":this.select_collection.value(l[0]);break}var g=this._select();if(!g.validate()){g.value(g.first())}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}var j=this._select().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(){return this._select().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}},_select:function(){switch(this.current){case"hdca":return this.select_collection;default:return this.select_datasets}}});return{View:d}}); \ No newline at end of file diff -r d5f495c94ba1d558e492b2f9bae2b78b672cae66 -r 7cc092b92c966053f134caf7ef60077da2349486 static/scripts/packed/mvc/ui/ui-options.js --- a/static/scripts/packed/mvc/ui/ui-options.js +++ b/static/scripts/packed/mvc/ui/ui-options.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(b){var a=Backbone.View.extend({initialize:function(g){this.optionsDefault={value:[],visible:true,data:[],id:b.uuid(),empty:"No data available"};this.options=b.merge(g,this.optionsDefault);this.setElement("<div/>");this.$error=$(this._templateError(g));this.$options=$(this._template(g));this.$el.append(this.$error);this.$el.append(this.$options);if(!this.options.visible){this.$el.hide()}this.update(this.options.data);if(this.options.value){this.value(this.options.value)}var f=this;this.on("change",function(){f._change()})},update:function(g){var j=this._getValue();this.$el.find(".ui-option").remove();for(var h in g){var i=$(this._templateOption(g[h]));i.addClass("ui-option");this.$options.append(i)}var f=this;this.$el.find("input").on("change",function(){f.value(f._getValue());f._change()});this._refresh();this.value(j)},exists:function(g){if(typeof g==="string"){g=[g]}for(var f in g){if(this.$el.find('input[value="'+g[f]+'"]').length>0){return true}}return false},first:function(){var f=this.$el.find("input");if(f.length>0){return f.val()}else{return undefined}},validate:function(){var g=this.value();if(!(g instanceof Array)){g=[g]}for(var f in g){if(g[f]==="null"){return false}}return true},_change:function(){if(this.options.onchange){this.options.onchange(this._getValue())}},_refresh:function(){var f=this.$el.find(".ui-option").length;if(f==0){this.$error.show();this.$options.hide()}else{this.$error.hide();this.$options.css("display","inline-block")}},_getValue:function(){var g=this.$el.find(":checked");if(g.length==0){return"null"}if(this.options.multiple){var f=[];g.each(function(){f.push($(this).val())});return f}else{return g.val()}},_templateError:function(f){return'<div class="ui-error" style="display: none;">'+f.empty+"</div>"}});var d={};d.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},value:function(f){if(typeof f==="string"){f=[f]}if(f!==undefined){this.$el.find("input").prop("checked",false);for(var g in f){this.$el.find("input[value="+f[g]+"]").prop("checked",true)}}return this._getValue()},_templateOption:function(f){return'<div><input type="radio" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"},_template:function(){return'<div class="ui-options"/>'}});var c={};c.View=d.View.extend({initialize:function(f){f.multiple=true;d.View.prototype.initialize.call(this,f)},_templateOption:function(f){return'<div><input type="checkbox" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"}});var e={};e.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},value:function(f){if(f!==undefined){this.$el.find("input").prop("checked",false);this.$el.find("label").removeClass("active");this.$el.find('[value="'+f+'"]').prop("checked",true).closest("label").addClass("active")}return this._getValue()},_templateOption:function(g){var f='<label class="btn btn-default">';if(g.icon){f+='<i class="fa '+g.icon+'"/>'}f+='<input type="radio" name="'+this.options.id+'" value="'+g.value+'">'+g.label+"</label>";return f},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}});return{Radio:d,RadioButton:e,Checkbox:c}}); \ No newline at end of file +define(["utils/utils"],function(b){var a=Backbone.View.extend({initialize:function(g){this.optionsDefault={value:[],visible:true,data:[],id:b.uuid(),empty:"No data available"};this.options=b.merge(g,this.optionsDefault);this.setElement("<div/>");this.$error=$(this._templateError(g));this.$options=$(this._template(g));this.$el.append(this.$error);this.$el.append(this.$options);if(!this.options.visible){this.$el.hide()}this.update(this.options.data);if(this.options.value){this.value(this.options.value)}var f=this;this.on("change",function(){f._change()})},update:function(g){var j=this._getValue();this.$el.find(".ui-option").remove();for(var h in g){var i=$(this._templateOption(g[h]));i.addClass("ui-option");this.$options.append(i)}var f=this;this.$el.find("input").on("change",function(){f.value(f._getValue());f._change()});this._refresh();this.value(j)},exists:function(g){if(typeof g==="string"){g=[g]}for(var f in g){if(this.$el.find('input[value="'+g[f]+'"]').length>0){return true}}return false},first:function(){var f=this.$el.find("input");if(f.length>0){return f.val()}else{return undefined}},validate:function(){var g=this.value();if(!(g instanceof Array)){g=[g]}for(var f in g){if([null,"null",undefined].indexOf(g[f])>-1){return false}}return true},_change:function(){if(this.options.onchange){this.options.onchange(this._getValue())}},_refresh:function(){var f=this.$el.find(".ui-option").length;if(f==0){this.$error.show();this.$options.hide()}else{this.$error.hide();this.$options.css("display","inline-block")}},_getValue:function(){var g=this.$el.find(":checked");if(g.length==0){return"null"}if(this.options.multiple){var f=[];g.each(function(){f.push($(this).val())});return f}else{return g.val()}},_templateError:function(f){return'<div class="ui-error" style="display: none;">'+f.empty+"</div>"}});var d={};d.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},value:function(f){if(typeof f==="string"){f=[f]}if(f!==undefined){this.$el.find("input").prop("checked",false);for(var g in f){this.$el.find("input[value="+f[g]+"]").prop("checked",true)}}return this._getValue()},_templateOption:function(f){return'<div><input type="radio" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"},_template:function(){return'<div class="ui-options"/>'}});var c={};c.View=d.View.extend({initialize:function(f){f.multiple=true;d.View.prototype.initialize.call(this,f)},_templateOption:function(f){return'<div><input type="checkbox" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"}});var e={};e.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},value:function(f){if(f!==undefined){this.$el.find("input").prop("checked",false);this.$el.find("label").removeClass("active");this.$el.find('[value="'+f+'"]').prop("checked",true).closest("label").addClass("active")}return this._getValue()},_templateOption:function(g){var f='<label class="btn btn-default">';if(g.icon){f+='<i class="fa '+g.icon+'"/>'}f+='<input type="radio" name="'+this.options.id+'" value="'+g.value+'">'+g.label+"</label>";return f},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}});return{Radio:d,RadioButton:e,Checkbox:c}}); \ No newline at end of file diff -r d5f495c94ba1d558e492b2f9bae2b78b672cae66 -r 7cc092b92c966053f134caf7ef60077da2349486 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")},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([null,"null",undefined].indexOf(d[c])>-1){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 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.