galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
February 2015
- 2 participants
- 305 discussions
commit/galaxy-central: guerler: ColorPicker: Use lower case values
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/4b024e277fc5/
Changeset: 4b024e277fc5
User: guerler
Date: 2015-02-13 01:42:56+00:00
Summary: ColorPicker: Use lower case values
Affected #: 1 file
diff -r a48be42539e27d35476ebaf8bea9f30fe09d65bc -r 4b024e277fc5d89a93cc6a7919b8baf0bf5d094a lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -661,7 +661,7 @@
return form_builder.HiddenField( self.name, self.value )
def get_initial_value( self, trans, context, history=None ):
- return self.value
+ return self.value.lower();
## This is clearly a HACK, parameters should only be used for things the user
## can change, there needs to be a different way to specify this. I'm leaving
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.
1
0
commit/galaxy-central: guerler: ColorPicker: Fix event handler
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a48be42539e2/
Changeset: a48be42539e2
User: guerler
Date: 2015-02-13 01:11:11+00:00
Summary: ColorPicker: Fix event handler
Affected #: 3 files
diff -r d34fb2d38b99ca9f5d4db79edf9a0cd01dc4c7f4 -r a48be42539e27d35476ebaf8bea9f30fe09d65bc client/galaxy/scripts/mvc/tools/tools-parameters.js
--- a/client/galaxy/scripts/mvc/tools/tools-parameters.js
+++ b/client/galaxy/scripts/mvc/tools/tools-parameters.js
@@ -248,7 +248,7 @@
*/
_fieldColor : function(input_def) {
var self = this;
- return new ColorPicker(this.app, {
+ return new ColorPicker({
id : 'field-' + input_def.id,
onchange : function() {
self.app.trigger('refresh');
diff -r d34fb2d38b99ca9f5d4db79edf9a0cd01dc4c7f4 -r a48be42539e27d35476ebaf8bea9f30fe09d65bc static/scripts/mvc/tools/tools-parameters.js
--- a/static/scripts/mvc/tools/tools-parameters.js
+++ b/static/scripts/mvc/tools/tools-parameters.js
@@ -248,7 +248,7 @@
*/
_fieldColor : function(input_def) {
var self = this;
- return new ColorPicker(this.app, {
+ return new ColorPicker({
id : 'field-' + input_def.id,
onchange : function() {
self.app.trigger('refresh');
diff -r d34fb2d38b99ca9f5d4db79edf9a0cd01dc4c7f4 -r a48be42539e27d35476ebaf8bea9f30fe09d65bc static/scripts/packed/mvc/tools/tools-parameters.js
--- a/static/scripts/packed/mvc/tools/tools-parameters.js
+++ b/static/scripts/packed/mvc/tools/tools-parameters.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-misc","mvc/tools/tools-select-content","mvc/ui/ui-color-picker"],function(c,d,a,b){return Backbone.Model.extend({types:{text:"_fieldText",select:"_fieldSelect",data_column:"_fieldSelect",genomebuild:"_fieldSelect",data:"_fieldData",data_collection:"_fieldData",integer:"_fieldSlider","float":"_fieldSlider","boolean":"_fieldBoolean",drill_down:"_fieldDrilldown",color:"_fieldColor",hidden:"_fieldHidden",hidden_data:"_fieldHidden",baseurl:"_fieldHidden",},initialize:function(f,e){this.app=f},create:function(e){if(e.value===undefined){e.value=null}if(e.default_value===undefined){e.default_value=e.value}var g=null;var f=this.types[e.type];if(f&&typeof(this[f])==="function"){g=this[f].call(this,e)}if(!g){this.app.incompatible=true;if(e.options){g=this._fieldSelect(e)}else{g=this._fieldText(e)}console.debug("tools-form::_addRow() : Auto matched field type ("+e.type+").")}if(e.value!==undefined){g.value(e.value)}return g},_fieldData:function(e){if(!this.app.options.is_dynamic){e.info="Data input '"+e.name+"' ("+c.textify(e.extensions.toString())+")";e.value=null;return this._fieldHidden(e)}var f=this;return new a.View(this.app,{id:"field-"+e.id,extensions:e.extensions,optional:e.optional,multiple:e.multiple,type:e.type,data:e.options,onchange:function(){f.app.trigger("refresh")}})},_fieldSelect:function(e){if(!this.app.options.is_dynamic&&e.is_dynamic){return this._fieldText(e)}if(e.type=="data_column"){e.error_text="Missing columns in referenced dataset."}if(e.type=="genomebuild"){e.searchable=true}var g=[];for(var h in e.options){var j=e.options[h];g.push({label:j[0],value:j[1]})}var k=d.Select;switch(e.display){case"checkboxes":k=d.Checkbox;break;case"radio":k=d.Radio;break}var f=this;return new k.View({id:"field-"+e.id,data:g,error_text:e.error_text||"No options available",multiple:e.multiple,searchable:e.searchable,onchange:function(){f.app.trigger("refresh")}})},_fieldDrilldown:function(e){if(!this.app.options.is_dynamic&&e.is_dynamic){return this._fieldText(e)}var f=this;return new d.Drilldown.View({id:"field-"+e.id,data:e.options,display:e.display,onchange:function(){f.app.trigger("refresh")}})},_fieldText:function(e){if(e.options){e.area=e.multiple;if(!c.validate(e.value)){e.value=""}else{if(e.value instanceof Array){e.value=value.toString()}else{e.value=String(e.value).replace(/[\[\]'"\s]/g,"");if(e.multiple){e.value=e.value.replace(/,/g,"\n")}}}}var f=this;return new d.Input({id:"field-"+e.id,area:e.area,onchange:function(){f.app.trigger("refresh")}})},_fieldSlider:function(e){var f=this;return new d.Slider.View({id:"field-"+e.id,precise:e.type=="float",min:e.min,max:e.max,onchange:function(){f.app.trigger("refresh")}})},_fieldHidden:function(e){return new d.Hidden({id:"field-"+e.id,info:e.info})},_fieldBoolean:function(e){var f=this;return new d.RadioButton.View({id:"field-"+e.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:function(){f.app.trigger("refresh")}})},_fieldColor:function(e){var f=this;return new b(this.app,{id:"field-"+e.id,onchange:function(){f.app.trigger("refresh")}})}});return{View:View}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-misc","mvc/tools/tools-select-content","mvc/ui/ui-color-picker"],function(c,d,a,b){return Backbone.Model.extend({types:{text:"_fieldText",select:"_fieldSelect",data_column:"_fieldSelect",genomebuild:"_fieldSelect",data:"_fieldData",data_collection:"_fieldData",integer:"_fieldSlider","float":"_fieldSlider","boolean":"_fieldBoolean",drill_down:"_fieldDrilldown",color:"_fieldColor",hidden:"_fieldHidden",hidden_data:"_fieldHidden",baseurl:"_fieldHidden",},initialize:function(f,e){this.app=f},create:function(e){if(e.value===undefined){e.value=null}if(e.default_value===undefined){e.default_value=e.value}var g=null;var f=this.types[e.type];if(f&&typeof(this[f])==="function"){g=this[f].call(this,e)}if(!g){this.app.incompatible=true;if(e.options){g=this._fieldSelect(e)}else{g=this._fieldText(e)}console.debug("tools-form::_addRow() : Auto matched field type ("+e.type+").")}if(e.value!==undefined){g.value(e.value)}return g},_fieldData:function(e){if(!this.app.options.is_dynamic){e.info="Data input '"+e.name+"' ("+c.textify(e.extensions.toString())+")";e.value=null;return this._fieldHidden(e)}var f=this;return new a.View(this.app,{id:"field-"+e.id,extensions:e.extensions,optional:e.optional,multiple:e.multiple,type:e.type,data:e.options,onchange:function(){f.app.trigger("refresh")}})},_fieldSelect:function(e){if(!this.app.options.is_dynamic&&e.is_dynamic){return this._fieldText(e)}if(e.type=="data_column"){e.error_text="Missing columns in referenced dataset."}if(e.type=="genomebuild"){e.searchable=true}var g=[];for(var h in e.options){var j=e.options[h];g.push({label:j[0],value:j[1]})}var k=d.Select;switch(e.display){case"checkboxes":k=d.Checkbox;break;case"radio":k=d.Radio;break}var f=this;return new k.View({id:"field-"+e.id,data:g,error_text:e.error_text||"No options available",multiple:e.multiple,searchable:e.searchable,onchange:function(){f.app.trigger("refresh")}})},_fieldDrilldown:function(e){if(!this.app.options.is_dynamic&&e.is_dynamic){return this._fieldText(e)}var f=this;return new d.Drilldown.View({id:"field-"+e.id,data:e.options,display:e.display,onchange:function(){f.app.trigger("refresh")}})},_fieldText:function(e){if(e.options){e.area=e.multiple;if(!c.validate(e.value)){e.value=""}else{if(e.value instanceof Array){e.value=value.toString()}else{e.value=String(e.value).replace(/[\[\]'"\s]/g,"");if(e.multiple){e.value=e.value.replace(/,/g,"\n")}}}}var f=this;return new d.Input({id:"field-"+e.id,area:e.area,onchange:function(){f.app.trigger("refresh")}})},_fieldSlider:function(e){var f=this;return new d.Slider.View({id:"field-"+e.id,precise:e.type=="float",min:e.min,max:e.max,onchange:function(){f.app.trigger("refresh")}})},_fieldHidden:function(e){return new d.Hidden({id:"field-"+e.id,info:e.info})},_fieldBoolean:function(e){var f=this;return new d.RadioButton.View({id:"field-"+e.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:function(){f.app.trigger("refresh")}})},_fieldColor:function(e){var f=this;return new b({id:"field-"+e.id,onchange:function(){f.app.trigger("refresh")}})}});return{View:View}});
\ 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.
1
0
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d34fb2d38b99/
Changeset: d34fb2d38b99
User: guerler
Date: 2015-02-13 01:02:59+00:00
Summary: Ui: Add default color
Affected #: 4 files
diff -r bcb29996bd53620fcb724e1ac25c17f01ee568b8 -r d34fb2d38b99ca9f5d4db79edf9a0cd01dc4c7f4 client/galaxy/scripts/mvc/ui/ui-color-picker.js
--- a/client/galaxy/scripts/mvc/ui/ui-color-picker.js
+++ b/client/galaxy/scripts/mvc/ui/ui-color-picker.js
@@ -15,7 +15,6 @@
// default options
optionsDefault: {
- default_color: '#fdeada'
},
// initialize
@@ -62,19 +61,17 @@
value : function (new_val) {
if (new_val !== undefined) {
// set default value
- if (new_val === null) {
- new_val = this.options.default_color;
+ if (new_val !== null) {
+ // update color value
+ this.$value.css('background-color', new_val);
+
+ // check selected color in panel
+ this.$('.ui-color-picker-box').empty();
+ this.$(this._getValue()).html(this._templateCheck());
+
+ // trigger custom event
+ this.options.onchange && this.options.onchange(new_val);
}
-
- // update color value
- this.$value.css('background-color', new_val);
-
- // check selected color in panel
- this.$('.ui-color-picker-box').empty();
- this.$(this._getValue()).html(this._templateCheck());
-
- // trigger custom event
- this.options.onchange && this.options.onchange(new_val);
}
// return current value
diff -r bcb29996bd53620fcb724e1ac25c17f01ee568b8 -r d34fb2d38b99ca9f5d4db79edf9a0cd01dc4c7f4 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -655,7 +655,7 @@
def __init__( self, tool, input_source ):
input_source = ensure_input_source( input_source )
ToolParameter.__init__( self, tool, input_source )
- self.value = input_source.get( 'value' )
+ self.value = input_source.get( 'value', '#fdeada' )
def get_html_field( self, trans=None, value=None, other_values={} ):
return form_builder.HiddenField( self.name, self.value )
diff -r bcb29996bd53620fcb724e1ac25c17f01ee568b8 -r d34fb2d38b99ca9f5d4db79edf9a0cd01dc4c7f4 static/scripts/mvc/ui/ui-color-picker.js
--- a/static/scripts/mvc/ui/ui-color-picker.js
+++ b/static/scripts/mvc/ui/ui-color-picker.js
@@ -15,7 +15,6 @@
// default options
optionsDefault: {
- default_color: '#fdeada'
},
// initialize
@@ -62,19 +61,17 @@
value : function (new_val) {
if (new_val !== undefined) {
// set default value
- if (new_val === null) {
- new_val = this.options.default_color;
+ if (new_val !== null) {
+ // update color value
+ this.$value.css('background-color', new_val);
+
+ // check selected color in panel
+ this.$('.ui-color-picker-box').empty();
+ this.$(this._getValue()).html(this._templateCheck());
+
+ // trigger custom event
+ this.options.onchange && this.options.onchange(new_val);
}
-
- // update color value
- this.$value.css('background-color', new_val);
-
- // check selected color in panel
- this.$('.ui-color-picker-box').empty();
- this.$(this._getValue()).html(this._templateCheck());
-
- // trigger custom event
- this.options.onchange && this.options.onchange(new_val);
}
// return current value
diff -r bcb29996bd53620fcb724e1ac25c17f01ee568b8 -r d34fb2d38b99ca9f5d4db79edf9a0cd01dc4c7f4 static/scripts/packed/mvc/ui/ui-color-picker.js
--- a/static/scripts/packed/mvc/ui/ui-color-picker.js
+++ b/static/scripts/packed/mvc/ui/ui-color-picker.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-misc"],function(a,b){return Backbone.View.extend({colors:{standard:["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"],base:["ffffff","000000","eeece1","1f497d","4f81bd","c0504d","9bbb59","8064a2","4bacc6","f79646"],theme:[["f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada"],["d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5"],["bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f"],["a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09"],["7f7f7e","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"]]},optionsDefault:{default_color:"#fdeada"},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template());this.$panel=this.$(".ui-color-picker-panel");this.$view=this.$(".ui-color-picker-view");this.$value=this.$(".ui-color-picker-value");this.$header=this.$(".ui-color-picker-header");this._build();this.visible=false;this.value(this.options.value);this.$boxes=this.$(".ui-color-picker-box");var c=this;this.$boxes.on("click",function(){c.value($(this).css("background-color"))});this.$header.on("click",function(){c.visible=!c.visible;if(c.visible){c.$view.fadeIn("fast")}else{c.$view.hide()}})},value:function(c){if(c!==undefined){if(c===null){c=this.options.default_color}this.$value.css("background-color",c);this.$(".ui-color-picker-box").empty();this.$(this._getValue()).html(this._templateCheck());this.options.onchange&&this.options.onchange(c)}return this._getValue()},_getValue:function(){var c=this.$value.css("background-color");c=c.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(c){function d(e){return("0"+parseInt(e).toString(16)).slice(-2)}return"#"+d(c[1])+d(c[2])+d(c[3])}else{return null}},_build:function(){var d=this._content({label:"Theme Colors",colors:this.colors.base,padding:10});for(var e in this.colors.theme){var c={};if(e==0){c.bottom=true}else{if(e!=this.colors.theme.length-1){c.top=true;c.bottom=true}else{c.top=true;c.padding=5}}c.colors=this.colors.theme[e];this._content(c)}this._content({label:"Standard Colors",colors:this.colors.standard,padding:5})},_content:function(n){var l=n.label;var d=n.colors;var k=n.padding;var h=n.top;var c=n.bottom;var f=$(this._templateContent());var j=f.find(".label");if(n.label){j.html(n.label)}else{j.hide()}var m=f.find(".line");this.$panel.append(f);for(var g in d){var e=$(this._templateBox(d[g]));if(h){e.css("border-top","none");e.css("border-top-left-radius","0px");e.css("border-top-right-radius","0px")}if(c){e.css("border-bottom","none");e.css("border-bottom-left-radius","0px");e.css("border-bottom-right-radius","0px")}m.append(e)}if(k){m.css("padding-bottom",k)}return f},_templateCheck:function(){return'<div class="ui-color-picker-check fa fa-check"/>'},_templateContent:function(){return'<div class="ui-color-picker-content"><div class="label"/><div class="line"/></div>'},_templateBox:function(c){return'<div id="'+c+'" class="ui-color-picker-box" style="background-color: #'+c+';"/>'},_template:function(){return'<div class="ui-color-picker"><div class="ui-color-picker-header"><div class="ui-color-picker-value"/><div class="ui-color-picker-label">Select a color</div></div><div class="ui-color-picker-view ui-input"><div class="ui-color-picker-panel"/></div>';"</div>"}})});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-misc"],function(a,b){return Backbone.View.extend({colors:{standard:["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"],base:["ffffff","000000","eeece1","1f497d","4f81bd","c0504d","9bbb59","8064a2","4bacc6","f79646"],theme:[["f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada"],["d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5"],["bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f"],["a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09"],["7f7f7e","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"]]},optionsDefault:{},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template());this.$panel=this.$(".ui-color-picker-panel");this.$view=this.$(".ui-color-picker-view");this.$value=this.$(".ui-color-picker-value");this.$header=this.$(".ui-color-picker-header");this._build();this.visible=false;this.value(this.options.value);this.$boxes=this.$(".ui-color-picker-box");var c=this;this.$boxes.on("click",function(){c.value($(this).css("background-color"))});this.$header.on("click",function(){c.visible=!c.visible;if(c.visible){c.$view.fadeIn("fast")}else{c.$view.hide()}})},value:function(c){if(c!==undefined){if(c!==null){this.$value.css("background-color",c);this.$(".ui-color-picker-box").empty();this.$(this._getValue()).html(this._templateCheck());this.options.onchange&&this.options.onchange(c)}}return this._getValue()},_getValue:function(){var c=this.$value.css("background-color");c=c.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(c){function d(e){return("0"+parseInt(e).toString(16)).slice(-2)}return"#"+d(c[1])+d(c[2])+d(c[3])}else{return null}},_build:function(){var d=this._content({label:"Theme Colors",colors:this.colors.base,padding:10});for(var e in this.colors.theme){var c={};if(e==0){c.bottom=true}else{if(e!=this.colors.theme.length-1){c.top=true;c.bottom=true}else{c.top=true;c.padding=5}}c.colors=this.colors.theme[e];this._content(c)}this._content({label:"Standard Colors",colors:this.colors.standard,padding:5})},_content:function(n){var l=n.label;var d=n.colors;var k=n.padding;var h=n.top;var c=n.bottom;var f=$(this._templateContent());var j=f.find(".label");if(n.label){j.html(n.label)}else{j.hide()}var m=f.find(".line");this.$panel.append(f);for(var g in d){var e=$(this._templateBox(d[g]));if(h){e.css("border-top","none");e.css("border-top-left-radius","0px");e.css("border-top-right-radius","0px")}if(c){e.css("border-bottom","none");e.css("border-bottom-left-radius","0px");e.css("border-bottom-right-radius","0px")}m.append(e)}if(k){m.css("padding-bottom",k)}return f},_templateCheck:function(){return'<div class="ui-color-picker-check fa fa-check"/>'},_templateContent:function(){return'<div class="ui-color-picker-content"><div class="label"/><div class="line"/></div>'},_templateBox:function(c){return'<div id="'+c+'" class="ui-color-picker-box" style="background-color: #'+c+';"/>'},_template:function(){return'<div class="ui-color-picker"><div class="ui-color-picker-header"><div class="ui-color-picker-value"/><div class="ui-color-picker-label">Select a color</div></div><div class="ui-color-picker-view ui-input"><div class="ui-color-picker-panel"/></div>';"</div>"}})});
\ 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.
1
0
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/bcb29996bd53/
Changeset: bcb29996bd53
User: guerler
Date: 2015-02-13 00:46:08+00:00
Summary: Change color
Affected #: 3 files
diff -r 32b5ad88cd9baf12cd0776c54437b445a0561abf -r bcb29996bd53620fcb724e1ac25c17f01ee568b8 client/galaxy/scripts/mvc/ui/ui-color-picker.js
--- a/client/galaxy/scripts/mvc/ui/ui-color-picker.js
+++ b/client/galaxy/scripts/mvc/ui/ui-color-picker.js
@@ -10,7 +10,7 @@
['d8d8d8','595959','c4bd97','8db3e2','b8cce4','e5b9b7','d7e3bc','ccc1d9','b7dde8','fbd5b5'],
['bfbfbf','3f3f3f','938953','548dd4','95b3d7','d99694','c3d69b','b2a2c7','92cddc','fac08f'],
['a5a5a5','262626','494429','17365d','366092','953734','76923c','5f497a','31859b','e36c09'],
- ['7f7f7f','0c0c0c','1d1b10','0f243e','244061','632423','4f6128','3f3151','205867','974806']]
+ ['7f7f7e','0c0c0c','1d1b10','0f243e','244061','632423','4f6128','3f3151','205867','974806']]
},
// default options
diff -r 32b5ad88cd9baf12cd0776c54437b445a0561abf -r bcb29996bd53620fcb724e1ac25c17f01ee568b8 static/scripts/mvc/ui/ui-color-picker.js
--- a/static/scripts/mvc/ui/ui-color-picker.js
+++ b/static/scripts/mvc/ui/ui-color-picker.js
@@ -10,7 +10,7 @@
['d8d8d8','595959','c4bd97','8db3e2','b8cce4','e5b9b7','d7e3bc','ccc1d9','b7dde8','fbd5b5'],
['bfbfbf','3f3f3f','938953','548dd4','95b3d7','d99694','c3d69b','b2a2c7','92cddc','fac08f'],
['a5a5a5','262626','494429','17365d','366092','953734','76923c','5f497a','31859b','e36c09'],
- ['7f7f7f','0c0c0c','1d1b10','0f243e','244061','632423','4f6128','3f3151','205867','974806']]
+ ['7f7f7e','0c0c0c','1d1b10','0f243e','244061','632423','4f6128','3f3151','205867','974806']]
},
// default options
diff -r 32b5ad88cd9baf12cd0776c54437b445a0561abf -r bcb29996bd53620fcb724e1ac25c17f01ee568b8 static/scripts/packed/mvc/ui/ui-color-picker.js
--- a/static/scripts/packed/mvc/ui/ui-color-picker.js
+++ b/static/scripts/packed/mvc/ui/ui-color-picker.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-misc"],function(a,b){return Backbone.View.extend({colors:{standard:["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"],base:["ffffff","000000","eeece1","1f497d","4f81bd","c0504d","9bbb59","8064a2","4bacc6","f79646"],theme:[["f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada"],["d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5"],["bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f"],["a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09"],["7f7f7f","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"]]},optionsDefault:{default_color:"#fdeada"},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template());this.$panel=this.$(".ui-color-picker-panel");this.$view=this.$(".ui-color-picker-view");this.$value=this.$(".ui-color-picker-value");this.$header=this.$(".ui-color-picker-header");this._build();this.visible=false;this.value(this.options.value);this.$boxes=this.$(".ui-color-picker-box");var c=this;this.$boxes.on("click",function(){c.value($(this).css("background-color"))});this.$header.on("click",function(){c.visible=!c.visible;if(c.visible){c.$view.fadeIn("fast")}else{c.$view.hide()}})},value:function(c){if(c!==undefined){if(c===null){c=this.options.default_color}this.$value.css("background-color",c);this.$(".ui-color-picker-box").empty();this.$(this._getValue()).html(this._templateCheck());this.options.onchange&&this.options.onchange(c)}return this._getValue()},_getValue:function(){var c=this.$value.css("background-color");c=c.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(c){function d(e){return("0"+parseInt(e).toString(16)).slice(-2)}return"#"+d(c[1])+d(c[2])+d(c[3])}else{return null}},_build:function(){var d=this._content({label:"Theme Colors",colors:this.colors.base,padding:10});for(var e in this.colors.theme){var c={};if(e==0){c.bottom=true}else{if(e!=this.colors.theme.length-1){c.top=true;c.bottom=true}else{c.top=true;c.padding=5}}c.colors=this.colors.theme[e];this._content(c)}this._content({label:"Standard Colors",colors:this.colors.standard,padding:5})},_content:function(n){var l=n.label;var d=n.colors;var k=n.padding;var h=n.top;var c=n.bottom;var f=$(this._templateContent());var j=f.find(".label");if(n.label){j.html(n.label)}else{j.hide()}var m=f.find(".line");this.$panel.append(f);for(var g in d){var e=$(this._templateBox(d[g]));if(h){e.css("border-top","none");e.css("border-top-left-radius","0px");e.css("border-top-right-radius","0px")}if(c){e.css("border-bottom","none");e.css("border-bottom-left-radius","0px");e.css("border-bottom-right-radius","0px")}m.append(e)}if(k){m.css("padding-bottom",k)}return f},_templateCheck:function(){return'<div class="ui-color-picker-check fa fa-check"/>'},_templateContent:function(){return'<div class="ui-color-picker-content"><div class="label"/><div class="line"/></div>'},_templateBox:function(c){return'<div id="'+c+'" class="ui-color-picker-box" style="background-color: #'+c+';"/>'},_template:function(){return'<div class="ui-color-picker"><div class="ui-color-picker-header"><div class="ui-color-picker-value"/><div class="ui-color-picker-label">Select a color</div></div><div class="ui-color-picker-view ui-input"><div class="ui-color-picker-panel"/></div>';"</div>"}})});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-misc"],function(a,b){return Backbone.View.extend({colors:{standard:["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"],base:["ffffff","000000","eeece1","1f497d","4f81bd","c0504d","9bbb59","8064a2","4bacc6","f79646"],theme:[["f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada"],["d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5"],["bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f"],["a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09"],["7f7f7e","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"]]},optionsDefault:{default_color:"#fdeada"},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template());this.$panel=this.$(".ui-color-picker-panel");this.$view=this.$(".ui-color-picker-view");this.$value=this.$(".ui-color-picker-value");this.$header=this.$(".ui-color-picker-header");this._build();this.visible=false;this.value(this.options.value);this.$boxes=this.$(".ui-color-picker-box");var c=this;this.$boxes.on("click",function(){c.value($(this).css("background-color"))});this.$header.on("click",function(){c.visible=!c.visible;if(c.visible){c.$view.fadeIn("fast")}else{c.$view.hide()}})},value:function(c){if(c!==undefined){if(c===null){c=this.options.default_color}this.$value.css("background-color",c);this.$(".ui-color-picker-box").empty();this.$(this._getValue()).html(this._templateCheck());this.options.onchange&&this.options.onchange(c)}return this._getValue()},_getValue:function(){var c=this.$value.css("background-color");c=c.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(c){function d(e){return("0"+parseInt(e).toString(16)).slice(-2)}return"#"+d(c[1])+d(c[2])+d(c[3])}else{return null}},_build:function(){var d=this._content({label:"Theme Colors",colors:this.colors.base,padding:10});for(var e in this.colors.theme){var c={};if(e==0){c.bottom=true}else{if(e!=this.colors.theme.length-1){c.top=true;c.bottom=true}else{c.top=true;c.padding=5}}c.colors=this.colors.theme[e];this._content(c)}this._content({label:"Standard Colors",colors:this.colors.standard,padding:5})},_content:function(n){var l=n.label;var d=n.colors;var k=n.padding;var h=n.top;var c=n.bottom;var f=$(this._templateContent());var j=f.find(".label");if(n.label){j.html(n.label)}else{j.hide()}var m=f.find(".line");this.$panel.append(f);for(var g in d){var e=$(this._templateBox(d[g]));if(h){e.css("border-top","none");e.css("border-top-left-radius","0px");e.css("border-top-right-radius","0px")}if(c){e.css("border-bottom","none");e.css("border-bottom-left-radius","0px");e.css("border-bottom-right-radius","0px")}m.append(e)}if(k){m.css("padding-bottom",k)}return f},_templateCheck:function(){return'<div class="ui-color-picker-check fa fa-check"/>'},_templateContent:function(){return'<div class="ui-color-picker-content"><div class="label"/><div class="line"/></div>'},_templateBox:function(c){return'<div id="'+c+'" class="ui-color-picker-box" style="background-color: #'+c+';"/>'},_template:function(){return'<div class="ui-color-picker"><div class="ui-color-picker-header"><div class="ui-color-picker-value"/><div class="ui-color-picker-label">Select a color</div></div><div class="ui-color-picker-view ui-input"><div class="ui-color-picker-panel"/></div>';"</div>"}})});
\ 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.
1
0
commit/galaxy-central: guerler: Ui: Add simple color picker
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/32b5ad88cd9b/
Changeset: 32b5ad88cd9b
User: guerler
Date: 2015-02-13 00:24:56+00:00
Summary: Ui: Add simple color picker
Affected #: 9 files
diff -r 8563e5b33300a733344a165dff13a1877bccde79 -r 32b5ad88cd9baf12cd0776c54437b445a0561abf client/galaxy/scripts/mvc/tools/tools-parameters.js
--- a/client/galaxy/scripts/mvc/tools/tools-parameters.js
+++ b/client/galaxy/scripts/mvc/tools/tools-parameters.js
@@ -1,8 +1,11 @@
/**
This class creates input elements. New input parameter types should be added to the types dictionary.
*/
-define(['utils/utils','mvc/ui/ui-misc', 'mvc/tools/tools-select-content'],
- function(Utils, Ui, SelectContent) {
+define(['utils/utils',
+ 'mvc/ui/ui-misc',
+ 'mvc/tools/tools-select-content',
+ 'mvc/ui/ui-color-picker'],
+ function(Utils, Ui, SelectContent, ColorPicker) {
// create form view
return Backbone.Model.extend({
@@ -18,9 +21,10 @@
'float' : '_fieldSlider',
'boolean' : '_fieldBoolean',
'drill_down' : '_fieldDrilldown',
+ 'color' : '_fieldColor',
'hidden' : '_fieldHidden',
'hidden_data' : '_fieldHidden',
- 'baseurl' : '_fieldHidden'
+ 'baseurl' : '_fieldHidden',
},
// initialize
@@ -238,6 +242,18 @@
self.app.trigger('refresh');
}
});
+ },
+
+ /** Color picker field
+ */
+ _fieldColor : function(input_def) {
+ var self = this;
+ return new ColorPicker(this.app, {
+ id : 'field-' + input_def.id,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
}
});
diff -r 8563e5b33300a733344a165dff13a1877bccde79 -r 32b5ad88cd9baf12cd0776c54437b445a0561abf client/galaxy/scripts/mvc/ui/ui-color-picker.js
--- /dev/null
+++ b/client/galaxy/scripts/mvc/ui/ui-color-picker.js
@@ -0,0 +1,202 @@
+// dependencies
+define(['utils/utils', 'mvc/ui/ui-misc'], function(Utils, Ui) {
+
+// plugin
+return Backbone.View.extend({
+ colors: {
+ standard: ['c00000','ff0000','ffc000','ffff00','92d050','00b050','00b0f0','0070c0','002060','7030a0'],
+ base : ['ffffff','000000','eeece1','1f497d','4f81bd','c0504d','9bbb59','8064a2','4bacc6','f79646'],
+ theme :[['f2f2f2','7f7f7f','ddd9c3','c6d9f0','dbe5f1','f2dcdb','ebf1dd','e5e0ec','dbeef3','fdeada'],
+ ['d8d8d8','595959','c4bd97','8db3e2','b8cce4','e5b9b7','d7e3bc','ccc1d9','b7dde8','fbd5b5'],
+ ['bfbfbf','3f3f3f','938953','548dd4','95b3d7','d99694','c3d69b','b2a2c7','92cddc','fac08f'],
+ ['a5a5a5','262626','494429','17365d','366092','953734','76923c','5f497a','31859b','e36c09'],
+ ['7f7f7f','0c0c0c','1d1b10','0f243e','244061','632423','4f6128','3f3151','205867','974806']]
+ },
+
+ // default options
+ optionsDefault: {
+ default_color: '#fdeada'
+ },
+
+ // initialize
+ initialize : function(options) {
+ // configure options
+ this.options = Utils.merge(options, this.optionsDefault);
+
+ // create new element
+ this.setElement(this._template());
+ this.$panel = this.$('.ui-color-picker-panel');
+ this.$view = this.$('.ui-color-picker-view');
+ this.$value = this.$('.ui-color-picker-value');
+ this.$header = this.$('.ui-color-picker-header');
+
+ // build panel
+ this._build();
+
+ // hide panel on start up
+ this.visible = false;
+
+ // set initial value
+ this.value(this.options.value);
+
+ // link boxes
+ this.$boxes = this.$('.ui-color-picker-box');
+
+ // add event handler
+ var self = this;
+ this.$boxes.on('click', function() {
+ self.value($(this).css('background-color'));
+ //self.$header.trigger('click');
+ });
+ this.$header.on('click', function() {
+ self.visible = !self.visible;
+ if (self.visible) {
+ self.$view.fadeIn('fast');
+ } else {
+ self.$view.hide();
+ }
+ });
+ },
+
+ // value
+ value : function (new_val) {
+ if (new_val !== undefined) {
+ // set default value
+ if (new_val === null) {
+ new_val = this.options.default_color;
+ }
+
+ // update color value
+ this.$value.css('background-color', new_val);
+
+ // check selected color in panel
+ this.$('.ui-color-picker-box').empty();
+ this.$(this._getValue()).html(this._templateCheck());
+
+ // trigger custom event
+ this.options.onchange && this.options.onchange(new_val);
+ }
+
+ // return current value
+ return this._getValue();
+ },
+
+ // get value from dom
+ _getValue: function() {
+ var rgb = this.$value.css('background-color');
+ rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
+ if (rgb) {
+ function hex(x) {
+ return ('0' + parseInt(x).toString(16)).slice(-2);
+ }
+ return '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
+ } else {
+ return null;
+ }
+ },
+
+ // build panel
+ _build: function() {
+ var $content = this._content({
+ label : 'Theme Colors',
+ colors : this.colors.base,
+ padding : 10
+ });
+ for (var i in this.colors.theme) {
+ var line_def = {};
+ if (i == 0) {
+ line_def['bottom'] = true;
+ } else {
+ if (i != this.colors.theme.length - 1) {
+ line_def['top'] = true;
+ line_def['bottom'] = true;
+ } else {
+ line_def['top'] = true;
+ line_def['padding'] = 5;
+ }
+ }
+ line_def['colors'] = this.colors.theme[i];
+ this._content(line_def);
+ }
+ this._content({
+ label : 'Standard Colors',
+ colors : this.colors.standard,
+ padding : 5
+ });
+ },
+
+ // create content
+ _content: function(options) {
+ // get parameters
+ var label = options.label;
+ var colors = options.colors;
+ var padding = options.padding;
+ var top = options.top;
+ var bottom = options.bottom;
+
+ // create lines
+ var $content = $(this._templateContent());
+
+ // set label
+ var $label = $content.find('.label');
+ if (options.label) {
+ $label.html(options.label);
+ } else {
+ $label.hide();
+ }
+
+ // build line
+ var $line = $content.find('.line');
+ this.$panel.append($content);
+ for (var i in colors) {
+ var $box = $(this._templateBox(colors[i]));
+ if (top) {
+ $box.css('border-top', 'none');
+ $box.css('border-top-left-radius', '0px');
+ $box.css('border-top-right-radius', '0px');
+ }
+ if (bottom) {
+ $box.css('border-bottom', 'none');
+ $box.css('border-bottom-left-radius', '0px');
+ $box.css('border-bottom-right-radius', '0px');
+ }
+ $line.append($box);
+ }
+ if (padding) {
+ $line.css('padding-bottom', padding);
+ }
+ return $content;
+ },
+
+ // check icon
+ _templateCheck: function() {
+ return '<div class="ui-color-picker-check fa fa-check"/>';
+ },
+
+ // content template
+ _templateContent: function() {
+ return '<div class="ui-color-picker-content">' +
+ '<div class="label"/>' +
+ '<div class="line"/>' +
+ '</div>';
+ },
+
+ // box template
+ _templateBox: function(color) {
+ return '<div id="' + color + '" class="ui-color-picker-box" style="background-color: #' + color + ';"/>';
+ },
+
+ // template
+ _template: function() {
+ return '<div class="ui-color-picker">' +
+ '<div class="ui-color-picker-header">' +
+ '<div class="ui-color-picker-value"/>' +
+ '<div class="ui-color-picker-label">Select a color</div>' +
+ '</div>' +
+ '<div class="ui-color-picker-view ui-input">' +
+ '<div class="ui-color-picker-panel"/>' +
+ '</div>'
+ '</div>';
+ }
+});
+});
\ No newline at end of file
diff -r 8563e5b33300a733344a165dff13a1877bccde79 -r 32b5ad88cd9baf12cd0776c54437b445a0561abf lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -644,6 +644,25 @@
def get_label( self ):
return None
+class ColorToolParameter( ToolParameter ):
+ """
+ Parameter that stores a color.
+
+ >>> p = ColorToolParameter( None, XML( '<param name="blah" type="color" value="#ffffff"/>' ) )
+ >>> print p.name
+ blah
+ """
+ def __init__( self, tool, input_source ):
+ input_source = ensure_input_source( input_source )
+ ToolParameter.__init__( self, tool, input_source )
+ self.value = input_source.get( 'value' )
+
+ def get_html_field( self, trans=None, value=None, other_values={} ):
+ return form_builder.HiddenField( self.name, self.value )
+
+ def get_initial_value( self, trans, context, history=None ):
+ return self.value
+
## This is clearly a HACK, parameters should only be used for things the user
## can change, there needs to be a different way to specify this. I'm leaving
## it for now to avoid breaking any tools.
@@ -2514,6 +2533,7 @@
boolean=BooleanToolParameter,
genomebuild=GenomeBuildParameter,
select=SelectToolParameter,
+ color=ColorToolParameter,
data_column=ColumnListParameter,
hidden=HiddenToolParameter,
hidden_data=HiddenDataToolParameter,
diff -r 8563e5b33300a733344a165dff13a1877bccde79 -r 32b5ad88cd9baf12cd0776c54437b445a0561abf static/scripts/mvc/tools/tools-parameters.js
--- a/static/scripts/mvc/tools/tools-parameters.js
+++ b/static/scripts/mvc/tools/tools-parameters.js
@@ -1,8 +1,11 @@
/**
This class creates input elements. New input parameter types should be added to the types dictionary.
*/
-define(['utils/utils','mvc/ui/ui-misc', 'mvc/tools/tools-select-content'],
- function(Utils, Ui, SelectContent) {
+define(['utils/utils',
+ 'mvc/ui/ui-misc',
+ 'mvc/tools/tools-select-content',
+ 'mvc/ui/ui-color-picker'],
+ function(Utils, Ui, SelectContent, ColorPicker) {
// create form view
return Backbone.Model.extend({
@@ -18,9 +21,10 @@
'float' : '_fieldSlider',
'boolean' : '_fieldBoolean',
'drill_down' : '_fieldDrilldown',
+ 'color' : '_fieldColor',
'hidden' : '_fieldHidden',
'hidden_data' : '_fieldHidden',
- 'baseurl' : '_fieldHidden'
+ 'baseurl' : '_fieldHidden',
},
// initialize
@@ -238,6 +242,18 @@
self.app.trigger('refresh');
}
});
+ },
+
+ /** Color picker field
+ */
+ _fieldColor : function(input_def) {
+ var self = this;
+ return new ColorPicker(this.app, {
+ id : 'field-' + input_def.id,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
}
});
diff -r 8563e5b33300a733344a165dff13a1877bccde79 -r 32b5ad88cd9baf12cd0776c54437b445a0561abf static/scripts/mvc/ui/ui-color-picker.js
--- /dev/null
+++ b/static/scripts/mvc/ui/ui-color-picker.js
@@ -0,0 +1,202 @@
+// dependencies
+define(['utils/utils', 'mvc/ui/ui-misc'], function(Utils, Ui) {
+
+// plugin
+return Backbone.View.extend({
+ colors: {
+ standard: ['c00000','ff0000','ffc000','ffff00','92d050','00b050','00b0f0','0070c0','002060','7030a0'],
+ base : ['ffffff','000000','eeece1','1f497d','4f81bd','c0504d','9bbb59','8064a2','4bacc6','f79646'],
+ theme :[['f2f2f2','7f7f7f','ddd9c3','c6d9f0','dbe5f1','f2dcdb','ebf1dd','e5e0ec','dbeef3','fdeada'],
+ ['d8d8d8','595959','c4bd97','8db3e2','b8cce4','e5b9b7','d7e3bc','ccc1d9','b7dde8','fbd5b5'],
+ ['bfbfbf','3f3f3f','938953','548dd4','95b3d7','d99694','c3d69b','b2a2c7','92cddc','fac08f'],
+ ['a5a5a5','262626','494429','17365d','366092','953734','76923c','5f497a','31859b','e36c09'],
+ ['7f7f7f','0c0c0c','1d1b10','0f243e','244061','632423','4f6128','3f3151','205867','974806']]
+ },
+
+ // default options
+ optionsDefault: {
+ default_color: '#fdeada'
+ },
+
+ // initialize
+ initialize : function(options) {
+ // configure options
+ this.options = Utils.merge(options, this.optionsDefault);
+
+ // create new element
+ this.setElement(this._template());
+ this.$panel = this.$('.ui-color-picker-panel');
+ this.$view = this.$('.ui-color-picker-view');
+ this.$value = this.$('.ui-color-picker-value');
+ this.$header = this.$('.ui-color-picker-header');
+
+ // build panel
+ this._build();
+
+ // hide panel on start up
+ this.visible = false;
+
+ // set initial value
+ this.value(this.options.value);
+
+ // link boxes
+ this.$boxes = this.$('.ui-color-picker-box');
+
+ // add event handler
+ var self = this;
+ this.$boxes.on('click', function() {
+ self.value($(this).css('background-color'));
+ //self.$header.trigger('click');
+ });
+ this.$header.on('click', function() {
+ self.visible = !self.visible;
+ if (self.visible) {
+ self.$view.fadeIn('fast');
+ } else {
+ self.$view.hide();
+ }
+ });
+ },
+
+ // value
+ value : function (new_val) {
+ if (new_val !== undefined) {
+ // set default value
+ if (new_val === null) {
+ new_val = this.options.default_color;
+ }
+
+ // update color value
+ this.$value.css('background-color', new_val);
+
+ // check selected color in panel
+ this.$('.ui-color-picker-box').empty();
+ this.$(this._getValue()).html(this._templateCheck());
+
+ // trigger custom event
+ this.options.onchange && this.options.onchange(new_val);
+ }
+
+ // return current value
+ return this._getValue();
+ },
+
+ // get value from dom
+ _getValue: function() {
+ var rgb = this.$value.css('background-color');
+ rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
+ if (rgb) {
+ function hex(x) {
+ return ('0' + parseInt(x).toString(16)).slice(-2);
+ }
+ return '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
+ } else {
+ return null;
+ }
+ },
+
+ // build panel
+ _build: function() {
+ var $content = this._content({
+ label : 'Theme Colors',
+ colors : this.colors.base,
+ padding : 10
+ });
+ for (var i in this.colors.theme) {
+ var line_def = {};
+ if (i == 0) {
+ line_def['bottom'] = true;
+ } else {
+ if (i != this.colors.theme.length - 1) {
+ line_def['top'] = true;
+ line_def['bottom'] = true;
+ } else {
+ line_def['top'] = true;
+ line_def['padding'] = 5;
+ }
+ }
+ line_def['colors'] = this.colors.theme[i];
+ this._content(line_def);
+ }
+ this._content({
+ label : 'Standard Colors',
+ colors : this.colors.standard,
+ padding : 5
+ });
+ },
+
+ // create content
+ _content: function(options) {
+ // get parameters
+ var label = options.label;
+ var colors = options.colors;
+ var padding = options.padding;
+ var top = options.top;
+ var bottom = options.bottom;
+
+ // create lines
+ var $content = $(this._templateContent());
+
+ // set label
+ var $label = $content.find('.label');
+ if (options.label) {
+ $label.html(options.label);
+ } else {
+ $label.hide();
+ }
+
+ // build line
+ var $line = $content.find('.line');
+ this.$panel.append($content);
+ for (var i in colors) {
+ var $box = $(this._templateBox(colors[i]));
+ if (top) {
+ $box.css('border-top', 'none');
+ $box.css('border-top-left-radius', '0px');
+ $box.css('border-top-right-radius', '0px');
+ }
+ if (bottom) {
+ $box.css('border-bottom', 'none');
+ $box.css('border-bottom-left-radius', '0px');
+ $box.css('border-bottom-right-radius', '0px');
+ }
+ $line.append($box);
+ }
+ if (padding) {
+ $line.css('padding-bottom', padding);
+ }
+ return $content;
+ },
+
+ // check icon
+ _templateCheck: function() {
+ return '<div class="ui-color-picker-check fa fa-check"/>';
+ },
+
+ // content template
+ _templateContent: function() {
+ return '<div class="ui-color-picker-content">' +
+ '<div class="label"/>' +
+ '<div class="line"/>' +
+ '</div>';
+ },
+
+ // box template
+ _templateBox: function(color) {
+ return '<div id="' + color + '" class="ui-color-picker-box" style="background-color: #' + color + ';"/>';
+ },
+
+ // template
+ _template: function() {
+ return '<div class="ui-color-picker">' +
+ '<div class="ui-color-picker-header">' +
+ '<div class="ui-color-picker-value"/>' +
+ '<div class="ui-color-picker-label">Select a color</div>' +
+ '</div>' +
+ '<div class="ui-color-picker-view ui-input">' +
+ '<div class="ui-color-picker-panel"/>' +
+ '</div>'
+ '</div>';
+ }
+});
+});
\ No newline at end of file
diff -r 8563e5b33300a733344a165dff13a1877bccde79 -r 32b5ad88cd9baf12cd0776c54437b445a0561abf static/scripts/packed/mvc/tools/tools-parameters.js
--- a/static/scripts/packed/mvc/tools/tools-parameters.js
+++ b/static/scripts/packed/mvc/tools/tools-parameters.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-misc","mvc/tools/tools-select-content"],function(b,c,a){return Backbone.Model.extend({types:{text:"_fieldText",select:"_fieldSelect",data_column:"_fieldSelect",genomebuild:"_fieldSelect",data:"_fieldData",data_collection:"_fieldData",integer:"_fieldSlider","float":"_fieldSlider","boolean":"_fieldBoolean",drill_down:"_fieldDrilldown",hidden:"_fieldHidden",hidden_data:"_fieldHidden",baseurl:"_fieldHidden"},initialize:function(e,d){this.app=e},create:function(d){if(d.value===undefined){d.value=null}if(d.default_value===undefined){d.default_value=d.value}var f=null;var e=this.types[d.type];if(e&&typeof(this[e])==="function"){f=this[e].call(this,d)}if(!f){this.app.incompatible=true;if(d.options){f=this._fieldSelect(d)}else{f=this._fieldText(d)}console.debug("tools-form::_addRow() : Auto matched field type ("+d.type+").")}if(d.value!==undefined){f.value(d.value)}return f},_fieldData:function(d){if(!this.app.options.is_dynamic){d.info="Data input '"+d.name+"' ("+b.textify(d.extensions.toString())+")";d.value=null;return this._fieldHidden(d)}var e=this;return new a.View(this.app,{id:"field-"+d.id,extensions:d.extensions,optional:d.optional,multiple:d.multiple,type:d.type,data:d.options,onchange:function(){e.app.trigger("refresh")}})},_fieldSelect:function(d){if(!this.app.options.is_dynamic&&d.is_dynamic){return this._fieldText(d)}if(d.type=="data_column"){d.error_text="Missing columns in referenced dataset."}if(d.type=="genomebuild"){d.searchable=true}var f=[];for(var g in d.options){var h=d.options[g];f.push({label:h[0],value:h[1]})}var j=c.Select;switch(d.display){case"checkboxes":j=c.Checkbox;break;case"radio":j=c.Radio;break}var e=this;return new j.View({id:"field-"+d.id,data:f,error_text:d.error_text||"No options available",multiple:d.multiple,searchable:d.searchable,onchange:function(){e.app.trigger("refresh")}})},_fieldDrilldown:function(d){if(!this.app.options.is_dynamic&&d.is_dynamic){return this._fieldText(d)}var e=this;return new c.Drilldown.View({id:"field-"+d.id,data:d.options,display:d.display,onchange:function(){e.app.trigger("refresh")}})},_fieldText:function(d){if(d.options){d.area=d.multiple;if(!b.validate(d.value)){d.value=""}else{if(d.value instanceof Array){d.value=value.toString()}else{d.value=String(d.value).replace(/[\[\]'"\s]/g,"");if(d.multiple){d.value=d.value.replace(/,/g,"\n")}}}}var e=this;return new c.Input({id:"field-"+d.id,area:d.area,onchange:function(){e.app.trigger("refresh")}})},_fieldSlider:function(d){var e=this;return new c.Slider.View({id:"field-"+d.id,precise:d.type=="float",min:d.min,max:d.max,onchange:function(){e.app.trigger("refresh")}})},_fieldHidden:function(d){return new c.Hidden({id:"field-"+d.id,info:d.info})},_fieldBoolean:function(d){var e=this;return new c.RadioButton.View({id:"field-"+d.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:function(){e.app.trigger("refresh")}})}});return{View:View}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-misc","mvc/tools/tools-select-content","mvc/ui/ui-color-picker"],function(c,d,a,b){return Backbone.Model.extend({types:{text:"_fieldText",select:"_fieldSelect",data_column:"_fieldSelect",genomebuild:"_fieldSelect",data:"_fieldData",data_collection:"_fieldData",integer:"_fieldSlider","float":"_fieldSlider","boolean":"_fieldBoolean",drill_down:"_fieldDrilldown",color:"_fieldColor",hidden:"_fieldHidden",hidden_data:"_fieldHidden",baseurl:"_fieldHidden",},initialize:function(f,e){this.app=f},create:function(e){if(e.value===undefined){e.value=null}if(e.default_value===undefined){e.default_value=e.value}var g=null;var f=this.types[e.type];if(f&&typeof(this[f])==="function"){g=this[f].call(this,e)}if(!g){this.app.incompatible=true;if(e.options){g=this._fieldSelect(e)}else{g=this._fieldText(e)}console.debug("tools-form::_addRow() : Auto matched field type ("+e.type+").")}if(e.value!==undefined){g.value(e.value)}return g},_fieldData:function(e){if(!this.app.options.is_dynamic){e.info="Data input '"+e.name+"' ("+c.textify(e.extensions.toString())+")";e.value=null;return this._fieldHidden(e)}var f=this;return new a.View(this.app,{id:"field-"+e.id,extensions:e.extensions,optional:e.optional,multiple:e.multiple,type:e.type,data:e.options,onchange:function(){f.app.trigger("refresh")}})},_fieldSelect:function(e){if(!this.app.options.is_dynamic&&e.is_dynamic){return this._fieldText(e)}if(e.type=="data_column"){e.error_text="Missing columns in referenced dataset."}if(e.type=="genomebuild"){e.searchable=true}var g=[];for(var h in e.options){var j=e.options[h];g.push({label:j[0],value:j[1]})}var k=d.Select;switch(e.display){case"checkboxes":k=d.Checkbox;break;case"radio":k=d.Radio;break}var f=this;return new k.View({id:"field-"+e.id,data:g,error_text:e.error_text||"No options available",multiple:e.multiple,searchable:e.searchable,onchange:function(){f.app.trigger("refresh")}})},_fieldDrilldown:function(e){if(!this.app.options.is_dynamic&&e.is_dynamic){return this._fieldText(e)}var f=this;return new d.Drilldown.View({id:"field-"+e.id,data:e.options,display:e.display,onchange:function(){f.app.trigger("refresh")}})},_fieldText:function(e){if(e.options){e.area=e.multiple;if(!c.validate(e.value)){e.value=""}else{if(e.value instanceof Array){e.value=value.toString()}else{e.value=String(e.value).replace(/[\[\]'"\s]/g,"");if(e.multiple){e.value=e.value.replace(/,/g,"\n")}}}}var f=this;return new d.Input({id:"field-"+e.id,area:e.area,onchange:function(){f.app.trigger("refresh")}})},_fieldSlider:function(e){var f=this;return new d.Slider.View({id:"field-"+e.id,precise:e.type=="float",min:e.min,max:e.max,onchange:function(){f.app.trigger("refresh")}})},_fieldHidden:function(e){return new d.Hidden({id:"field-"+e.id,info:e.info})},_fieldBoolean:function(e){var f=this;return new d.RadioButton.View({id:"field-"+e.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:function(){f.app.trigger("refresh")}})},_fieldColor:function(e){var f=this;return new b(this.app,{id:"field-"+e.id,onchange:function(){f.app.trigger("refresh")}})}});return{View:View}});
\ No newline at end of file
diff -r 8563e5b33300a733344a165dff13a1877bccde79 -r 32b5ad88cd9baf12cd0776c54437b445a0561abf static/scripts/packed/mvc/ui/ui-color-picker.js
--- /dev/null
+++ b/static/scripts/packed/mvc/ui/ui-color-picker.js
@@ -0,0 +1,1 @@
+define(["utils/utils","mvc/ui/ui-misc"],function(a,b){return Backbone.View.extend({colors:{standard:["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"],base:["ffffff","000000","eeece1","1f497d","4f81bd","c0504d","9bbb59","8064a2","4bacc6","f79646"],theme:[["f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada"],["d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5"],["bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f"],["a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09"],["7f7f7f","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"]]},optionsDefault:{default_color:"#fdeada"},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template());this.$panel=this.$(".ui-color-picker-panel");this.$view=this.$(".ui-color-picker-view");this.$value=this.$(".ui-color-picker-value");this.$header=this.$(".ui-color-picker-header");this._build();this.visible=false;this.value(this.options.value);this.$boxes=this.$(".ui-color-picker-box");var c=this;this.$boxes.on("click",function(){c.value($(this).css("background-color"))});this.$header.on("click",function(){c.visible=!c.visible;if(c.visible){c.$view.fadeIn("fast")}else{c.$view.hide()}})},value:function(c){if(c!==undefined){if(c===null){c=this.options.default_color}this.$value.css("background-color",c);this.$(".ui-color-picker-box").empty();this.$(this._getValue()).html(this._templateCheck());this.options.onchange&&this.options.onchange(c)}return this._getValue()},_getValue:function(){var c=this.$value.css("background-color");c=c.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(c){function d(e){return("0"+parseInt(e).toString(16)).slice(-2)}return"#"+d(c[1])+d(c[2])+d(c[3])}else{return null}},_build:function(){var d=this._content({label:"Theme Colors",colors:this.colors.base,padding:10});for(var e in this.colors.theme){var c={};if(e==0){c.bottom=true}else{if(e!=this.colors.theme.length-1){c.top=true;c.bottom=true}else{c.top=true;c.padding=5}}c.colors=this.colors.theme[e];this._content(c)}this._content({label:"Standard Colors",colors:this.colors.standard,padding:5})},_content:function(n){var l=n.label;var d=n.colors;var k=n.padding;var h=n.top;var c=n.bottom;var f=$(this._templateContent());var j=f.find(".label");if(n.label){j.html(n.label)}else{j.hide()}var m=f.find(".line");this.$panel.append(f);for(var g in d){var e=$(this._templateBox(d[g]));if(h){e.css("border-top","none");e.css("border-top-left-radius","0px");e.css("border-top-right-radius","0px")}if(c){e.css("border-bottom","none");e.css("border-bottom-left-radius","0px");e.css("border-bottom-right-radius","0px")}m.append(e)}if(k){m.css("padding-bottom",k)}return f},_templateCheck:function(){return'<div class="ui-color-picker-check fa fa-check"/>'},_templateContent:function(){return'<div class="ui-color-picker-content"><div class="label"/><div class="line"/></div>'},_templateBox:function(c){return'<div id="'+c+'" class="ui-color-picker-box" style="background-color: #'+c+';"/>'},_template:function(){return'<div class="ui-color-picker"><div class="ui-color-picker-header"><div class="ui-color-picker-value"/><div class="ui-color-picker-label">Select a color</div></div><div class="ui-color-picker-view ui-input"><div class="ui-color-picker-panel"/></div>';"</div>"}})});
\ No newline at end of file
diff -r 8563e5b33300a733344a165dff13a1877bccde79 -r 32b5ad88cd9baf12cd0776c54437b445a0561abf static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -1453,6 +1453,11 @@
.ui-select .select2-container{width:100%}
.ui-select select{position:relative;top:0px;height:27px;width:100%;padding-left:5px;padding-right:20px;cursor:pointer;background:transparent;-webkit-appearance:none;border:1px solid #bfbfbf;-moz-border-radius:3px;border-radius:3px}
.ui-select-content .ui-options{float:left;padding-top:2px}
+.ui-color-picker .ui-color-picker-header{cursor:pointer}
+.ui-color-picker .ui-color-picker-value{float:left;border-radius:3px;border:solid 1px #000000;width:12px;height:12px;margin-bottom:10px;margin-right:5px}
+.ui-color-picker .ui-color-picker-label{float:left;line-height:1.2em}
+.ui-color-picker .ui-color-picker-view{height:100%;overflow:auto;display:none;float:left}.ui-color-picker .ui-color-picker-view .ui-color-picker-panel{height:100%;overflow:auto;width:230px}.ui-color-picker .ui-color-picker-view .ui-color-picker-panel .ui-color-picker-content{clear:both;margin-bottom:15px}.ui-color-picker .ui-color-picker-view .ui-color-picker-panel .ui-color-picker-content .label{padding-bottom:2px}
+.ui-color-picker .ui-color-picker-view .ui-color-picker-panel .ui-color-picker-content .line{clear:both}.ui-color-picker .ui-color-picker-view .ui-color-picker-panel .ui-color-picker-content .line .ui-color-picker-box{cursor:pointer;float:left;margin-right:5px;border:solid 1px #c0c0c0;width:15px;height:15px;border-radius:2px}.ui-color-picker .ui-color-picker-view .ui-color-picker-panel .ui-color-picker-content .line .ui-color-picker-box .ui-color-picker-check{color:black;font-size:1.2em;position:relative;left:1px}
.libraryRow{background-color:#ebd9b2}
.datasetHighlighted{background-color:#f9f9f9}
.libraryItemDeleted-True{font-style:italic}
diff -r 8563e5b33300a733344a165dff13a1877bccde79 -r 32b5ad88cd9baf12cd0776c54437b445a0561abf static/style/src/less/ui.less
--- a/static/style/src/less/ui.less
+++ b/static/style/src/less/ui.less
@@ -440,4 +440,59 @@
float: left;
padding-top: 2px;
}
+}
+
+.ui-color-picker {
+ .ui-color-picker-header {
+ cursor: pointer;
+ }
+ .ui-color-picker-value {
+ float: left;
+ border-radius: 3px;
+ border: solid 1px #000000;
+ width: 12px;
+ height: 12px;
+ margin-bottom: 10px;
+ margin-right: 5px;
+ }
+ .ui-color-picker-label {
+ float: left;
+ line-height: 1.2em;
+ }
+ .ui-color-picker-view {
+ height: 100%;
+ overflow: auto;
+ display: none;
+ float: left;
+ .ui-color-picker-panel {
+ height: 100%;
+ overflow: auto;
+ width: 230px;
+ .ui-color-picker-content {
+ clear: both;
+ margin-bottom: 15px;
+ .label {
+ padding-bottom: 2px;
+ }
+ .line {
+ clear: both;
+ .ui-color-picker-box {
+ cursor: pointer;
+ float: left;
+ margin-right: 5px;
+ border: solid 1px #c0c0c0;
+ width: 15px;
+ height: 15px;
+ border-radius: 2px;
+ .ui-color-picker-check {
+ color: black;
+ font-size: 1.2em;
+ position: relative;
+ left: 1px;
+ }
+ }
+ }
+ }
+ }
+ }
}
\ 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.
1
0
commit/galaxy-central: carlfeberhard: UI, history multi-view: fix size sorting, add more orders, rework UI for orders
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/8563e5b33300/
Changeset: 8563e5b33300
User: carlfeberhard
Date: 2015-02-12 22:51:45+00:00
Summary: UI, history multi-view: fix size sorting, add more orders, rework UI for orders
Affected #: 3 files
diff -r 658eb245347822b95722b4a679d1aeb93da39890 -r 8563e5b33300a733344a165dff13a1877bccde79 client/galaxy/scripts/mvc/history/multi-panel.js
--- a/client/galaxy/scripts/mvc/history/multi-panel.js
+++ b/client/galaxy/scripts/mvc/history/multi-panel.js
@@ -400,6 +400,7 @@
/** the order that the collection is rendered in */
this.order = options.order || 'update';
+ this._initSortOrders();
/** named ajax queue for loading hdas */
this.hdaQueue = new ajaxQueue.NamedAjaxQueue( [], false );
@@ -416,6 +417,47 @@
this.setUpListeners();
},
+ _initSortOrders : function(){
+ function _comparator( getter, options ){
+ return function __comparator( a, b, currentHistoryId ){
+ // current always first
+ if( a.id === currentHistoryId ){ return -1; }
+ if( b.id === currentHistoryId ){ return 1; }
+ // then compare by an attribute
+ a = getter( a );
+ b = getter( b );
+ return options.asc?
+ ( ( a === b )?( 0 ):( a > b ? 1 : -1 ) ):
+ ( ( a === b )?( 0 ):( a > b ? -1 : 1 ) );
+ };
+ }
+
+ this.sortOrders = {
+ // default
+ update : {
+ text: _l( 'most recent first' ),
+ fn: _comparator( function( h ){ return Date( h.get( 'update_time' ) ); }, { asc : false })
+ },
+ 'name' : {
+ text: _l( 'name, a to z' ),
+ fn: _comparator( function( h ){ return h.get( 'name' ); }, { asc : true })
+ },
+ 'name-dsc' : {
+ text: _l( 'name, z to a' ),
+ fn: _comparator( function( h ){ return h.get( 'name' ); }, { asc : false })
+ },
+ 'size' : {
+ text: _l( 'size, large to small' ),
+ fn: _comparator( function( h ){ return h.get( 'size' ); }, { asc : false })
+ },
+ 'size-dsc' : {
+ text: _l( 'size, small to large' ),
+ fn: _comparator( function( h ){ return h.get( 'size' ); }, { asc : true })
+ }
+ };
+ return this.sortOrders;
+ },
+
/** Set up reflexive listeners */
setUpListeners : function setUpListeners(){
//var multipanel = this;
@@ -497,46 +539,23 @@
* (sorting the collection will re-render the panel)
*/
sortCollection : function( order, options ){
- order = order || this.order;
- var currentHistoryId = this.currentHistoryId;
+ if( !( order in this.sortOrders ) ){
+ order = 'update';
+ }
+ this.order = order;
+ var currentHistoryId = this.currentHistoryId,
+ sortOrder = this.sortOrders[ order ];
- //note: h.id !== currentHistoryId allows the sort to put the current history first
- switch( order ){
- case 'name':
- //TODO: we can use a 2 arg version and return 1/0/-1
- //this.collection.comparator = function( h1, h2 ){
- this.collection.comparator = function( h ){
- //TODO: this won't do reverse order well
- return [ h.id !== currentHistoryId, h.get( 'name' ).toLowerCase() ];
- };
- break;
- case 'size':
- this.collection.comparator = function( h ){
- return [ h.id !== currentHistoryId, h.get( 'size' ) ];
- };
- break;
- default:
- this.collection.comparator = function( h ){
- return [ h.id !== currentHistoryId, Date( h.get( 'update_time' ) ) ];
- };
- }
+ this.collection.comparator = function __comparator( a, b ){
+ return sortOrder.fn( a, b, currentHistoryId );
+ };
+ this.$( '.current-order' ).text( sortOrder.text );
+
//NOTE: auto fires 'sort' from collection
this.collection.sort( options );
return this.collection;
},
- /** Set the sort order and re-sort */
- setOrder : function( order ){
- if( [ 'update', 'name', 'size' ].indexOf( order ) === -1 ){
- order = 'update';
- }
- this.order = order;
- this.trigger( 'order:change', order, this );
- this.$( '.current-order' ).text( order );
- this.sortCollection();
- return this;
- },
-
/** create a new history and set it to current */
create : function( ev ){
return this.collection.create({ current: true });
@@ -806,13 +825,9 @@
'click .done.btn' : 'close',
// creates a new empty history and makes it current
'click .create-new.btn' : 'create',
-
'click #include-deleted' : '_clickToggleDeletedHistories',
// these change the collection and column sort order
- 'click .order .order-update' : function( e ){ this.setOrder( 'update' ); },
- 'click .order .order-name' : function( e ){ this.setOrder( 'name' ); },
- 'click .order .order-size' : function( e ){ this.setOrder( 'size' ); },
-
+ 'click .order .set-order' : '_chooseOrder',
'click #toggle-deleted' : '_clickToggleDeletedDatasets',
'click #toggle-hidden' : '_clickToggleHiddenDatasets'
@@ -868,6 +883,11 @@
});
},
+ _chooseOrder : function( ev ){
+ var orderKey = $( ev.currentTarget ).data( 'order' );
+ this.sortCollection( orderKey );
+ },
+
/** Set up any view plugins */
setUpBehaviors : function(){
var multipanel = this;
@@ -1041,29 +1061,28 @@
optionsPopoverTemplate : _.template([
'<div class="more-options">',
+
+ '<div class="order btn-group">',
+ '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
+ _l( 'Order histories by' ) + ' ',
+ '<span class="current-order"><%= view.sortOrders[ view.order ].text %></span> ',
+ '<span class="caret"></span>',
+ '</button>',
+ '<ul class="dropdown-menu" role="menu">',
+ '<% _.each( view.sortOrders, function( order, key ){ %>',
+ '<li><a href="javascript:void(0);" class="set-order" data-order="<%= key %>">',
+ '<%= order.text %>',
+ '</a></li>',
+ '<% }); %>',
+ '</ul>',
+ '</div>',
+
'<div class="checkbox"><label><input id="include-deleted" type="checkbox"',
'<%= view.collection.includeDeleted? " checked" : "" %>>',
_l( 'Include deleted histories' ),
'</label></div>',
- '<div class="order btn-group">',
- '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
- _l( 'Order histories by' ) + ' ',
- '<span class="current-order"><%= view.order %></span> ',
- '<span class="caret"></span>',
- '</button>',
- '<ul class="dropdown-menu" role="menu">',
- '<li><a href="javascript:void(0);" class="order-update">',
- _l( 'Time of last update' ),
- '</a></li>',
- '<li><a href="javascript:void(0);" class="order-name">',
- _l( 'Name' ),
- '</a></li>',
- '<li><a href="javascript:void(0);" class="order-size">',
- _l( 'Size' ),
- '</a></li>',
- '</ul>',
- '</div>',
+ '<hr />',
'<div class="checkbox"><label><input id="toggle-deleted" type="checkbox">',
_l( 'Include deleted datasets' ),
diff -r 658eb245347822b95722b4a679d1aeb93da39890 -r 8563e5b33300a733344a165dff13a1877bccde79 static/scripts/mvc/history/multi-panel.js
--- a/static/scripts/mvc/history/multi-panel.js
+++ b/static/scripts/mvc/history/multi-panel.js
@@ -400,6 +400,7 @@
/** the order that the collection is rendered in */
this.order = options.order || 'update';
+ this._initSortOrders();
/** named ajax queue for loading hdas */
this.hdaQueue = new ajaxQueue.NamedAjaxQueue( [], false );
@@ -416,6 +417,47 @@
this.setUpListeners();
},
+ _initSortOrders : function(){
+ function _comparator( getter, options ){
+ return function __comparator( a, b, currentHistoryId ){
+ // current always first
+ if( a.id === currentHistoryId ){ return -1; }
+ if( b.id === currentHistoryId ){ return 1; }
+ // then compare by an attribute
+ a = getter( a );
+ b = getter( b );
+ return options.asc?
+ ( ( a === b )?( 0 ):( a > b ? 1 : -1 ) ):
+ ( ( a === b )?( 0 ):( a > b ? -1 : 1 ) );
+ };
+ }
+
+ this.sortOrders = {
+ // default
+ update : {
+ text: _l( 'most recent first' ),
+ fn: _comparator( function( h ){ return Date( h.get( 'update_time' ) ); }, { asc : false })
+ },
+ 'name' : {
+ text: _l( 'name, a to z' ),
+ fn: _comparator( function( h ){ return h.get( 'name' ); }, { asc : true })
+ },
+ 'name-dsc' : {
+ text: _l( 'name, z to a' ),
+ fn: _comparator( function( h ){ return h.get( 'name' ); }, { asc : false })
+ },
+ 'size' : {
+ text: _l( 'size, large to small' ),
+ fn: _comparator( function( h ){ return h.get( 'size' ); }, { asc : false })
+ },
+ 'size-dsc' : {
+ text: _l( 'size, small to large' ),
+ fn: _comparator( function( h ){ return h.get( 'size' ); }, { asc : true })
+ }
+ };
+ return this.sortOrders;
+ },
+
/** Set up reflexive listeners */
setUpListeners : function setUpListeners(){
//var multipanel = this;
@@ -497,46 +539,23 @@
* (sorting the collection will re-render the panel)
*/
sortCollection : function( order, options ){
- order = order || this.order;
- var currentHistoryId = this.currentHistoryId;
+ if( !( order in this.sortOrders ) ){
+ order = 'update';
+ }
+ this.order = order;
+ var currentHistoryId = this.currentHistoryId,
+ sortOrder = this.sortOrders[ order ];
- //note: h.id !== currentHistoryId allows the sort to put the current history first
- switch( order ){
- case 'name':
- //TODO: we can use a 2 arg version and return 1/0/-1
- //this.collection.comparator = function( h1, h2 ){
- this.collection.comparator = function( h ){
- //TODO: this won't do reverse order well
- return [ h.id !== currentHistoryId, h.get( 'name' ).toLowerCase() ];
- };
- break;
- case 'size':
- this.collection.comparator = function( h ){
- return [ h.id !== currentHistoryId, h.get( 'size' ) ];
- };
- break;
- default:
- this.collection.comparator = function( h ){
- return [ h.id !== currentHistoryId, Date( h.get( 'update_time' ) ) ];
- };
- }
+ this.collection.comparator = function __comparator( a, b ){
+ return sortOrder.fn( a, b, currentHistoryId );
+ };
+ this.$( '.current-order' ).text( sortOrder.text );
+
//NOTE: auto fires 'sort' from collection
this.collection.sort( options );
return this.collection;
},
- /** Set the sort order and re-sort */
- setOrder : function( order ){
- if( [ 'update', 'name', 'size' ].indexOf( order ) === -1 ){
- order = 'update';
- }
- this.order = order;
- this.trigger( 'order:change', order, this );
- this.$( '.current-order' ).text( order );
- this.sortCollection();
- return this;
- },
-
/** create a new history and set it to current */
create : function( ev ){
return this.collection.create({ current: true });
@@ -806,13 +825,9 @@
'click .done.btn' : 'close',
// creates a new empty history and makes it current
'click .create-new.btn' : 'create',
-
'click #include-deleted' : '_clickToggleDeletedHistories',
// these change the collection and column sort order
- 'click .order .order-update' : function( e ){ this.setOrder( 'update' ); },
- 'click .order .order-name' : function( e ){ this.setOrder( 'name' ); },
- 'click .order .order-size' : function( e ){ this.setOrder( 'size' ); },
-
+ 'click .order .set-order' : '_chooseOrder',
'click #toggle-deleted' : '_clickToggleDeletedDatasets',
'click #toggle-hidden' : '_clickToggleHiddenDatasets'
@@ -868,6 +883,11 @@
});
},
+ _chooseOrder : function( ev ){
+ var orderKey = $( ev.currentTarget ).data( 'order' );
+ this.sortCollection( orderKey );
+ },
+
/** Set up any view plugins */
setUpBehaviors : function(){
var multipanel = this;
@@ -1041,29 +1061,28 @@
optionsPopoverTemplate : _.template([
'<div class="more-options">',
+
+ '<div class="order btn-group">',
+ '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
+ _l( 'Order histories by' ) + ' ',
+ '<span class="current-order"><%= view.sortOrders[ view.order ].text %></span> ',
+ '<span class="caret"></span>',
+ '</button>',
+ '<ul class="dropdown-menu" role="menu">',
+ '<% _.each( view.sortOrders, function( order, key ){ %>',
+ '<li><a href="javascript:void(0);" class="set-order" data-order="<%= key %>">',
+ '<%= order.text %>',
+ '</a></li>',
+ '<% }); %>',
+ '</ul>',
+ '</div>',
+
'<div class="checkbox"><label><input id="include-deleted" type="checkbox"',
'<%= view.collection.includeDeleted? " checked" : "" %>>',
_l( 'Include deleted histories' ),
'</label></div>',
- '<div class="order btn-group">',
- '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
- _l( 'Order histories by' ) + ' ',
- '<span class="current-order"><%= view.order %></span> ',
- '<span class="caret"></span>',
- '</button>',
- '<ul class="dropdown-menu" role="menu">',
- '<li><a href="javascript:void(0);" class="order-update">',
- _l( 'Time of last update' ),
- '</a></li>',
- '<li><a href="javascript:void(0);" class="order-name">',
- _l( 'Name' ),
- '</a></li>',
- '<li><a href="javascript:void(0);" class="order-size">',
- _l( 'Size' ),
- '</a></li>',
- '</ul>',
- '</div>',
+ '<hr />',
'<div class="checkbox"><label><input id="toggle-deleted" type="checkbox">',
_l( 'Include deleted datasets' ),
diff -r 658eb245347822b95722b4a679d1aeb93da39890 -r 8563e5b33300a733344a165dff13a1877bccde79 static/scripts/packed/mvc/history/multi-panel.js
--- a/static/scripts/packed/mvc/history/multi-panel.js
+++ b/static/scripts/packed/mvc/history/multi-panel.js
@@ -1,1 +1,1 @@
-define(["mvc/history/history-model","mvc/history/history-panel-edit","mvc/base-mvc","utils/ajax-queue","ui/mode-button","ui/search-input"],function(d,l,z,a){function g(I,E){E=E||{};if(!(Galaxy&&Galaxy.modal)){return I.copy()}var F=I.get("name"),C="Copy of '"+F+"'";function D(K){if(!K){if(!Galaxy.modal.$("#invalid-title").size()){var J=$("<p/>").attr("id","invalid-title").css({color:"red","margin-top":"8px"}).addClass("bg-danger").text(_l("Please enter a valid history title"));Galaxy.modal.$(".modal-body").append(J)}return false}return K}function G(J){var K=$('<p><span class="fa fa-spinner fa-spin"></span> Copying history...</p>').css("margin-top","8px");Galaxy.modal.$(".modal-body").append(K);I.copy(true,J).fail(function(){alert(_l("History could not be copied. Please contact a Galaxy administrator"))}).always(function(){Galaxy.modal.hide()})}function H(){var J=Galaxy.modal.$("#copy-modal-title").val();if(!D(J)){return}G(J)}Galaxy.modal.show(_.extend({title:_l("Copying history")+' "'+F+'"',body:$(['<label for="copy-modal-title">',_l("Enter a title for the copied history"),":","</label><br />",'<input id="copy-modal-title" class="form-control" style="width: 100%" value="',C,'" />'].join("")),buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:H}},E));$("#copy-modal-title").focus().select();$("#copy-modal-title").on("keydown",function(J){if(J.keyCode===13){H()}})}var B=Backbone.View.extend(z.LoggableMixin).extend({tagName:"div",className:"history-column flex-column flex-row-container",id:function q(){if(!this.model){return""}return"history-column-"+this.model.get("id")},initialize:function c(C){C=C||{};this.panel=C.panel||this.createPanel(C);this.setUpListeners()},createPanel:function u(D){D=_.extend({model:this.model,dragItems:true},D);var C=new l.HistoryPanelEdit(D);C._renderEmptyMessage=this.__patch_renderEmptyMessage;return C},__patch_renderEmptyMessage:function(E){var D=this,F=_.chain(this.model.get("state_ids")).values().flatten().value().length,C=D.$emptyMessage(E);if(!_.isEmpty(D.hdaViews)){C.hide()}else{if(F&&!this.model.contents.length){C.empty().append($('<span class="fa fa-spinner fa-spin"></span><i>loading datasets...</i>')).show()}else{if(D.searchFor){C.text(D.noneFoundMsg).show()}else{C.text(D.emptyMsg).show()}}}return C},setUpListeners:function f(){var C=this;this.once("rendered",function(){C.trigger("rendered:initial",C)});this.setUpPanelListeners()},setUpPanelListeners:function k(){var C=this;this.listenTo(this.panel,{rendered:function(){C.trigger("rendered",C)}},this)},inView:function(C,D){var F=this.$el.offset().left,E=F+this.$el.width();if(E<C){return false}if(F>D){return false}return true},$panel:function e(){return this.$(".history-panel")},render:function A(D){D=(D!==undefined)?(D):("fast");var C=this.model?this.model.toJSON():{};this.$el.html(this.template(C));this.renderPanel(D);this.setUpBehaviors();return this},setUpBehaviors:function v(){},template:function w(C){C=_.extend(C||{},{isCurrentHistory:this.currentHistory});return $(['<div class="panel-controls clear flex-row">',this.controlsLeftTemplate(C),this.controlsRightTemplate(C),"</div>",'<div class="inner flex-row flex-column-container">','<div id="history-',C.id,'" class="history-column history-panel flex-column"></div>',"</div>"].join(""))},renderPanel:function h(C){C=(C!==undefined)?(C):("fast");this.panel.setElement(this.$panel()).render(C);if(this.currentHistory){this.panel.$list().before(this.panel._renderDropTargetHelp())}return this},events:{"click .switch-to.btn":function(){this.model.setAsCurrent()},"click .delete-history":function(){var C=this;this.model._delete().fail(function(F,D,E){alert(_l("Could not delete the history")+":\n"+E)}).done(function(D){C.render()})},"click .undelete-history":function(){var C=this;this.model.undelete().fail(function(F,D,E){alert(_l("Could not undelete the history")+":\n"+E)}).done(function(D){C.render()})},"click .purge-history":function(){if(confirm(_l("This will permanently remove the data. Are you sure?"))){var C=this;this.model.purge().fail(function(F,D,E){alert(_l("Could not purge the history")+":\n"+E)}).done(function(D){C.render()})}},"click .copy-history":"copy"},copy:function s(){g(this.model)},controlsLeftTemplate:_.template(['<div class="pull-left">',"<% if( history.isCurrentHistory ){ %>",'<strong class="current-label">',_l("Current History"),"</strong>","<% } else { %>",'<button class="switch-to btn btn-default">',_l("Switch to"),"</button>","<% } %>","</div>"].join(""),{variable:"history"}),controlsRightTemplate:_.template(['<div class="pull-right">',"<% if( !history.purged ){ %>",'<div class="panel-menu order btn-group">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">','<span class="caret"></span>',"</button>",'<ul class="dropdown-menu pull-right" role="menu">',"<% if( !history.deleted ){ %>",'<li><a href="javascript:void(0);" class="copy-history">',_l("Copy"),"</a></li>",'<li><a href="javascript:void(0);" class="delete-history">',_l("Delete"),"</a></li>","<% } else /* if is deleted */ { %>",'<li><a href="javascript:void(0);" class="undelete-history">',_l("Undelete"),"</a></li>","<% } %>","</ul>","<% } %>","</div>","</div>"].join(""),{variable:"history"}),toString:function(){return"HistoryPanelColumn("+(this.panel?this.panel:"")+")"}});var m=Backbone.View.extend(z.LoggableMixin).extend({className:"multi-history-columns",initialize:function c(C){C=C||{};this.log(this+".init",C);if(!C.currentHistoryId){throw new Error(this+" requires a currentHistoryId in the options")}this.currentHistoryId=C.currentHistoryId;this.options={columnWidth:312,borderWidth:1,columnGap:8,headerHeight:29,footerHeight:0,controlsHeight:20};this.order=C.order||"update";this.hdaQueue=new a.NamedAjaxQueue([],false);this.collection=null;this.setCollection(C.histories||[]);this.columnMap={};this.createColumns(C.columnOptions);this.setUpListeners()},setUpListeners:function f(){},setCollection:function y(D){var C=this;C.stopListening(C.collection);C.collection=D;C.sortCollection(C.order,{silent:true});C.setUpCollectionListeners();C.trigger("new-collection",C);return C},setUpCollectionListeners:function(){var C=this,D=C.collection;C.listenTo(D,{add:C.addAsCurrentColumn,"set-as-current":C.setCurrentHistory,"change:deleted":C.handleDeletedHistory,sort:function(){C.renderColumns(0)}})},setCurrentHistory:function p(D){var C=this.columnMap[this.currentHistoryId];if(C){C.currentHistory=false;C.$el.height("")}this.currentHistoryId=D.id;var E=this.columnMap[this.currentHistoryId];E.currentHistory=true;this.sortCollection();multipanel._recalcFirstColumnHeight();return E},handleDeletedHistory:function b(D){if(D.get("deleted")){this.log("handleDeletedHistory",this.collection.includeDeleted,D);var C=this;column=C.columnMap[D.id];if(!column){return}if(column.model.id===this.currentHistoryId){}else{if(!C.collection.includeDeleted){C.removeColumn(column)}}}},sortCollection:function(C,D){C=C||this.order;var E=this.currentHistoryId;switch(C){case"name":this.collection.comparator=function(F){return[F.id!==E,F.get("name").toLowerCase()]};break;case"size":this.collection.comparator=function(F){return[F.id!==E,F.get("size")]};break;default:this.collection.comparator=function(F){return[F.id!==E,Date(F.get("update_time"))]}}this.collection.sort(D);return this.collection},setOrder:function(C){if(["update","name","size"].indexOf(C)===-1){C="update"}this.order=C;this.trigger("order:change",C,this);this.$(".current-order").text(C);this.sortCollection();return this},create:function(C){return this.collection.create({current:true})},createColumns:function r(D){D=D||{};var C=this;this.columnMap={};C.collection.each(function(E,F){var G=C.createColumn(E,D);C.columnMap[E.id]=G})},createColumn:function t(E,C){C=_.extend({},C,{model:E});var D=new B(C);if(E.id===this.currentHistoryId){D.currentHistory=true}this.setUpColumnListeners(D);return D},sortedFilteredColumns:function(C){C=C||this.filters;if(!C||!C.length){return this.sortedColumns()}var D=this;return D.sortedColumns().filter(function(G,F){var E=G.currentHistory||_.every(C.map(function(H){return H.call(G)}));return E})},sortedColumns:function(){var D=this;var C=this.collection.map(function(F,E){return D.columnMap[F.id]});return C},addColumn:function o(E,C){C=C!==undefined?C:true;var D=this.createColumn(E);this.columnMap[E.id]=D;if(C){this.renderColumns()}return D},addAsCurrentColumn:function o(E){var D=this,C=this.addColumn(E,false);this.setCurrentHistory(E);C.once("rendered",function(){D.queueHdaFetch(C)});return C},removeColumn:function x(E,D){D=D!==undefined?D:true;this.log("removeColumn",E);if(!E){return}var F=this,C=this.options.columnWidth+this.options.columnGap;E.$el.fadeOut("fast",function(){if(D){$(this).remove();F.$(".middle").width(F.$(".middle").width()-C);F.checkColumnsInView();F._recalcFirstColumnHeight()}F.stopListening(E.panel);F.stopListening(E);delete F.columnMap[E.model.id];E.remove()})},setUpColumnListeners:function n(C){var D=this;D.listenTo(C,{"in-view":D.queueHdaFetch});D.listenTo(C.panel,{"view:draggable:dragstart":function(H,F,E,G){D._dropData=JSON.parse(H.dataTransfer.getData("text"));D.currentColumnDropTargetOn()},"view:draggable:dragend":function(H,F,E,G){D._dropData=null;D.currentColumnDropTargetOff()},"droptarget:drop":function(G,H,F){var I=D._dropData.filter(function(J){return(_.isObject(J)&&J.id&&J.model_class==="HistoryDatasetAssociation")});D._dropData=null;var E=new a.NamedAjaxQueue();I.forEach(function(J){E.add({name:"copy-"+J.id,fn:function(){return F.model.contents.copy(J.id)}})});E.start();E.done(function(J){F.model.fetch()})}})},columnMapLength:function(){return Object.keys(this.columnMap).length},render:function A(D){D=D!==undefined?D:this.fxSpeed;var C=this;C.log(C+".render");C.$el.html(C.mainTemplate(C));C.renderColumns(D);C.setUpBehaviors();C.trigger("rendered",C);return C},renderColumns:function j(F){F=F!==undefined?F:this.fxSpeed;var E=this,C=E.sortedFilteredColumns();E.$(".middle").width(C.length*(this.options.columnWidth+this.options.columnGap)+this.options.columnGap+16);var D=E.$(".middle");D.empty();C.forEach(function(H,G){H.$el.appendTo(D);H.delegateEvents();E.renderColumn(H,F)});if(this.searchFor&&C.length<=1){}else{E.checkColumnsInView();this._recalcFirstColumnHeight()}return C},renderColumn:function(C,D){D=D!==undefined?D:this.fxSpeed;return C.render(D)},queueHdaFetch:function i(E){if(E.model.contents.length===0&&!E.model.get("empty")){var C={},D=_.values(E.panel.storage.get("expandedIds")).join();if(D){C.dataset_details=D}this.hdaQueue.add({name:E.model.id,fn:function(){var F=E.model.contents.fetch({data:C,silent:true});return F.done(function(G){E.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},queueHdaFetchDetails:function(C){if((C.model.contents.length===0&&!C.model.get("empty"))||(!C.model.contents.haveDetails())){this.hdaQueue.add({name:C.model.id,fn:function(){var D=C.model.contents.fetch({data:{details:"all"},silent:true});return D.done(function(E){C.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},renderInfo:function(C){this.$(".header .header-info").text(C)},events:{"click .done.btn":"close","click .create-new.btn":"create","click #include-deleted":"_clickToggleDeletedHistories","click .order .order-update":function(C){this.setOrder("update")},"click .order .order-name":function(C){this.setOrder("name")},"click .order .order-size":function(C){this.setOrder("size")},"click #toggle-deleted":"_clickToggleDeletedDatasets","click #toggle-hidden":"_clickToggleHiddenDatasets"},close:function(D){var C="/";if(Galaxy&&Galaxy.options&&Galaxy.options.root){C=Galaxy.options.root}else{if(galaxy_config&&galaxy_config.root){C=galaxy_config.root}}window.location=C},_clickToggleDeletedHistories:function(C){return this.toggleDeletedHistories($(C.currentTarget).is(":checked"))},toggleDeletedHistories:function(C){if(C){window.location=Galaxy.options.root+"history/view_multiple?include_deleted_histories=True"}else{window.location=Galaxy.options.root+"history/view_multiple"}},_clickToggleDeletedDatasets:function(C){return this.toggleDeletedDatasets($(C.currentTarget).is(":checked"))},toggleDeletedDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowDeleted(C,false)},E*200)})},_clickToggleHiddenDatasets:function(C){return this.toggleHiddenDatasets($(C.currentTarget).is(":checked"))},toggleHiddenDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowHidden(C,false)},E*200)})},setUpBehaviors:function(){var D=this;D._moreOptionsPopover();D.$("#search-histories").searchInput({name:"search-histories",placeholder:_l("search histories"),onsearch:function(E){D.searchFor=E;D.filters=[function(){return this.model.matchesAll(D.searchFor)}];D.renderColumns(0)},onclear:function(E){D.searchFor=null;D.filters=[];D.renderColumns(0)}});D.$("#search-datasets").searchInput({name:"search-datasets",placeholder:_l("search all datasets"),onfirstsearch:function(E){D.hdaQueue.clear();D.$("#search-datasets").searchInput("toggle-loading");D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E);D.queueHdaFetchDetails(F)});D.hdaQueue.progress(function(F){D.renderInfo([_l("searching"),(F.curr+1),_l("of"),F.total].join(" "))});D.hdaQueue.deferred.done(function(){D.renderInfo("");D.$("#search-datasets").searchInput("toggle-loading")})},onsearch:function(E){D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E)})},onclear:function(E){D.searchFor=null;D.sortedFilteredColumns().forEach(function(F){F.panel.clearSearch()})}});$(window).resize(function(){D._recalcFirstColumnHeight()});var C=_.debounce(_.bind(this.checkColumnsInView,this),100);this.$(".middle").parent().scroll(C)},_moreOptionsPopover:function(){return this.$(".open-more-options.btn").popover({container:".header",placement:"bottom",html:true,content:$(this.optionsPopoverTemplate(this))})},_recalcFirstColumnHeight:function(){var C=this.$(".history-column").first(),E=this.$(".middle").height(),D=C.find(".panel-controls").height();C.height(E).find(".inner").height(E-D)},_viewport:function(){var C=this.$(".middle").parent().offset().left;return{left:C,right:C+this.$(".middle").parent().width()}},columnsInView:function(){var C=this._viewport();return this.sortedFilteredColumns().filter(function(D){return D.currentHistory||D.inView(C.left,C.right)})},checkColumnsInView:function(){this.columnsInView().forEach(function(C){C.trigger("in-view",C)})},currentColumnDropTargetOn:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=function(D){};C.panel.dropTargetOn()},currentColumnDropTargetOff:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=l.HistoryPanelEdit.prototype.dataDrop;C.panel.dropTarget=false;C.panel.$(".history-drop-target").remove()},toString:function(){return"MultiPanelColumns("+(this.columns?this.columns.length:0)+")"},mainTemplate:_.template(['<div class="header flex-column-container">','<div class="control-column control-column-left flex-column">','<button class="create-new btn btn-default">',_l("Create new"),"</button> ",'<div id="search-histories" class="search-control"></div>','<div id="search-datasets" class="search-control"></div>','<button class="open-more-options btn btn-default">','<span class="fa fa-ellipsis-h" title="More options"></span>',"</button>","</div>",'<div class="control-column control-column-center flex-column">','<div class="header-info">',"</div>","</div>",'<div class="control-column control-column-right flex-column">','<button class="done btn btn-default">',_l("Done"),"</button>","</div>","</div>",'<div class="outer-middle flex-row flex-row-container">','<div class="middle flex-column-container flex-row"></div>',"</div>",'<div class="footer flex-column-container">',"</div>"].join(""),{variable:"view"}),optionsPopoverTemplate:_.template(['<div class="more-options">','<div class="checkbox"><label><input id="include-deleted" type="checkbox"','<%= view.collection.includeDeleted? " checked" : "" %>>',_l("Include deleted histories"),"</label></div>",'<div class="order btn-group">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',_l("Order histories by")+" ",'<span class="current-order"><%= view.order %></span> ','<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="javascript:void(0);" class="order-update">',_l("Time of last update"),"</a></li>",'<li><a href="javascript:void(0);" class="order-name">',_l("Name"),"</a></li>",'<li><a href="javascript:void(0);" class="order-size">',_l("Size"),"</a></li>","</ul>","</div>",'<div class="checkbox"><label><input id="toggle-deleted" type="checkbox">',_l("Include deleted datasets"),"</label></div>",'<div class="checkbox"><label><input id="toggle-hidden" type="checkbox">',_l("Include hidden datasets"),"</label></div>","</div>"].join(""),{variable:"view"})});return{MultiPanelColumns:m}});
\ No newline at end of file
+define(["mvc/history/history-model","mvc/history/history-panel-edit","mvc/base-mvc","utils/ajax-queue","ui/mode-button","ui/search-input"],function(d,l,z,a){function g(I,E){E=E||{};if(!(Galaxy&&Galaxy.modal)){return I.copy()}var F=I.get("name"),C="Copy of '"+F+"'";function D(K){if(!K){if(!Galaxy.modal.$("#invalid-title").size()){var J=$("<p/>").attr("id","invalid-title").css({color:"red","margin-top":"8px"}).addClass("bg-danger").text(_l("Please enter a valid history title"));Galaxy.modal.$(".modal-body").append(J)}return false}return K}function G(J){var K=$('<p><span class="fa fa-spinner fa-spin"></span> Copying history...</p>').css("margin-top","8px");Galaxy.modal.$(".modal-body").append(K);I.copy(true,J).fail(function(){alert(_l("History could not be copied. Please contact a Galaxy administrator"))}).always(function(){Galaxy.modal.hide()})}function H(){var J=Galaxy.modal.$("#copy-modal-title").val();if(!D(J)){return}G(J)}Galaxy.modal.show(_.extend({title:_l("Copying history")+' "'+F+'"',body:$(['<label for="copy-modal-title">',_l("Enter a title for the copied history"),":","</label><br />",'<input id="copy-modal-title" class="form-control" style="width: 100%" value="',C,'" />'].join("")),buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:H}},E));$("#copy-modal-title").focus().select();$("#copy-modal-title").on("keydown",function(J){if(J.keyCode===13){H()}})}var B=Backbone.View.extend(z.LoggableMixin).extend({tagName:"div",className:"history-column flex-column flex-row-container",id:function q(){if(!this.model){return""}return"history-column-"+this.model.get("id")},initialize:function c(C){C=C||{};this.panel=C.panel||this.createPanel(C);this.setUpListeners()},createPanel:function u(D){D=_.extend({model:this.model,dragItems:true},D);var C=new l.HistoryPanelEdit(D);C._renderEmptyMessage=this.__patch_renderEmptyMessage;return C},__patch_renderEmptyMessage:function(E){var D=this,F=_.chain(this.model.get("state_ids")).values().flatten().value().length,C=D.$emptyMessage(E);if(!_.isEmpty(D.hdaViews)){C.hide()}else{if(F&&!this.model.contents.length){C.empty().append($('<span class="fa fa-spinner fa-spin"></span><i>loading datasets...</i>')).show()}else{if(D.searchFor){C.text(D.noneFoundMsg).show()}else{C.text(D.emptyMsg).show()}}}return C},setUpListeners:function f(){var C=this;this.once("rendered",function(){C.trigger("rendered:initial",C)});this.setUpPanelListeners()},setUpPanelListeners:function k(){var C=this;this.listenTo(this.panel,{rendered:function(){C.trigger("rendered",C)}},this)},inView:function(C,D){var F=this.$el.offset().left,E=F+this.$el.width();if(E<C){return false}if(F>D){return false}return true},$panel:function e(){return this.$(".history-panel")},render:function A(D){D=(D!==undefined)?(D):("fast");var C=this.model?this.model.toJSON():{};this.$el.html(this.template(C));this.renderPanel(D);this.setUpBehaviors();return this},setUpBehaviors:function v(){},template:function w(C){C=_.extend(C||{},{isCurrentHistory:this.currentHistory});return $(['<div class="panel-controls clear flex-row">',this.controlsLeftTemplate(C),this.controlsRightTemplate(C),"</div>",'<div class="inner flex-row flex-column-container">','<div id="history-',C.id,'" class="history-column history-panel flex-column"></div>',"</div>"].join(""))},renderPanel:function h(C){C=(C!==undefined)?(C):("fast");this.panel.setElement(this.$panel()).render(C);if(this.currentHistory){this.panel.$list().before(this.panel._renderDropTargetHelp())}return this},events:{"click .switch-to.btn":function(){this.model.setAsCurrent()},"click .delete-history":function(){var C=this;this.model._delete().fail(function(F,D,E){alert(_l("Could not delete the history")+":\n"+E)}).done(function(D){C.render()})},"click .undelete-history":function(){var C=this;this.model.undelete().fail(function(F,D,E){alert(_l("Could not undelete the history")+":\n"+E)}).done(function(D){C.render()})},"click .purge-history":function(){if(confirm(_l("This will permanently remove the data. Are you sure?"))){var C=this;this.model.purge().fail(function(F,D,E){alert(_l("Could not purge the history")+":\n"+E)}).done(function(D){C.render()})}},"click .copy-history":"copy"},copy:function s(){g(this.model)},controlsLeftTemplate:_.template(['<div class="pull-left">',"<% if( history.isCurrentHistory ){ %>",'<strong class="current-label">',_l("Current History"),"</strong>","<% } else { %>",'<button class="switch-to btn btn-default">',_l("Switch to"),"</button>","<% } %>","</div>"].join(""),{variable:"history"}),controlsRightTemplate:_.template(['<div class="pull-right">',"<% if( !history.purged ){ %>",'<div class="panel-menu order btn-group">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">','<span class="caret"></span>',"</button>",'<ul class="dropdown-menu pull-right" role="menu">',"<% if( !history.deleted ){ %>",'<li><a href="javascript:void(0);" class="copy-history">',_l("Copy"),"</a></li>",'<li><a href="javascript:void(0);" class="delete-history">',_l("Delete"),"</a></li>","<% } else /* if is deleted */ { %>",'<li><a href="javascript:void(0);" class="undelete-history">',_l("Undelete"),"</a></li>","<% } %>","</ul>","<% } %>","</div>","</div>"].join(""),{variable:"history"}),toString:function(){return"HistoryPanelColumn("+(this.panel?this.panel:"")+")"}});var m=Backbone.View.extend(z.LoggableMixin).extend({className:"multi-history-columns",initialize:function c(C){C=C||{};this.log(this+".init",C);if(!C.currentHistoryId){throw new Error(this+" requires a currentHistoryId in the options")}this.currentHistoryId=C.currentHistoryId;this.options={columnWidth:312,borderWidth:1,columnGap:8,headerHeight:29,footerHeight:0,controlsHeight:20};this.order=C.order||"update";this._initSortOrders();this.hdaQueue=new a.NamedAjaxQueue([],false);this.collection=null;this.setCollection(C.histories||[]);this.columnMap={};this.createColumns(C.columnOptions);this.setUpListeners()},_initSortOrders:function(){function C(D,E){return function F(H,G,I){if(H.id===I){return -1}if(G.id===I){return 1}H=D(H);G=D(G);return E.asc?((H===G)?(0):(H>G?1:-1)):((H===G)?(0):(H>G?-1:1))}}this.sortOrders={update:{text:_l("most recent first"),fn:C(function(D){return Date(D.get("update_time"))},{asc:false})},name:{text:_l("name, a to z"),fn:C(function(D){return D.get("name")},{asc:true})},"name-dsc":{text:_l("name, z to a"),fn:C(function(D){return D.get("name")},{asc:false})},size:{text:_l("size, large to small"),fn:C(function(D){return D.get("size")},{asc:false})},"size-dsc":{text:_l("size, small to large"),fn:C(function(D){return D.get("size")},{asc:true})}};return this.sortOrders},setUpListeners:function f(){},setCollection:function y(D){var C=this;C.stopListening(C.collection);C.collection=D;C.sortCollection(C.order,{silent:true});C.setUpCollectionListeners();C.trigger("new-collection",C);return C},setUpCollectionListeners:function(){var C=this,D=C.collection;C.listenTo(D,{add:C.addAsCurrentColumn,"set-as-current":C.setCurrentHistory,"change:deleted":C.handleDeletedHistory,sort:function(){C.renderColumns(0)}})},setCurrentHistory:function p(D){var C=this.columnMap[this.currentHistoryId];if(C){C.currentHistory=false;C.$el.height("")}this.currentHistoryId=D.id;var E=this.columnMap[this.currentHistoryId];E.currentHistory=true;this.sortCollection();multipanel._recalcFirstColumnHeight();return E},handleDeletedHistory:function b(D){if(D.get("deleted")){this.log("handleDeletedHistory",this.collection.includeDeleted,D);var C=this;column=C.columnMap[D.id];if(!column){return}if(column.model.id===this.currentHistoryId){}else{if(!C.collection.includeDeleted){C.removeColumn(column)}}}},sortCollection:function(C,D){if(!(C in this.sortOrders)){C="update"}this.order=C;var G=this.currentHistoryId,F=this.sortOrders[C];this.collection.comparator=function E(I,H){return F.fn(I,H,G)};this.$(".current-order").text(F.text);this.collection.sort(D);return this.collection},create:function(C){return this.collection.create({current:true})},createColumns:function r(D){D=D||{};var C=this;this.columnMap={};C.collection.each(function(E,F){var G=C.createColumn(E,D);C.columnMap[E.id]=G})},createColumn:function t(E,C){C=_.extend({},C,{model:E});var D=new B(C);if(E.id===this.currentHistoryId){D.currentHistory=true}this.setUpColumnListeners(D);return D},sortedFilteredColumns:function(C){C=C||this.filters;if(!C||!C.length){return this.sortedColumns()}var D=this;return D.sortedColumns().filter(function(G,F){var E=G.currentHistory||_.every(C.map(function(H){return H.call(G)}));return E})},sortedColumns:function(){var D=this;var C=this.collection.map(function(F,E){return D.columnMap[F.id]});return C},addColumn:function o(E,C){C=C!==undefined?C:true;var D=this.createColumn(E);this.columnMap[E.id]=D;if(C){this.renderColumns()}return D},addAsCurrentColumn:function o(E){var D=this,C=this.addColumn(E,false);this.setCurrentHistory(E);C.once("rendered",function(){D.queueHdaFetch(C)});return C},removeColumn:function x(E,D){D=D!==undefined?D:true;this.log("removeColumn",E);if(!E){return}var F=this,C=this.options.columnWidth+this.options.columnGap;E.$el.fadeOut("fast",function(){if(D){$(this).remove();F.$(".middle").width(F.$(".middle").width()-C);F.checkColumnsInView();F._recalcFirstColumnHeight()}F.stopListening(E.panel);F.stopListening(E);delete F.columnMap[E.model.id];E.remove()})},setUpColumnListeners:function n(C){var D=this;D.listenTo(C,{"in-view":D.queueHdaFetch});D.listenTo(C.panel,{"view:draggable:dragstart":function(H,F,E,G){D._dropData=JSON.parse(H.dataTransfer.getData("text"));D.currentColumnDropTargetOn()},"view:draggable:dragend":function(H,F,E,G){D._dropData=null;D.currentColumnDropTargetOff()},"droptarget:drop":function(G,H,F){var I=D._dropData.filter(function(J){return(_.isObject(J)&&J.id&&J.model_class==="HistoryDatasetAssociation")});D._dropData=null;var E=new a.NamedAjaxQueue();I.forEach(function(J){E.add({name:"copy-"+J.id,fn:function(){return F.model.contents.copy(J.id)}})});E.start();E.done(function(J){F.model.fetch()})}})},columnMapLength:function(){return Object.keys(this.columnMap).length},render:function A(D){D=D!==undefined?D:this.fxSpeed;var C=this;C.log(C+".render");C.$el.html(C.mainTemplate(C));C.renderColumns(D);C.setUpBehaviors();C.trigger("rendered",C);return C},renderColumns:function j(F){F=F!==undefined?F:this.fxSpeed;var E=this,C=E.sortedFilteredColumns();E.$(".middle").width(C.length*(this.options.columnWidth+this.options.columnGap)+this.options.columnGap+16);var D=E.$(".middle");D.empty();C.forEach(function(H,G){H.$el.appendTo(D);H.delegateEvents();E.renderColumn(H,F)});if(this.searchFor&&C.length<=1){}else{E.checkColumnsInView();this._recalcFirstColumnHeight()}return C},renderColumn:function(C,D){D=D!==undefined?D:this.fxSpeed;return C.render(D)},queueHdaFetch:function i(E){if(E.model.contents.length===0&&!E.model.get("empty")){var C={},D=_.values(E.panel.storage.get("expandedIds")).join();if(D){C.dataset_details=D}this.hdaQueue.add({name:E.model.id,fn:function(){var F=E.model.contents.fetch({data:C,silent:true});return F.done(function(G){E.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},queueHdaFetchDetails:function(C){if((C.model.contents.length===0&&!C.model.get("empty"))||(!C.model.contents.haveDetails())){this.hdaQueue.add({name:C.model.id,fn:function(){var D=C.model.contents.fetch({data:{details:"all"},silent:true});return D.done(function(E){C.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},renderInfo:function(C){this.$(".header .header-info").text(C)},events:{"click .done.btn":"close","click .create-new.btn":"create","click #include-deleted":"_clickToggleDeletedHistories","click .order .set-order":"_chooseOrder","click #toggle-deleted":"_clickToggleDeletedDatasets","click #toggle-hidden":"_clickToggleHiddenDatasets"},close:function(D){var C="/";if(Galaxy&&Galaxy.options&&Galaxy.options.root){C=Galaxy.options.root}else{if(galaxy_config&&galaxy_config.root){C=galaxy_config.root}}window.location=C},_clickToggleDeletedHistories:function(C){return this.toggleDeletedHistories($(C.currentTarget).is(":checked"))},toggleDeletedHistories:function(C){if(C){window.location=Galaxy.options.root+"history/view_multiple?include_deleted_histories=True"}else{window.location=Galaxy.options.root+"history/view_multiple"}},_clickToggleDeletedDatasets:function(C){return this.toggleDeletedDatasets($(C.currentTarget).is(":checked"))},toggleDeletedDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowDeleted(C,false)},E*200)})},_clickToggleHiddenDatasets:function(C){return this.toggleHiddenDatasets($(C.currentTarget).is(":checked"))},toggleHiddenDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowHidden(C,false)},E*200)})},_chooseOrder:function(D){var C=$(D.currentTarget).data("order");this.sortCollection(C)},setUpBehaviors:function(){var D=this;D._moreOptionsPopover();D.$("#search-histories").searchInput({name:"search-histories",placeholder:_l("search histories"),onsearch:function(E){D.searchFor=E;D.filters=[function(){return this.model.matchesAll(D.searchFor)}];D.renderColumns(0)},onclear:function(E){D.searchFor=null;D.filters=[];D.renderColumns(0)}});D.$("#search-datasets").searchInput({name:"search-datasets",placeholder:_l("search all datasets"),onfirstsearch:function(E){D.hdaQueue.clear();D.$("#search-datasets").searchInput("toggle-loading");D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E);D.queueHdaFetchDetails(F)});D.hdaQueue.progress(function(F){D.renderInfo([_l("searching"),(F.curr+1),_l("of"),F.total].join(" "))});D.hdaQueue.deferred.done(function(){D.renderInfo("");D.$("#search-datasets").searchInput("toggle-loading")})},onsearch:function(E){D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E)})},onclear:function(E){D.searchFor=null;D.sortedFilteredColumns().forEach(function(F){F.panel.clearSearch()})}});$(window).resize(function(){D._recalcFirstColumnHeight()});var C=_.debounce(_.bind(this.checkColumnsInView,this),100);this.$(".middle").parent().scroll(C)},_moreOptionsPopover:function(){return this.$(".open-more-options.btn").popover({container:".header",placement:"bottom",html:true,content:$(this.optionsPopoverTemplate(this))})},_recalcFirstColumnHeight:function(){var C=this.$(".history-column").first(),E=this.$(".middle").height(),D=C.find(".panel-controls").height();C.height(E).find(".inner").height(E-D)},_viewport:function(){var C=this.$(".middle").parent().offset().left;return{left:C,right:C+this.$(".middle").parent().width()}},columnsInView:function(){var C=this._viewport();return this.sortedFilteredColumns().filter(function(D){return D.currentHistory||D.inView(C.left,C.right)})},checkColumnsInView:function(){this.columnsInView().forEach(function(C){C.trigger("in-view",C)})},currentColumnDropTargetOn:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=function(D){};C.panel.dropTargetOn()},currentColumnDropTargetOff:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=l.HistoryPanelEdit.prototype.dataDrop;C.panel.dropTarget=false;C.panel.$(".history-drop-target").remove()},toString:function(){return"MultiPanelColumns("+(this.columns?this.columns.length:0)+")"},mainTemplate:_.template(['<div class="header flex-column-container">','<div class="control-column control-column-left flex-column">','<button class="create-new btn btn-default">',_l("Create new"),"</button> ",'<div id="search-histories" class="search-control"></div>','<div id="search-datasets" class="search-control"></div>','<button class="open-more-options btn btn-default">','<span class="fa fa-ellipsis-h" title="More options"></span>',"</button>","</div>",'<div class="control-column control-column-center flex-column">','<div class="header-info">',"</div>","</div>",'<div class="control-column control-column-right flex-column">','<button class="done btn btn-default">',_l("Done"),"</button>","</div>","</div>",'<div class="outer-middle flex-row flex-row-container">','<div class="middle flex-column-container flex-row"></div>',"</div>",'<div class="footer flex-column-container">',"</div>"].join(""),{variable:"view"}),optionsPopoverTemplate:_.template(['<div class="more-options">','<div class="order btn-group">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',_l("Order histories by")+" ",'<span class="current-order"><%= view.sortOrders[ view.order ].text %></span> ','<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">',"<% _.each( view.sortOrders, function( order, key ){ %>",'<li><a href="javascript:void(0);" class="set-order" data-order="<%= key %>">',"<%= order.text %>","</a></li>","<% }); %>","</ul>","</div>",'<div class="checkbox"><label><input id="include-deleted" type="checkbox"','<%= view.collection.includeDeleted? " checked" : "" %>>',_l("Include deleted histories"),"</label></div>","<hr />",'<div class="checkbox"><label><input id="toggle-deleted" type="checkbox">',_l("Include deleted datasets"),"</label></div>",'<div class="checkbox"><label><input id="toggle-hidden" type="checkbox">',_l("Include hidden datasets"),"</label></div>","</div>"].join(""),{variable:"view"})});return{MultiPanelColumns:m}});
\ 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.
1
0
commit/galaxy-central: martenson: fix for 'add datasets to folder' button in data libraries
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/658eb2453478/
Changeset: 658eb2453478
User: martenson
Date: 2015-02-12 21:09:18+00:00
Summary: fix for 'add datasets to folder' button in data libraries
when no library import configuration is set;
thanks to Carl for reporting this
Affected #: 3 files
diff -r 916aee1b2e3d74015a727133cd7f4a2ef9c1a447 -r 658eb245347822b95722b4a679d1aeb93da39890 client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js
--- a/client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js
+++ b/client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js
@@ -1039,7 +1039,7 @@
tmpl_array.push(' </ul>');
tmpl_array.push(' </div>');
tmpl_array.push('<% } else { %>');
- tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');
+ tmpl_array.push(' <a data-placement="top" title="Add Datasets to Current Folder" style="display:none;" class="btn btn-default add-library-items" href="#folders/<%= id %>/import/history" role="button"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></a>');
tmpl_array.push('<% } %>');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button dataset-manipulation" style="margin-left: 0.5em; display:none;" type="button"><span class="fa fa-book"></span> to History</button>');
diff -r 916aee1b2e3d74015a727133cd7f4a2ef9c1a447 -r 658eb245347822b95722b4a679d1aeb93da39890 static/scripts/mvc/library/library-foldertoolbar-view.js
--- a/static/scripts/mvc/library/library-foldertoolbar-view.js
+++ b/static/scripts/mvc/library/library-foldertoolbar-view.js
@@ -1039,7 +1039,7 @@
tmpl_array.push(' </ul>');
tmpl_array.push(' </div>');
tmpl_array.push('<% } else { %>');
- tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');
+ tmpl_array.push(' <a data-placement="top" title="Add Datasets to Current Folder" style="display:none;" class="btn btn-default add-library-items" href="#folders/<%= id %>/import/history" role="button"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></a>');
tmpl_array.push('<% } %>');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button dataset-manipulation" style="margin-left: 0.5em; display:none;" type="button"><span class="fa fa-book"></span> to History</button>');
diff -r 916aee1b2e3d74015a727133cd7f4a2ef9c1a447 -r 658eb245347822b95722b4a679d1aeb93da39890 static/scripts/packed/mvc/library/library-foldertoolbar-view.js
--- a/static/scripts/packed/mvc/library/library-foldertoolbar-view.js
+++ b/static/scripts/packed/mvc/library/library-foldertoolbar-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(c,e,f,d,a){var b=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_show_libinfo":"showLibInfo","click #toolbtn_bulk_delete":"deleteSelectedDatasets","click #page_size_prompt":"showPageSizePrompt"},defaults:{can_add_library_item:false,contains_file:false,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,select_genome:null,select_extension:null,list_extensions:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},list_genomes:[],initialize:function(g){this.options=_.defaults(g||{},this.defaults);this.fetchExtAndGenomes();this.render()},render:function(g){this.options=_.extend(this.options,g);var i=this.templateToolBar();var h={id:this.options.id,is_admin:false,is_anonym:true,mutiple_add_dataset_options:false};if(Galaxy.currUser){h.is_admin=Galaxy.currUser.isAdmin();h.is_anonym=Galaxy.currUser.isAnonymous();if(Galaxy.config.user_library_import_dir!==null||Galaxy.config.allow_library_path_paste!==false||Galaxy.config.library_import_dir!==null){h.mutiple_add_dataset_options=true}}this.$el.html(i(h))},renderPaginator:function(h){this.options=_.extend(this.options,h);var g=this.templatePaginator();this.$el.find("#folder_paginator").html(g({id:this.options.id,show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_items_count:this.options.total_items_count,items_shown:this.options.items_shown}))},configureElements:function(g){this.options=_.extend(this.options,g);if(this.options.can_add_library_item===true){$(".add-library-items").show()}else{$(".add-library-items").hide()}if(this.options.contains_file===true){if(Galaxy.currUser){if(!Galaxy.currUser.isAnonymous()){$(".logged-dataset-manipulation").show();$(".dataset-manipulation").show()}else{$(".dataset-manipulation").show();$(".logged-dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(i){i.preventDefault();i.stopPropagation();var g=this;var h=this.templateNewFolderInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:h(),buttons:{Create:function(){g.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var g=this.serialize_new_folder();if(this.validate_new_folder(g)){var h=new d.FolderAsModel();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];h.url=h.urlRoot+"/"+current_folder_id;h.save(g,{success:function(i){Galaxy.modal.hide();f.success("Folder created.");i.set({type:"folder"});Galaxy.libraries.folderListView.collection.add(i)},error:function(j,i){Galaxy.modal.hide();if(typeof i.responseJSON!=="undefined"){f.error(i.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})}else{f.error("Folder's name is missing.")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(g){return g.name!==""},modalBulkImport:function(){var g=$("#folder_table").find(":checked");if(g.length===0){f.info("You must select some datasets first.")}else{this.refreshUserHistoriesList(function(i){var h=i.templateBulkImportInModal();i.modal=Galaxy.modal;i.modal.show({closing_events:true,title:"Import into History",body:h({histories:i.histories.models}),buttons:{Import:function(){i.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})}},refreshUserHistoriesList:function(h){var g=this;this.histories=new d.GalaxyHistories();this.histories.fetch({success:function(){h(g)},error:function(j,i){if(typeof i.responseJSON!=="undefined"){f.error(i.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var k=$("select[name=dataset_import_bulk] option:selected").val();var n=$("select[name=dataset_import_bulk] option:selected").text();this.options.last_used_history_id=k;var h=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});var m=[];for(var j=h.length-1;j>=0;j--){var g=h[j];var l=new d.HistoryItem();l.url=l.urlRoot+k+"/contents";l.content=g;l.source="library";m.push(l)}this.initChainCallControl({length:m.length,action:"to_history",history_name:n});jQuery.getJSON(galaxy_config.root+"history/set_as_current?id="+k);this.chainCallImportingIntoHistory(m,n)},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(g,k){var i=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){i.push(this.parentElement.parentElement.id)}});var h="/api/libraries/datasets/download/"+k;var j={ld_ids:i};this.processDownload(h,j,"get")},processDownload:function(h,i,j){if(h&&i){i=typeof i==="string"?i:$.param(i);var g="";$.each(i.split("&"),function(){var k=this.split("=");g+='<input type="hidden" name="'+k[0]+'" value="'+k[1]+'" />'});$('<form action="'+h+'" method="'+(j||"post")+'">'+g+"</form>").appendTo("body").submit().remove();f.info("Your download will begin soon.")}else{f.error("An error occurred.")}},addFilesFromHistoryModal:function(){this.refreshUserHistoriesList(function(g){g.modal=Galaxy.modal;var h=g.templateAddFilesFromHistory();var i=g.options.full_path[g.options.full_path.length-1][1];g.modal.show({closing_events:true,title:"Adding datasets from your history to folder "+i,body:h({histories:g.histories.models}),buttons:{Add:function(){g.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.back()}});if(g.histories.models.length>0){g.fetchAndDisplayHistoryContents(g.histories.models[0].id);$("#dataset_add_bulk").change(function(j){g.fetchAndDisplayHistoryContents(j.target.value)})}else{f.error("An error ocurred.")}})},importFilesFromPathModal:function(){var h=this;this.modal=Galaxy.modal;var g=this.templateImportPathModal();this.modal.show({closing_events:true,title:"Please enter paths to import",body:g({}),buttons:{Import:function(){h.importFromPathsClicked(h)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+h.id,{trigger:true})}});this.renderSelectBoxes()},fetchExtAndGenomes:function(){var g=this;e.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(h){for(key in h){g.list_extensions.push({id:h[key].extension,text:h[key].extension,description:h[key].description,description_url:h[key].description_url})}g.list_extensions.sort(function(j,i){return j.id>i.id?1:j.id<i.id?-1:0});g.list_extensions.unshift(g.auto)}});e.get({url:galaxy_config.root+"api/genomes",success:function(h){for(key in h){g.list_genomes.push({id:h[key][1],text:h[key][0]})}g.list_genomes.sort(function(j,i){return j.id>i.id?1:j.id<i.id?-1:0})}})},renderSelectBoxes:function(){var g=this;this.select_genome=new a.View({css:"library-genome-select",data:g.list_genomes,container:Galaxy.modal.$el.find("#library_genome_select"),value:"?"});this.select_extension=new a.View({css:"library-extension-select",data:g.list_extensions,container:Galaxy.modal.$el.find("#library_extension_select"),value:"auto"})},importFilesFromGalaxyFolderModal:function(g){var i=this;var h=this.templateBrowserModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Please select folders or files",body:h({}),buttons:{Import:function(){i.importFromJstreePath(i,g)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+i.id,{trigger:true})}});this.renderSelectBoxes();g.disabled_jstree_element="folders";this.renderJstree(g);$("input[type=radio]").change(function(j){if(j.target.value==="jstree-disable-folders"){g.disabled_jstree_element="folders";i.renderJstree(g);$(".jstree-folders-message").hide();$(".jstree-preserve-structure").hide();$(".jstree-link-files").hide();$(".jstree-files-message").show()}else{if(j.target.value==="jstree-disable-files"){$(".jstree-files-message").hide();$(".jstree-folders-message").show();$(".jstree-link-files").show();$(".jstree-preserve-structure").show();g.disabled_jstree_element="files";i.renderJstree(g)}}})},renderJstree:function(g){var i=this;this.options=_.extend(this.options,g);var j=g.source||"userdir";var h=this.options.disabled_jstree_element;this.jstree=new d.Jstree();this.jstree.url=this.jstree.urlRoot+"?target="+j+"&format=jstree&disable="+h;this.jstree.fetch({success:function(l,k){define("jquery",function(){return jQuery});require(["libs/jquery/jstree"],function(m){$("#jstree_browser").jstree("destroy");$("#jstree_browser").jstree({core:{data:l},plugins:["types","checkbox"],types:{folder:{icon:"jstree-folder"},file:{icon:"jstree-file"}},checkbox:{three_state:false}})})},error:function(l,k){if(typeof k.responseJSON!=="undefined"){f.error(k.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})},importFromPathsClicked:function(){var g=this.modal.$el.find(".preserve-checkbox").is(":checked");var n=this.modal.$el.find(".link-checkbox").is(":checked");var h=this.select_extension.value();var j=this.select_genome.value();var m=$("textarea#import_paths").val();var l=[];if(!m){f.info("Please enter a path relative to Galaxy root.")}else{this.modal.disableButton("Import");m=m.split("\n");for(var k=m.length-1;k>=0;k--){trimmed=m[k].trim();if(trimmed.length!==0){l.push(trimmed)}}this.initChainCallControl({length:l.length,action:"adding_datasets"});this.chainCallImportingFolders({paths:l,preserve_dirs:g,link_data:n,source:"admin_path",file_type:h,dbkey:j})}},initChainCallControl:function(g){var h;switch(g.action){case"adding_datasets":h=this.templateAddingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(h({folder_name:this.options.folder_name}));break;case"deleting_datasets":h=this.templateDeletingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(h());break;case"to_history":h=this.templateImportIntoHistoryProgressBar();this.modal.$el.find(".modal-body").html(h({history_name:g.history_name}));break;default:console.error("Wrong action specified.");break}this.progress=0;this.progressStep=100/g.length;this.options.chain_call_control.total_number=g.length;this.options.chain_call_control.failed_number=0},importFromJstreePath:function(n,r){var g=$("#jstree_browser").jstree().get_selected(true);var m=this.modal.$el.find(".preserve-checkbox").is(":checked");var o=this.modal.$el.find(".link-checkbox").is(":checked");var j=this.select_extension.value();var p=this.select_genome.value();var k=g[0].type;var q=[];if(g.length<1){f.info("Please select some items first.")}else{this.modal.disableButton("Import");for(var l=g.length-1;l>=0;l--){if(g[l].li_attr.full_path!==undefined){q.push(g[l].li_attr.full_path)}}this.initChainCallControl({length:q.length,action:"adding_datasets"});if(k==="folder"){var h=r.source+"_folder";this.chainCallImportingFolders({paths:q,preserve_dirs:m,link_data:o,source:h,file_type:j,dbkey:p})}else{if(k==="file"){var h=r.source+"_file";this.chainCallImportingUserdirFiles({paths:q,file_type:j,dbkey:p,source:h})}}}},fetchAndDisplayHistoryContents:function(i){var h=new d.HistoryContents({id:i});var g=this;h.fetch({success:function(k){var j=g.templateHistoryContents();g.histories.get(i).set({contents:k});g.modal.$el.find("#selected_history_content").html(j({history_contents:k.models.reverse()}))},error:function(k,j){if(typeof j.responseJSON!=="undefined"){f.error(j.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})},addAllDatasetsFromHistory:function(){var l=this.modal.$el.find("#selected_history_content").find(":checked");var g=[];var k=[];if(l.length<1){f.info("You must select some datasets first.")}else{this.modal.disableButton("Add");l.each(function(){var i=$(this.parentElement).data("id");if(i){g.push(i)}});for(var j=g.length-1;j>=0;j--){history_dataset_id=g[j];var h=new d.Item();h.url="/api/folders/"+this.options.id+"/contents";h.set({from_hda_id:history_dataset_id});k.push(h)}this.initChainCallControl({length:k.length,action:"adding_datasets"});this.chainCallAddingHdas(k)}},chainCallImportingIntoHistory:function(h,k){var g=this;var i=h.pop();if(typeof i=="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected datasets imported into history. Click this to start analysing it.","",{onclick:function(){window.location="/"}})}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){f.error("There was an error and no datasets were imported into history.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){f.warning("Some of the datasets could not be imported into history. Click this to see what was imported.","",{onclick:function(){window.location="/"}})}}}Galaxy.modal.hide();return true}var j=$.when(i.save({content:i.content,source:i.source}));j.done(function(){g.updateProgress();g.chainCallImportingIntoHistory(h,k)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallImportingIntoHistory(h,k)})},chainCallImportingUserdirFiles:function(g){var h=this;var i=g.paths.pop();if(typeof i==="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected files imported into the current folder");Galaxy.modal.hide()}else{f.error("An error occured.")}return true}var j=$.when($.post("/api/libraries/datasets?encoded_folder_id="+h.id+"&source="+g.source+"&path="+i+"&file_type="+g.file_type+"&dbkey="+g.dbkey));j.done(function(k){h.updateProgress();h.chainCallImportingUserdirFiles(g)}).fail(function(){h.options.chain_call_control.failed_number+=1;h.updateProgress();h.chainCallImportingUserdirFiles(g)})},chainCallImportingFolders:function(g){var h=this;var i=g.paths.pop();if(typeof i=="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected folders and their contents imported into the current folder.");Galaxy.modal.hide()}else{f.error("An error occured.")}return true}var j=$.when($.post("/api/libraries/datasets?encoded_folder_id="+h.id+"&source="+g.source+"&path="+i+"&preserve_dirs="+g.preserve_dirs+"&link_data="+g.link_data+"&file_type="+g.file_type+"&dbkey="+g.dbkey));j.done(function(k){h.updateProgress();h.chainCallImportingFolders(g)}).fail(function(){h.options.chain_call_control.failed_number+=1;h.updateProgress();h.chainCallImportingFolders(g)})},chainCallAddingHdas:function(h){var g=this;this.added_hdas=new d.Folder();var i=h.pop();if(typeof i=="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected datasets from history added to the folder")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){f.error("There was an error and no datasets were added to the folder.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){f.warning("Some of the datasets could not be added to the folder")}}}Galaxy.modal.hide();return this.added_hdas}var j=$.when(i.save({from_hda_id:i.get("from_hda_id")}));j.done(function(k){Galaxy.libraries.folderListView.collection.add(k);g.updateProgress();g.chainCallAddingHdas(h)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallAddingHdas(h)})},chainCallDeletingHdas:function(h){var g=this;this.deleted_lddas=new d.Folder();var i=h.pop();if(typeof i==="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected datasets were deleted.")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){f.error("There was an error and no datasets were deleted. Please make sure you have sufficient permissions.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){f.warning("Some of the datasets could not be deleted. Please make sure you have sufficient permissions.")}}}Galaxy.modal.hide();return this.deleted_lddas}var j=$.when(i.destroy());j.done(function(l){Galaxy.libraries.folderListView.collection.remove(i.id);g.updateProgress();if(Galaxy.libraries.folderListView.options.include_deleted){var k=new d.Item(l);Galaxy.libraries.folderListView.collection.add(k)}g.chainCallDeletingHdas(h)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallDeletingHdas(h)})},checkIncludeDeleted:function(g){if(g.target.checked){Galaxy.libraries.folderListView.fetchFolder({include_deleted:true})}else{Galaxy.libraries.folderListView.fetchFolder({include_deleted:false})}},deleteSelectedDatasets:function(){var g=$("#folder_table").find(":checked");if(g.length===0){f.info("You must select at least one dataset for deletion.")}else{var k=this.templateDeletingDatasetsProgressBar();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Deleting selected datasets",body:k({}),buttons:{Close:function(){Galaxy.modal.hide()}}});this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var h=[];g.each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});this.progressStep=100/h.length;this.progress=0;var m=[];for(var j=h.length-1;j>=0;j--){var l=new d.Item({id:h[j]});m.push(l)}this.options.chain_call_control.total_number=h.length;this.chainCallDeletingHdas(m)}},showLibInfo:function(){var h=Galaxy.libraries.folderListView.folderContainer.attributes.metadata.parent_library_id;var g=null;var i=this;if(Galaxy.libraries.libraryListView!==null){g=Galaxy.libraries.libraryListView.collection.get(h);this.showLibInfoModal(g)}else{g=new d.Library({id:h});g.fetch({success:function(){i.showLibInfoModal(g)},error:function(k,j){if(typeof j.responseJSON!=="undefined"){f.error(j.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})}},showLibInfoModal:function(g){var h=this.templateLibInfoInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Library Information",body:h({library:g}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(g){switch(g.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":this.importFilesFromGalaxyFolderModal({source:"importdir"});break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromGalaxyFolderModal({source:"userdir"});break;default:Galaxy.libraries.library_router.back();f.error("Invalid import source.");break}},showPageSizePrompt:function(){var g=prompt("How many items per page do you want to see?",Galaxy.libraries.preferences.get("folder_page_size"));if((g!=null)&&(g==parseInt(g))){Galaxy.libraries.preferences.set({folder_page_size:parseInt(g)});Galaxy.libraries.folderListView.render({id:this.options.id,show_page:1})}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(" <span><strong>DATA LIBRARIES</strong></span>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" class="logged-dataset-manipulation" title="Include deleted datasets" style="display:none;"> | <input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"> include deleted | </input></span>');tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder"></span></button>');tmpl_array.push("<% if(mutiple_add_dataset_options) { %>");tmpl_array.push(' <div class="btn-group add-library-items" style="display:none;">');tmpl_array.push(' <button title="Add Datasets to Current Folder" id="" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-plus"></span><span class="fa fa-file"></span><span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li><a href="#folders/<%= id %>/import/history"> from History</a></li>');tmpl_array.push("<% if(Galaxy.config.user_library_import_dir !== null) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/userdir"> from User Directory</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% if(Galaxy.config.allow_library_path_paste) { %>");tmpl_array.push(' <li class="divider"></li>');tmpl_array.push(' <li class="dropdown-header">Admins only</li>');tmpl_array.push("<% if(Galaxy.config.library_import_dir !== null) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/importdir">from Import Directory</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% if(Galaxy.config.allow_library_path_paste) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/path">from Path</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% } %>");tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push("<% } else { %>");tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');tmpl_array.push("<% } %>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button dataset-manipulation" style="margin-left: 0.5em; display:none;" type="button"><span class="fa fa-book"></span> to History</button>');tmpl_array.push(' <div id="toolbtn_dl" class="btn-group dataset-manipulation" style="margin-left: 0.5em; display:none; ">');tmpl_array.push(' <button title="Download selected datasets as archive" id="drop_toggle" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-download"></span> Download <span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button logged-dataset-manipulation" style="margin-left: 0.5em; display:none; " type="button"><span class="fa fa-times"></span> Delete</button>');tmpl_array.push(' <button data-id="<%- id %>" data-toggle="tooltip" data-placement="top" title="Show library information" id="toolbtn_show_libinfo" class="primary-button" style="margin-left: 0.5em;" type="button"><span class="fa fa-info-circle"></span> Library Info</button>');tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(' <span id="folder_paginator" class="library-paginator">');tmpl_array.push(" </span>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="folder_items_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateLibInfoInModal:function(){tmpl_array=[];tmpl_array.push('<div id="lif_info_modal">');tmpl_array.push("<h2>Library name:</h2>");tmpl_array.push('<p><%- library.get("name") %></p>');tmpl_array.push("<h3>Library description:</h3>");tmpl_array.push('<p><%- library.get("description") %></p>');tmpl_array.push("<h3>Library synopsis:</h3>");tmpl_array.push('<p><%- library.get("synopsis") %></p>');tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateBulkImportInModal:function(){var g=[];g.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');g.push("Select history: ");g.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');g.push(" <% _.each(histories, function(history) { %>");g.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');g.push(" <% }); %>");g.push("</select>");g.push("</span>");return _.template(g.join(""))},templateImportIntoHistoryProgressBar:function(){var g=[];g.push('<div class="import_text">');g.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");g.push("</div>");g.push('<div class="progress">');g.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');g.push(' <span class="completion_span">0% Complete</span>');g.push(" </div>");g.push("</div>");g.push("");return _.template(g.join(""))},templateAddingDatasetsProgressBar:function(){var g=[];g.push('<div class="import_text">');g.push("Adding selected datasets to library folder <b><%= _.escape(folder_name) %></b>");g.push("</div>");g.push('<div class="progress">');g.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');g.push(' <span class="completion_span">0% Complete</span>');g.push(" </div>");g.push("</div>");g.push("");return _.template(g.join(""))},templateDeletingDatasetsProgressBar:function(){var g=[];g.push('<div class="import_text">');g.push("</div>");g.push('<div class="progress">');g.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');g.push(' <span class="completion_span">0% Complete</span>');g.push(" </div>");g.push("</div>");g.push("");return _.template(g.join(""))},templateBrowserModal:function(){var g=[];g.push('<div id="file_browser_modal">');g.push('<div class="alert alert-info jstree-files-message">All files you select will be imported into the current folder.</div>');g.push('<div class="alert alert-info jstree-folders-message" style="display:none;">All files within the selected folders and their subfolders will be imported into the current folder.</div>');g.push('<div style="margin-bottom:1em;">');g.push('<label class="radio-inline">');g.push(' <input title="Switch to selecting files" type="radio" name="jstree-radio" value="jstree-disable-folders" checked="checked"> Files');g.push("</label>");g.push('<label class="radio-inline">');g.push(' <input title="Switch to selecting folders" type="radio" name="jstree-radio" value="jstree-disable-files"> Folders');g.push("</label>");g.push("</div>");g.push('<div style="margin-bottom:1em;">');g.push('<label class="checkbox-inline jstree-preserve-structure" style="display:none;">');g.push(' <input class="preserve-checkbox" type="checkbox" value="preserve_directory_structure">');g.push("Preserve directory structure");g.push(" </label>");g.push('<label class="checkbox-inline jstree-link-files" style="display:none;">');g.push(' <input class="link-checkbox" type="checkbox" value="link_files">');g.push("Link files instead of copying");g.push(" </label>");g.push("</div>");g.push('<div id="jstree_browser">');g.push("</div>");g.push("<hr />");g.push("<p>You can set extension type and genome for all imported datasets at once:</p>");g.push("<div>");g.push('Type: <span id="library_extension_select" class="library-extension-select" />');g.push(' Genome: <span id="library_genome_select" class="library-genome-select" />');g.push("</div>");g.push("</div>");return _.template(g.join(""))},templateImportPathModal:function(){var g=[];g.push('<div id="file_browser_modal">');g.push('<div class="alert alert-info jstree-folders-message">All files within the given folders and their subfolders will be imported into the current folder.</div>');g.push('<div style="margin-bottom: 0.5em;">');g.push('<label class="checkbox-inline jstree-preserve-structure">');g.push(' <input class="preserve-checkbox" type="checkbox" value="preserve_directory_structure">');g.push("Preserve directory structure");g.push(" </label>");g.push('<label class="checkbox-inline jstree-link-files">');g.push(' <input class="link-checkbox" type="checkbox" value="link_files">');g.push("Link files instead of copying");g.push(" </label>");g.push("</div>");g.push('<textarea id="import_paths" class="form-control" rows="5" placeholder="Absolute paths (or paths relative to Galaxy root) separated by newline"></textarea>');g.push("<hr />");g.push("<p>You can set extension type and genome for all imported datasets at once:</p>");g.push("<div>");g.push('Type: <span id="library_extension_select" class="library-extension-select" />');g.push(' Genome: <span id="library_genome_select" class="library-genome-select" />');g.push("</div>");g.push("</div>");return _.template(g.join(""))},templateAddFilesFromHistory:function(){var g=[];g.push('<div id="add_files_modal">');g.push('<div id="history_modal_combo_bulk">');g.push("Select history: ");g.push('<select id="dataset_add_bulk" name="dataset_add_bulk" style="width:66%; "> ');g.push(" <% _.each(histories, function(history) { %>");g.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');g.push(" <% }); %>");g.push("</select>");g.push("</div>");g.push("<br/>");g.push('<div id="selected_history_content">');g.push("</div>");g.push("</div>");return _.template(g.join(""))},templateHistoryContents:function(){var g=[];g.push("<strong>Choose the datasets to import:</strong>");g.push("<ul>");g.push(" <% _.each(history_contents, function(history_item) { %>");g.push(' <li data-id="<%= _.escape(history_item.get("id")) %>">');g.push(' <input style="margin: 0;" type="checkbox"><%= _.escape(history_item.get("hid")) %>: <%= _.escape(history_item.get("name")) %>');g.push(" </li>");g.push(" <% }); %>");g.push("</ul>");return _.template(g.join(""))},templatePaginator:function(){tmpl_array=[];tmpl_array.push(' <ul class="pagination pagination-sm">');tmpl_array.push(" <% if ( ( show_page - 1 ) > 0 ) { %>");tmpl_array.push(" <% if ( ( show_page - 1 ) > page_count ) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li class="disabled"><a href="#folders/<%= id %>/page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li><a href="#folders/<%= id %>/page/<% print( show_page - 1 ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li class="disabled"><a href="#folders/<%= id %>/page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li class="disabled"><a href="#folders/<%= id %>/page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(' <li class="active">');tmpl_array.push(' <a href="#folders/<%= id %>/page/<% print( show_page ) %>"><% print( show_page ) %></a>');tmpl_array.push(" </li>");tmpl_array.push(" <% if ( ( show_page ) < page_count ) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/page/<% print( show_page + 1 ) %>"><% print( show_page + 1 ) %></a></li>');tmpl_array.push(' <li><a href="#folders/<%= id %>/page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li class="disabled"><a href="#folders/<%= id %>/page/<% print( show_page ) %>"><% print( show_page + 1 ) %></a></li>');tmpl_array.push(' <li class="disabled"><a href="#folders/<%= id %>/page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(" </ul>");tmpl_array.push(" <span>");tmpl_array.push(' showing <a data-toggle="tooltip" data-placement="top" title="Click to change the number of items on page" id="page_size_prompt"><%- items_shown %></a> of <%- total_items_count %> items');tmpl_array.push(" </span>");return _.template(tmpl_array.join(""))},});return{FolderToolbarView:b}});
\ No newline at end of file
+define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(c,e,f,d,a){var b=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_show_libinfo":"showLibInfo","click #toolbtn_bulk_delete":"deleteSelectedDatasets","click #page_size_prompt":"showPageSizePrompt"},defaults:{can_add_library_item:false,contains_file:false,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,select_genome:null,select_extension:null,list_extensions:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},list_genomes:[],initialize:function(g){this.options=_.defaults(g||{},this.defaults);this.fetchExtAndGenomes();this.render()},render:function(g){this.options=_.extend(this.options,g);var i=this.templateToolBar();var h={id:this.options.id,is_admin:false,is_anonym:true,mutiple_add_dataset_options:false};if(Galaxy.currUser){h.is_admin=Galaxy.currUser.isAdmin();h.is_anonym=Galaxy.currUser.isAnonymous();if(Galaxy.config.user_library_import_dir!==null||Galaxy.config.allow_library_path_paste!==false||Galaxy.config.library_import_dir!==null){h.mutiple_add_dataset_options=true}}this.$el.html(i(h))},renderPaginator:function(h){this.options=_.extend(this.options,h);var g=this.templatePaginator();this.$el.find("#folder_paginator").html(g({id:this.options.id,show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_items_count:this.options.total_items_count,items_shown:this.options.items_shown}))},configureElements:function(g){this.options=_.extend(this.options,g);if(this.options.can_add_library_item===true){$(".add-library-items").show()}else{$(".add-library-items").hide()}if(this.options.contains_file===true){if(Galaxy.currUser){if(!Galaxy.currUser.isAnonymous()){$(".logged-dataset-manipulation").show();$(".dataset-manipulation").show()}else{$(".dataset-manipulation").show();$(".logged-dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(i){i.preventDefault();i.stopPropagation();var g=this;var h=this.templateNewFolderInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:h(),buttons:{Create:function(){g.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var g=this.serialize_new_folder();if(this.validate_new_folder(g)){var h=new d.FolderAsModel();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];h.url=h.urlRoot+"/"+current_folder_id;h.save(g,{success:function(i){Galaxy.modal.hide();f.success("Folder created.");i.set({type:"folder"});Galaxy.libraries.folderListView.collection.add(i)},error:function(j,i){Galaxy.modal.hide();if(typeof i.responseJSON!=="undefined"){f.error(i.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})}else{f.error("Folder's name is missing.")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(g){return g.name!==""},modalBulkImport:function(){var g=$("#folder_table").find(":checked");if(g.length===0){f.info("You must select some datasets first.")}else{this.refreshUserHistoriesList(function(i){var h=i.templateBulkImportInModal();i.modal=Galaxy.modal;i.modal.show({closing_events:true,title:"Import into History",body:h({histories:i.histories.models}),buttons:{Import:function(){i.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})}},refreshUserHistoriesList:function(h){var g=this;this.histories=new d.GalaxyHistories();this.histories.fetch({success:function(){h(g)},error:function(j,i){if(typeof i.responseJSON!=="undefined"){f.error(i.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var k=$("select[name=dataset_import_bulk] option:selected").val();var n=$("select[name=dataset_import_bulk] option:selected").text();this.options.last_used_history_id=k;var h=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});var m=[];for(var j=h.length-1;j>=0;j--){var g=h[j];var l=new d.HistoryItem();l.url=l.urlRoot+k+"/contents";l.content=g;l.source="library";m.push(l)}this.initChainCallControl({length:m.length,action:"to_history",history_name:n});jQuery.getJSON(galaxy_config.root+"history/set_as_current?id="+k);this.chainCallImportingIntoHistory(m,n)},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(g,k){var i=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){i.push(this.parentElement.parentElement.id)}});var h="/api/libraries/datasets/download/"+k;var j={ld_ids:i};this.processDownload(h,j,"get")},processDownload:function(h,i,j){if(h&&i){i=typeof i==="string"?i:$.param(i);var g="";$.each(i.split("&"),function(){var k=this.split("=");g+='<input type="hidden" name="'+k[0]+'" value="'+k[1]+'" />'});$('<form action="'+h+'" method="'+(j||"post")+'">'+g+"</form>").appendTo("body").submit().remove();f.info("Your download will begin soon.")}else{f.error("An error occurred.")}},addFilesFromHistoryModal:function(){this.refreshUserHistoriesList(function(g){g.modal=Galaxy.modal;var h=g.templateAddFilesFromHistory();var i=g.options.full_path[g.options.full_path.length-1][1];g.modal.show({closing_events:true,title:"Adding datasets from your history to folder "+i,body:h({histories:g.histories.models}),buttons:{Add:function(){g.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.back()}});if(g.histories.models.length>0){g.fetchAndDisplayHistoryContents(g.histories.models[0].id);$("#dataset_add_bulk").change(function(j){g.fetchAndDisplayHistoryContents(j.target.value)})}else{f.error("An error ocurred.")}})},importFilesFromPathModal:function(){var h=this;this.modal=Galaxy.modal;var g=this.templateImportPathModal();this.modal.show({closing_events:true,title:"Please enter paths to import",body:g({}),buttons:{Import:function(){h.importFromPathsClicked(h)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+h.id,{trigger:true})}});this.renderSelectBoxes()},fetchExtAndGenomes:function(){var g=this;e.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(h){for(key in h){g.list_extensions.push({id:h[key].extension,text:h[key].extension,description:h[key].description,description_url:h[key].description_url})}g.list_extensions.sort(function(j,i){return j.id>i.id?1:j.id<i.id?-1:0});g.list_extensions.unshift(g.auto)}});e.get({url:galaxy_config.root+"api/genomes",success:function(h){for(key in h){g.list_genomes.push({id:h[key][1],text:h[key][0]})}g.list_genomes.sort(function(j,i){return j.id>i.id?1:j.id<i.id?-1:0})}})},renderSelectBoxes:function(){var g=this;this.select_genome=new a.View({css:"library-genome-select",data:g.list_genomes,container:Galaxy.modal.$el.find("#library_genome_select"),value:"?"});this.select_extension=new a.View({css:"library-extension-select",data:g.list_extensions,container:Galaxy.modal.$el.find("#library_extension_select"),value:"auto"})},importFilesFromGalaxyFolderModal:function(g){var i=this;var h=this.templateBrowserModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Please select folders or files",body:h({}),buttons:{Import:function(){i.importFromJstreePath(i,g)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+i.id,{trigger:true})}});this.renderSelectBoxes();g.disabled_jstree_element="folders";this.renderJstree(g);$("input[type=radio]").change(function(j){if(j.target.value==="jstree-disable-folders"){g.disabled_jstree_element="folders";i.renderJstree(g);$(".jstree-folders-message").hide();$(".jstree-preserve-structure").hide();$(".jstree-link-files").hide();$(".jstree-files-message").show()}else{if(j.target.value==="jstree-disable-files"){$(".jstree-files-message").hide();$(".jstree-folders-message").show();$(".jstree-link-files").show();$(".jstree-preserve-structure").show();g.disabled_jstree_element="files";i.renderJstree(g)}}})},renderJstree:function(g){var i=this;this.options=_.extend(this.options,g);var j=g.source||"userdir";var h=this.options.disabled_jstree_element;this.jstree=new d.Jstree();this.jstree.url=this.jstree.urlRoot+"?target="+j+"&format=jstree&disable="+h;this.jstree.fetch({success:function(l,k){define("jquery",function(){return jQuery});require(["libs/jquery/jstree"],function(m){$("#jstree_browser").jstree("destroy");$("#jstree_browser").jstree({core:{data:l},plugins:["types","checkbox"],types:{folder:{icon:"jstree-folder"},file:{icon:"jstree-file"}},checkbox:{three_state:false}})})},error:function(l,k){if(typeof k.responseJSON!=="undefined"){f.error(k.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})},importFromPathsClicked:function(){var g=this.modal.$el.find(".preserve-checkbox").is(":checked");var n=this.modal.$el.find(".link-checkbox").is(":checked");var h=this.select_extension.value();var j=this.select_genome.value();var m=$("textarea#import_paths").val();var l=[];if(!m){f.info("Please enter a path relative to Galaxy root.")}else{this.modal.disableButton("Import");m=m.split("\n");for(var k=m.length-1;k>=0;k--){trimmed=m[k].trim();if(trimmed.length!==0){l.push(trimmed)}}this.initChainCallControl({length:l.length,action:"adding_datasets"});this.chainCallImportingFolders({paths:l,preserve_dirs:g,link_data:n,source:"admin_path",file_type:h,dbkey:j})}},initChainCallControl:function(g){var h;switch(g.action){case"adding_datasets":h=this.templateAddingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(h({folder_name:this.options.folder_name}));break;case"deleting_datasets":h=this.templateDeletingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(h());break;case"to_history":h=this.templateImportIntoHistoryProgressBar();this.modal.$el.find(".modal-body").html(h({history_name:g.history_name}));break;default:console.error("Wrong action specified.");break}this.progress=0;this.progressStep=100/g.length;this.options.chain_call_control.total_number=g.length;this.options.chain_call_control.failed_number=0},importFromJstreePath:function(n,r){var g=$("#jstree_browser").jstree().get_selected(true);var m=this.modal.$el.find(".preserve-checkbox").is(":checked");var o=this.modal.$el.find(".link-checkbox").is(":checked");var j=this.select_extension.value();var p=this.select_genome.value();var k=g[0].type;var q=[];if(g.length<1){f.info("Please select some items first.")}else{this.modal.disableButton("Import");for(var l=g.length-1;l>=0;l--){if(g[l].li_attr.full_path!==undefined){q.push(g[l].li_attr.full_path)}}this.initChainCallControl({length:q.length,action:"adding_datasets"});if(k==="folder"){var h=r.source+"_folder";this.chainCallImportingFolders({paths:q,preserve_dirs:m,link_data:o,source:h,file_type:j,dbkey:p})}else{if(k==="file"){var h=r.source+"_file";this.chainCallImportingUserdirFiles({paths:q,file_type:j,dbkey:p,source:h})}}}},fetchAndDisplayHistoryContents:function(i){var h=new d.HistoryContents({id:i});var g=this;h.fetch({success:function(k){var j=g.templateHistoryContents();g.histories.get(i).set({contents:k});g.modal.$el.find("#selected_history_content").html(j({history_contents:k.models.reverse()}))},error:function(k,j){if(typeof j.responseJSON!=="undefined"){f.error(j.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})},addAllDatasetsFromHistory:function(){var l=this.modal.$el.find("#selected_history_content").find(":checked");var g=[];var k=[];if(l.length<1){f.info("You must select some datasets first.")}else{this.modal.disableButton("Add");l.each(function(){var i=$(this.parentElement).data("id");if(i){g.push(i)}});for(var j=g.length-1;j>=0;j--){history_dataset_id=g[j];var h=new d.Item();h.url="/api/folders/"+this.options.id+"/contents";h.set({from_hda_id:history_dataset_id});k.push(h)}this.initChainCallControl({length:k.length,action:"adding_datasets"});this.chainCallAddingHdas(k)}},chainCallImportingIntoHistory:function(h,k){var g=this;var i=h.pop();if(typeof i=="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected datasets imported into history. Click this to start analysing it.","",{onclick:function(){window.location="/"}})}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){f.error("There was an error and no datasets were imported into history.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){f.warning("Some of the datasets could not be imported into history. Click this to see what was imported.","",{onclick:function(){window.location="/"}})}}}Galaxy.modal.hide();return true}var j=$.when(i.save({content:i.content,source:i.source}));j.done(function(){g.updateProgress();g.chainCallImportingIntoHistory(h,k)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallImportingIntoHistory(h,k)})},chainCallImportingUserdirFiles:function(g){var h=this;var i=g.paths.pop();if(typeof i==="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected files imported into the current folder");Galaxy.modal.hide()}else{f.error("An error occured.")}return true}var j=$.when($.post("/api/libraries/datasets?encoded_folder_id="+h.id+"&source="+g.source+"&path="+i+"&file_type="+g.file_type+"&dbkey="+g.dbkey));j.done(function(k){h.updateProgress();h.chainCallImportingUserdirFiles(g)}).fail(function(){h.options.chain_call_control.failed_number+=1;h.updateProgress();h.chainCallImportingUserdirFiles(g)})},chainCallImportingFolders:function(g){var h=this;var i=g.paths.pop();if(typeof i=="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected folders and their contents imported into the current folder.");Galaxy.modal.hide()}else{f.error("An error occured.")}return true}var j=$.when($.post("/api/libraries/datasets?encoded_folder_id="+h.id+"&source="+g.source+"&path="+i+"&preserve_dirs="+g.preserve_dirs+"&link_data="+g.link_data+"&file_type="+g.file_type+"&dbkey="+g.dbkey));j.done(function(k){h.updateProgress();h.chainCallImportingFolders(g)}).fail(function(){h.options.chain_call_control.failed_number+=1;h.updateProgress();h.chainCallImportingFolders(g)})},chainCallAddingHdas:function(h){var g=this;this.added_hdas=new d.Folder();var i=h.pop();if(typeof i=="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected datasets from history added to the folder")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){f.error("There was an error and no datasets were added to the folder.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){f.warning("Some of the datasets could not be added to the folder")}}}Galaxy.modal.hide();return this.added_hdas}var j=$.when(i.save({from_hda_id:i.get("from_hda_id")}));j.done(function(k){Galaxy.libraries.folderListView.collection.add(k);g.updateProgress();g.chainCallAddingHdas(h)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallAddingHdas(h)})},chainCallDeletingHdas:function(h){var g=this;this.deleted_lddas=new d.Folder();var i=h.pop();if(typeof i==="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected datasets were deleted.")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){f.error("There was an error and no datasets were deleted. Please make sure you have sufficient permissions.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){f.warning("Some of the datasets could not be deleted. Please make sure you have sufficient permissions.")}}}Galaxy.modal.hide();return this.deleted_lddas}var j=$.when(i.destroy());j.done(function(l){Galaxy.libraries.folderListView.collection.remove(i.id);g.updateProgress();if(Galaxy.libraries.folderListView.options.include_deleted){var k=new d.Item(l);Galaxy.libraries.folderListView.collection.add(k)}g.chainCallDeletingHdas(h)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallDeletingHdas(h)})},checkIncludeDeleted:function(g){if(g.target.checked){Galaxy.libraries.folderListView.fetchFolder({include_deleted:true})}else{Galaxy.libraries.folderListView.fetchFolder({include_deleted:false})}},deleteSelectedDatasets:function(){var g=$("#folder_table").find(":checked");if(g.length===0){f.info("You must select at least one dataset for deletion.")}else{var k=this.templateDeletingDatasetsProgressBar();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Deleting selected datasets",body:k({}),buttons:{Close:function(){Galaxy.modal.hide()}}});this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var h=[];g.each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});this.progressStep=100/h.length;this.progress=0;var m=[];for(var j=h.length-1;j>=0;j--){var l=new d.Item({id:h[j]});m.push(l)}this.options.chain_call_control.total_number=h.length;this.chainCallDeletingHdas(m)}},showLibInfo:function(){var h=Galaxy.libraries.folderListView.folderContainer.attributes.metadata.parent_library_id;var g=null;var i=this;if(Galaxy.libraries.libraryListView!==null){g=Galaxy.libraries.libraryListView.collection.get(h);this.showLibInfoModal(g)}else{g=new d.Library({id:h});g.fetch({success:function(){i.showLibInfoModal(g)},error:function(k,j){if(typeof j.responseJSON!=="undefined"){f.error(j.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})}},showLibInfoModal:function(g){var h=this.templateLibInfoInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Library Information",body:h({library:g}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(g){switch(g.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":this.importFilesFromGalaxyFolderModal({source:"importdir"});break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromGalaxyFolderModal({source:"userdir"});break;default:Galaxy.libraries.library_router.back();f.error("Invalid import source.");break}},showPageSizePrompt:function(){var g=prompt("How many items per page do you want to see?",Galaxy.libraries.preferences.get("folder_page_size"));if((g!=null)&&(g==parseInt(g))){Galaxy.libraries.preferences.set({folder_page_size:parseInt(g)});Galaxy.libraries.folderListView.render({id:this.options.id,show_page:1})}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(" <span><strong>DATA LIBRARIES</strong></span>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" class="logged-dataset-manipulation" title="Include deleted datasets" style="display:none;"> | <input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"> include deleted | </input></span>');tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder"></span></button>');tmpl_array.push("<% if(mutiple_add_dataset_options) { %>");tmpl_array.push(' <div class="btn-group add-library-items" style="display:none;">');tmpl_array.push(' <button title="Add Datasets to Current Folder" id="" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-plus"></span><span class="fa fa-file"></span><span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li><a href="#folders/<%= id %>/import/history"> from History</a></li>');tmpl_array.push("<% if(Galaxy.config.user_library_import_dir !== null) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/userdir"> from User Directory</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% if(Galaxy.config.allow_library_path_paste) { %>");tmpl_array.push(' <li class="divider"></li>');tmpl_array.push(' <li class="dropdown-header">Admins only</li>');tmpl_array.push("<% if(Galaxy.config.library_import_dir !== null) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/importdir">from Import Directory</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% if(Galaxy.config.allow_library_path_paste) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/path">from Path</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% } %>");tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push("<% } else { %>");tmpl_array.push(' <a data-placement="top" title="Add Datasets to Current Folder" style="display:none;" class="btn btn-default add-library-items" href="#folders/<%= id %>/import/history" role="button"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></a>');tmpl_array.push("<% } %>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button dataset-manipulation" style="margin-left: 0.5em; display:none;" type="button"><span class="fa fa-book"></span> to History</button>');tmpl_array.push(' <div id="toolbtn_dl" class="btn-group dataset-manipulation" style="margin-left: 0.5em; display:none; ">');tmpl_array.push(' <button title="Download selected datasets as archive" id="drop_toggle" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-download"></span> Download <span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button logged-dataset-manipulation" style="margin-left: 0.5em; display:none; " type="button"><span class="fa fa-times"></span> Delete</button>');tmpl_array.push(' <button data-id="<%- id %>" data-toggle="tooltip" data-placement="top" title="Show library information" id="toolbtn_show_libinfo" class="primary-button" style="margin-left: 0.5em;" type="button"><span class="fa fa-info-circle"></span> Library Info</button>');tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(' <span id="folder_paginator" class="library-paginator">');tmpl_array.push(" </span>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="folder_items_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateLibInfoInModal:function(){tmpl_array=[];tmpl_array.push('<div id="lif_info_modal">');tmpl_array.push("<h2>Library name:</h2>");tmpl_array.push('<p><%- library.get("name") %></p>');tmpl_array.push("<h3>Library description:</h3>");tmpl_array.push('<p><%- library.get("description") %></p>');tmpl_array.push("<h3>Library synopsis:</h3>");tmpl_array.push('<p><%- library.get("synopsis") %></p>');tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateBulkImportInModal:function(){var g=[];g.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');g.push("Select history: ");g.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');g.push(" <% _.each(histories, function(history) { %>");g.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');g.push(" <% }); %>");g.push("</select>");g.push("</span>");return _.template(g.join(""))},templateImportIntoHistoryProgressBar:function(){var g=[];g.push('<div class="import_text">');g.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");g.push("</div>");g.push('<div class="progress">');g.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');g.push(' <span class="completion_span">0% Complete</span>');g.push(" </div>");g.push("</div>");g.push("");return _.template(g.join(""))},templateAddingDatasetsProgressBar:function(){var g=[];g.push('<div class="import_text">');g.push("Adding selected datasets to library folder <b><%= _.escape(folder_name) %></b>");g.push("</div>");g.push('<div class="progress">');g.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');g.push(' <span class="completion_span">0% Complete</span>');g.push(" </div>");g.push("</div>");g.push("");return _.template(g.join(""))},templateDeletingDatasetsProgressBar:function(){var g=[];g.push('<div class="import_text">');g.push("</div>");g.push('<div class="progress">');g.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');g.push(' <span class="completion_span">0% Complete</span>');g.push(" </div>");g.push("</div>");g.push("");return _.template(g.join(""))},templateBrowserModal:function(){var g=[];g.push('<div id="file_browser_modal">');g.push('<div class="alert alert-info jstree-files-message">All files you select will be imported into the current folder.</div>');g.push('<div class="alert alert-info jstree-folders-message" style="display:none;">All files within the selected folders and their subfolders will be imported into the current folder.</div>');g.push('<div style="margin-bottom:1em;">');g.push('<label class="radio-inline">');g.push(' <input title="Switch to selecting files" type="radio" name="jstree-radio" value="jstree-disable-folders" checked="checked"> Files');g.push("</label>");g.push('<label class="radio-inline">');g.push(' <input title="Switch to selecting folders" type="radio" name="jstree-radio" value="jstree-disable-files"> Folders');g.push("</label>");g.push("</div>");g.push('<div style="margin-bottom:1em;">');g.push('<label class="checkbox-inline jstree-preserve-structure" style="display:none;">');g.push(' <input class="preserve-checkbox" type="checkbox" value="preserve_directory_structure">');g.push("Preserve directory structure");g.push(" </label>");g.push('<label class="checkbox-inline jstree-link-files" style="display:none;">');g.push(' <input class="link-checkbox" type="checkbox" value="link_files">');g.push("Link files instead of copying");g.push(" </label>");g.push("</div>");g.push('<div id="jstree_browser">');g.push("</div>");g.push("<hr />");g.push("<p>You can set extension type and genome for all imported datasets at once:</p>");g.push("<div>");g.push('Type: <span id="library_extension_select" class="library-extension-select" />');g.push(' Genome: <span id="library_genome_select" class="library-genome-select" />');g.push("</div>");g.push("</div>");return _.template(g.join(""))},templateImportPathModal:function(){var g=[];g.push('<div id="file_browser_modal">');g.push('<div class="alert alert-info jstree-folders-message">All files within the given folders and their subfolders will be imported into the current folder.</div>');g.push('<div style="margin-bottom: 0.5em;">');g.push('<label class="checkbox-inline jstree-preserve-structure">');g.push(' <input class="preserve-checkbox" type="checkbox" value="preserve_directory_structure">');g.push("Preserve directory structure");g.push(" </label>");g.push('<label class="checkbox-inline jstree-link-files">');g.push(' <input class="link-checkbox" type="checkbox" value="link_files">');g.push("Link files instead of copying");g.push(" </label>");g.push("</div>");g.push('<textarea id="import_paths" class="form-control" rows="5" placeholder="Absolute paths (or paths relative to Galaxy root) separated by newline"></textarea>');g.push("<hr />");g.push("<p>You can set extension type and genome for all imported datasets at once:</p>");g.push("<div>");g.push('Type: <span id="library_extension_select" class="library-extension-select" />');g.push(' Genome: <span id="library_genome_select" class="library-genome-select" />');g.push("</div>");g.push("</div>");return _.template(g.join(""))},templateAddFilesFromHistory:function(){var g=[];g.push('<div id="add_files_modal">');g.push('<div id="history_modal_combo_bulk">');g.push("Select history: ");g.push('<select id="dataset_add_bulk" name="dataset_add_bulk" style="width:66%; "> ');g.push(" <% _.each(histories, function(history) { %>");g.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');g.push(" <% }); %>");g.push("</select>");g.push("</div>");g.push("<br/>");g.push('<div id="selected_history_content">');g.push("</div>");g.push("</div>");return _.template(g.join(""))},templateHistoryContents:function(){var g=[];g.push("<strong>Choose the datasets to import:</strong>");g.push("<ul>");g.push(" <% _.each(history_contents, function(history_item) { %>");g.push(' <li data-id="<%= _.escape(history_item.get("id")) %>">');g.push(' <input style="margin: 0;" type="checkbox"><%= _.escape(history_item.get("hid")) %>: <%= _.escape(history_item.get("name")) %>');g.push(" </li>");g.push(" <% }); %>");g.push("</ul>");return _.template(g.join(""))},templatePaginator:function(){tmpl_array=[];tmpl_array.push(' <ul class="pagination pagination-sm">');tmpl_array.push(" <% if ( ( show_page - 1 ) > 0 ) { %>");tmpl_array.push(" <% if ( ( show_page - 1 ) > page_count ) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li class="disabled"><a href="#folders/<%= id %>/page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li><a href="#folders/<%= id %>/page/<% print( show_page - 1 ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li class="disabled"><a href="#folders/<%= id %>/page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li class="disabled"><a href="#folders/<%= id %>/page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(' <li class="active">');tmpl_array.push(' <a href="#folders/<%= id %>/page/<% print( show_page ) %>"><% print( show_page ) %></a>');tmpl_array.push(" </li>");tmpl_array.push(" <% if ( ( show_page ) < page_count ) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/page/<% print( show_page + 1 ) %>"><% print( show_page + 1 ) %></a></li>');tmpl_array.push(' <li><a href="#folders/<%= id %>/page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li class="disabled"><a href="#folders/<%= id %>/page/<% print( show_page ) %>"><% print( show_page + 1 ) %></a></li>');tmpl_array.push(' <li class="disabled"><a href="#folders/<%= id %>/page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(" </ul>");tmpl_array.push(" <span>");tmpl_array.push(' showing <a data-toggle="tooltip" data-placement="top" title="Click to change the number of items on page" id="page_size_prompt"><%- items_shown %></a> of <%- total_items_count %> items');tmpl_array.push(" </span>");return _.template(tmpl_array.join(""))},});return{FolderToolbarView: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.
1
0
commit/galaxy-central: natefoo: Rename the egg env vars back to GALAXY_* now that they are not config file options anymore.
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/916aee1b2e3d/
Changeset: 916aee1b2e3d
User: natefoo
Date: 2015-02-12 20:42:50+00:00
Summary: Rename the egg env vars back to GALAXY_* now that they are not config file options anymore.
Affected #: 3 files
diff -r 6730c4cb28dead6bbf57a3e1f599136ab71dd34d -r 916aee1b2e3d74015a727133cd7f4a2ef9c1a447 lib/galaxy/eggs/__init__.py
--- a/lib/galaxy/eggs/__init__.py
+++ b/lib/galaxy/eggs/__init__.py
@@ -293,9 +293,9 @@
self.py_platform = None
if platform is not None:
self.py_platform = platform.split( '-' )[0]
- self.enable_egg_fetch = string_as_bool(os.environ.get('GALAXY_CONFIG_ENABLE_EGG_FETCH', True))
- self.enable_eggs = string_as_bool(os.environ.get('GALAXY_CONFIG_ENABLE_EGGS', True))
- self.try_dependencies_from_env = string_as_bool(os.environ.get('GALAXY_CONFIG_TRY_DEPENDENCIES_FROM_ENV', False))
+ self.enable_egg_fetch = string_as_bool(os.environ.get('GALAXY_ENABLE_EGG_FETCH', True))
+ self.enable_eggs = string_as_bool(os.environ.get('GALAXY_ENABLE_EGGS', True))
+ self.try_dependencies_from_env = string_as_bool(os.environ.get('GALAXY_TRY_DEPENDENCIES_FROM_ENV', False))
self.galaxy_config = GalaxyConfig( galaxy_config_file )
self.parse()
diff -r 6730c4cb28dead6bbf57a3e1f599136ab71dd34d -r 916aee1b2e3d74015a727133cd7f4a2ef9c1a447 lib/galaxy/jobs/runners/__init__.py
--- a/lib/galaxy/jobs/runners/__init__.py
+++ b/lib/galaxy/jobs/runners/__init__.py
@@ -274,7 +274,7 @@
env = []
crate = galaxy.eggs.Crate()
for opt in ('enable_egg_fetch', 'enable_eggs', 'try_dependencies_from_env'):
- env.append('GALAXY_CONFIG_%s="%s"; export GALAXY_CONFIG_%s' % (opt.upper(), getattr(crate, opt), opt.upper()))
+ env.append('GALAXY_%s="%s"; export GALAXY_%s' % (opt.upper(), getattr(crate, opt), opt.upper()))
return env
def get_job_file(self, job_wrapper, **kwds):
diff -r 6730c4cb28dead6bbf57a3e1f599136ab71dd34d -r 916aee1b2e3d74015a727133cd7f4a2ef9c1a447 requirements.txt
--- a/requirements.txt
+++ b/requirements.txt
@@ -12,7 +12,7 @@
# However, you may want to manage these dependencies on your own. If so, this
# file can be used with pip to install all of the bare minimum dependencies for
# starting a Galaxy server. Use this in conjunction with the
-# `GALAXY_CONFIG_ENABLE_EGGS=False` environment variable.
+# `GALAXY_ENABLE_EGGS=False` environment variable.
#
# Note that except in the case of SQLAlchemy, all dependencies will be
# installed at their newest versions. Galaxy has not been tested with these and
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.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a8d9371efef9/
Changeset: a8d9371efef9
User: carlfeberhard
Date: 2015-02-12 20:35:24+00:00
Summary: Core: move handlebars load before require (stackoverflow.com/questions/15371918) minor clean up
Affected #: 4 files
diff -r d540227165d54950208d3948e2bdecd4babc70ca -r a8d9371efef9f10e6c4fce18a6da8ed7916f10ba client/galaxy/scripts/mvc/history/multi-panel.js
--- a/client/galaxy/scripts/mvc/history/multi-panel.js
+++ b/client/galaxy/scripts/mvc/history/multi-panel.js
@@ -219,7 +219,7 @@
render : function render( speed ){
speed = ( speed !== undefined )?( speed ):( 'fast' );
//this.log( this + '.render', this.$el, this.el );
-//TODO: not needed
+ //TODO: not needed
var modelData = this.model? this.model.toJSON(): {};
this.$el.html( this.template( modelData ) );
this.renderPanel( speed );
@@ -240,68 +240,21 @@
/** column body template with inner div for panel based on data (model json) */
template : function template( data ){
- data = data || {};
- var html = [
- '<div class="panel-controls clear flex-row">',
- this.controlsLeftTemplate( data ),
- //'<button class="btn btn-default">Herp</button>',
- this.controlsRightTemplate( data ),
- '</div>',
- '<div class="inner flex-row flex-column-container">',
- '<div id="history-', data.id, '" class="history-column history-panel flex-column"></div>',
- '</div>'
- ].join( '' );
- return $( html );
+ data = _.extend( data || {}, {
+ isCurrentHistory : this.currentHistory
+ });
+ return $([
+ '<div class="panel-controls clear flex-row">',
+ this.controlsLeftTemplate( data ),
+ //'<button class="btn btn-default">Herp</button>',
+ this.controlsRightTemplate( data ),
+ '</div>',
+ '<div class="inner flex-row flex-column-container">',
+ '<div id="history-', data.id, '" class="history-column history-panel flex-column"></div>',
+ '</div>'
+ ].join( '' ));
},
- /** controls template displaying controls above the panel based on this.currentHistory */
- controlsLeftTemplate : function( data ){
- return ( this.currentHistory )?
- [
- '<div class="pull-left">',
- '<strong class="current-label">', _l( 'Current History' ), '</strong>',
- '</div>'
- ].join( '' )
- :[
- '<div class="pull-left">',
- '<button class="switch-to btn btn-default">', _l( 'Switch to' ), '</button>',
- '</div>'
- ].join( '' );
- },
-
- /** controls template displaying controls above the panel based on this.currentHistory */
- controlsRightTemplate : _.template([
- '<div class="pull-right">',
- '<% if( !history.purged ){ %>',
- '<div class="panel-menu order btn-group">',
- '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
- '<span class="caret"></span>',
- '</button>',
- '<ul class="dropdown-menu pull-right" role="menu">',
- '<% if( !history.deleted ){ %>',
- '<li><a href="javascript:void(0);" class="copy-history">',
- _l( 'Copy' ),
- '</a></li>',
- //'<li><a href="javascript:void(0);" class="publish-history">',
- // _l( 'Publish' ),
- //'</a></li>',
- '<li><a href="javascript:void(0);" class="delete-history">',
- _l( 'Delete' ),
- '</a></li>',
- '<% } else /* if is deleted */ { %>',
- '<li><a href="javascript:void(0);" class="undelete-history">',
- _l( 'Undelete' ),
- '</a></li>',
- '<% } %>',
- //'<li><a href="javascript:void(0);" class="purge-history">',
- // _l( 'Purge' ),
- //'</a></li>',
- '</ul>',
- '<% } %>',
- '</div>',
- '</div>'
- ].join( '' ), { variable: 'history' }),
-
/** render the panel contained in the column using speed for fx speed */
renderPanel : function renderPanel( speed ){
speed = ( speed !== undefined )?( speed ):( 'fast' );
@@ -360,6 +313,51 @@
historyCopyDialog( this.model );
},
+ // ------------------------------------------------------------------------ templates
+ /** controls template displaying controls above the panel based on this.currentHistory */
+ controlsLeftTemplate : _.template([
+ '<div class="pull-left">',
+ '<% if( history.isCurrentHistory ){ %>',
+ '<strong class="current-label">', _l( 'Current History' ), '</strong>',
+ '<% } else { %>',
+ '<button class="switch-to btn btn-default">', _l( 'Switch to' ), '</button>',
+ '<% } %>',
+ '</div>'
+ ].join( '' ), { variable : 'history' }),
+
+ /** controls template displaying controls above the panel based on this.currentHistory */
+ controlsRightTemplate : _.template([
+ '<div class="pull-right">',
+ '<% if( !history.purged ){ %>',
+ '<div class="panel-menu order btn-group">',
+ '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
+ '<span class="caret"></span>',
+ '</button>',
+ '<ul class="dropdown-menu pull-right" role="menu">',
+ '<% if( !history.deleted ){ %>',
+ '<li><a href="javascript:void(0);" class="copy-history">',
+ _l( 'Copy' ),
+ '</a></li>',
+ //'<li><a href="javascript:void(0);" class="publish-history">',
+ // _l( 'Publish' ),
+ //'</a></li>',
+ '<li><a href="javascript:void(0);" class="delete-history">',
+ _l( 'Delete' ),
+ '</a></li>',
+ '<% } else /* if is deleted */ { %>',
+ '<li><a href="javascript:void(0);" class="undelete-history">',
+ _l( 'Undelete' ),
+ '</a></li>',
+ '<% } %>',
+ //'<li><a href="javascript:void(0);" class="purge-history">',
+ // _l( 'Purge' ),
+ //'</a></li>',
+ '</ul>',
+ '<% } %>',
+ '</div>',
+ '</div>'
+ ].join( '' ), { variable: 'history' }),
+
// ------------------------------------------------------------------------ misc
/** String rep */
toString : function(){
@@ -388,7 +386,7 @@
}
this.currentHistoryId = options.currentHistoryId;
-//TODO: move these to some defaults
+ //TODO: move these to some defaults
this.options = {
columnWidth : 312,
borderWidth : 1,
@@ -632,7 +630,7 @@
multipanel._recalcFirstColumnHeight();
}
-//TODO: to freeColumn (where Columns have freePanel)
+ //TODO: to freeColumn (where Columns have freePanel)
multipanel.stopListening( column.panel );
multipanel.stopListening( column );
delete multipanel.columnMap[ column.model.id ];
diff -r d540227165d54950208d3948e2bdecd4babc70ca -r a8d9371efef9f10e6c4fce18a6da8ed7916f10ba static/scripts/mvc/history/multi-panel.js
--- a/static/scripts/mvc/history/multi-panel.js
+++ b/static/scripts/mvc/history/multi-panel.js
@@ -219,7 +219,7 @@
render : function render( speed ){
speed = ( speed !== undefined )?( speed ):( 'fast' );
//this.log( this + '.render', this.$el, this.el );
-//TODO: not needed
+ //TODO: not needed
var modelData = this.model? this.model.toJSON(): {};
this.$el.html( this.template( modelData ) );
this.renderPanel( speed );
@@ -240,68 +240,21 @@
/** column body template with inner div for panel based on data (model json) */
template : function template( data ){
- data = data || {};
- var html = [
- '<div class="panel-controls clear flex-row">',
- this.controlsLeftTemplate( data ),
- //'<button class="btn btn-default">Herp</button>',
- this.controlsRightTemplate( data ),
- '</div>',
- '<div class="inner flex-row flex-column-container">',
- '<div id="history-', data.id, '" class="history-column history-panel flex-column"></div>',
- '</div>'
- ].join( '' );
- return $( html );
+ data = _.extend( data || {}, {
+ isCurrentHistory : this.currentHistory
+ });
+ return $([
+ '<div class="panel-controls clear flex-row">',
+ this.controlsLeftTemplate( data ),
+ //'<button class="btn btn-default">Herp</button>',
+ this.controlsRightTemplate( data ),
+ '</div>',
+ '<div class="inner flex-row flex-column-container">',
+ '<div id="history-', data.id, '" class="history-column history-panel flex-column"></div>',
+ '</div>'
+ ].join( '' ));
},
- /** controls template displaying controls above the panel based on this.currentHistory */
- controlsLeftTemplate : function( data ){
- return ( this.currentHistory )?
- [
- '<div class="pull-left">',
- '<strong class="current-label">', _l( 'Current History' ), '</strong>',
- '</div>'
- ].join( '' )
- :[
- '<div class="pull-left">',
- '<button class="switch-to btn btn-default">', _l( 'Switch to' ), '</button>',
- '</div>'
- ].join( '' );
- },
-
- /** controls template displaying controls above the panel based on this.currentHistory */
- controlsRightTemplate : _.template([
- '<div class="pull-right">',
- '<% if( !history.purged ){ %>',
- '<div class="panel-menu order btn-group">',
- '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
- '<span class="caret"></span>',
- '</button>',
- '<ul class="dropdown-menu pull-right" role="menu">',
- '<% if( !history.deleted ){ %>',
- '<li><a href="javascript:void(0);" class="copy-history">',
- _l( 'Copy' ),
- '</a></li>',
- //'<li><a href="javascript:void(0);" class="publish-history">',
- // _l( 'Publish' ),
- //'</a></li>',
- '<li><a href="javascript:void(0);" class="delete-history">',
- _l( 'Delete' ),
- '</a></li>',
- '<% } else /* if is deleted */ { %>',
- '<li><a href="javascript:void(0);" class="undelete-history">',
- _l( 'Undelete' ),
- '</a></li>',
- '<% } %>',
- //'<li><a href="javascript:void(0);" class="purge-history">',
- // _l( 'Purge' ),
- //'</a></li>',
- '</ul>',
- '<% } %>',
- '</div>',
- '</div>'
- ].join( '' ), { variable: 'history' }),
-
/** render the panel contained in the column using speed for fx speed */
renderPanel : function renderPanel( speed ){
speed = ( speed !== undefined )?( speed ):( 'fast' );
@@ -360,6 +313,51 @@
historyCopyDialog( this.model );
},
+ // ------------------------------------------------------------------------ templates
+ /** controls template displaying controls above the panel based on this.currentHistory */
+ controlsLeftTemplate : _.template([
+ '<div class="pull-left">',
+ '<% if( history.isCurrentHistory ){ %>',
+ '<strong class="current-label">', _l( 'Current History' ), '</strong>',
+ '<% } else { %>',
+ '<button class="switch-to btn btn-default">', _l( 'Switch to' ), '</button>',
+ '<% } %>',
+ '</div>'
+ ].join( '' ), { variable : 'history' }),
+
+ /** controls template displaying controls above the panel based on this.currentHistory */
+ controlsRightTemplate : _.template([
+ '<div class="pull-right">',
+ '<% if( !history.purged ){ %>',
+ '<div class="panel-menu order btn-group">',
+ '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
+ '<span class="caret"></span>',
+ '</button>',
+ '<ul class="dropdown-menu pull-right" role="menu">',
+ '<% if( !history.deleted ){ %>',
+ '<li><a href="javascript:void(0);" class="copy-history">',
+ _l( 'Copy' ),
+ '</a></li>',
+ //'<li><a href="javascript:void(0);" class="publish-history">',
+ // _l( 'Publish' ),
+ //'</a></li>',
+ '<li><a href="javascript:void(0);" class="delete-history">',
+ _l( 'Delete' ),
+ '</a></li>',
+ '<% } else /* if is deleted */ { %>',
+ '<li><a href="javascript:void(0);" class="undelete-history">',
+ _l( 'Undelete' ),
+ '</a></li>',
+ '<% } %>',
+ //'<li><a href="javascript:void(0);" class="purge-history">',
+ // _l( 'Purge' ),
+ //'</a></li>',
+ '</ul>',
+ '<% } %>',
+ '</div>',
+ '</div>'
+ ].join( '' ), { variable: 'history' }),
+
// ------------------------------------------------------------------------ misc
/** String rep */
toString : function(){
@@ -388,7 +386,7 @@
}
this.currentHistoryId = options.currentHistoryId;
-//TODO: move these to some defaults
+ //TODO: move these to some defaults
this.options = {
columnWidth : 312,
borderWidth : 1,
@@ -632,7 +630,7 @@
multipanel._recalcFirstColumnHeight();
}
-//TODO: to freeColumn (where Columns have freePanel)
+ //TODO: to freeColumn (where Columns have freePanel)
multipanel.stopListening( column.panel );
multipanel.stopListening( column );
delete multipanel.columnMap[ column.model.id ];
diff -r d540227165d54950208d3948e2bdecd4babc70ca -r a8d9371efef9f10e6c4fce18a6da8ed7916f10ba static/scripts/packed/mvc/history/multi-panel.js
--- a/static/scripts/packed/mvc/history/multi-panel.js
+++ b/static/scripts/packed/mvc/history/multi-panel.js
@@ -1,1 +1,1 @@
-define(["mvc/history/history-model","mvc/history/history-panel-edit","mvc/base-mvc","utils/ajax-queue","ui/mode-button","ui/search-input"],function(d,l,z,a){function g(I,E){E=E||{};if(!(Galaxy&&Galaxy.modal)){return I.copy()}var F=I.get("name"),C="Copy of '"+F+"'";function D(K){if(!K){if(!Galaxy.modal.$("#invalid-title").size()){var J=$("<p/>").attr("id","invalid-title").css({color:"red","margin-top":"8px"}).addClass("bg-danger").text(_l("Please enter a valid history title"));Galaxy.modal.$(".modal-body").append(J)}return false}return K}function G(J){var K=$('<p><span class="fa fa-spinner fa-spin"></span> Copying history...</p>').css("margin-top","8px");Galaxy.modal.$(".modal-body").append(K);I.copy(true,J).fail(function(){alert(_l("History could not be copied. Please contact a Galaxy administrator"))}).always(function(){Galaxy.modal.hide()})}function H(){var J=Galaxy.modal.$("#copy-modal-title").val();if(!D(J)){return}G(J)}Galaxy.modal.show(_.extend({title:_l("Copying history")+' "'+F+'"',body:$(['<label for="copy-modal-title">',_l("Enter a title for the copied history"),":","</label><br />",'<input id="copy-modal-title" class="form-control" style="width: 100%" value="',C,'" />'].join("")),buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:H}},E));$("#copy-modal-title").focus().select();$("#copy-modal-title").on("keydown",function(J){if(J.keyCode===13){H()}})}var B=Backbone.View.extend(z.LoggableMixin).extend({tagName:"div",className:"history-column flex-column flex-row-container",id:function q(){if(!this.model){return""}return"history-column-"+this.model.get("id")},initialize:function c(C){C=C||{};this.panel=C.panel||this.createPanel(C);this.setUpListeners()},createPanel:function u(D){D=_.extend({model:this.model,dragItems:true},D);var C=new l.HistoryPanelEdit(D);C._renderEmptyMessage=this.__patch_renderEmptyMessage;return C},__patch_renderEmptyMessage:function(E){var D=this,F=_.chain(this.model.get("state_ids")).values().flatten().value().length,C=D.$emptyMessage(E);if(!_.isEmpty(D.hdaViews)){C.hide()}else{if(F&&!this.model.contents.length){C.empty().append($('<span class="fa fa-spinner fa-spin"></span><i>loading datasets...</i>')).show()}else{if(D.searchFor){C.text(D.noneFoundMsg).show()}else{C.text(D.emptyMsg).show()}}}return C},setUpListeners:function f(){var C=this;this.once("rendered",function(){C.trigger("rendered:initial",C)});this.setUpPanelListeners()},setUpPanelListeners:function k(){var C=this;this.listenTo(this.panel,{rendered:function(){C.trigger("rendered",C)}},this)},inView:function(C,D){var F=this.$el.offset().left,E=F+this.$el.width();if(E<C){return false}if(F>D){return false}return true},$panel:function e(){return this.$(".history-panel")},render:function A(D){D=(D!==undefined)?(D):("fast");var C=this.model?this.model.toJSON():{};this.$el.html(this.template(C));this.renderPanel(D);this.setUpBehaviors();return this},setUpBehaviors:function v(){},template:function w(D){D=D||{};var C=['<div class="panel-controls clear flex-row">',this.controlsLeftTemplate(D),this.controlsRightTemplate(D),"</div>",'<div class="inner flex-row flex-column-container">','<div id="history-',D.id,'" class="history-column history-panel flex-column"></div>',"</div>"].join("");return $(C)},controlsLeftTemplate:function(C){return(this.currentHistory)?['<div class="pull-left">','<strong class="current-label">',_l("Current History"),"</strong>","</div>"].join(""):['<div class="pull-left">','<button class="switch-to btn btn-default">',_l("Switch to"),"</button>","</div>"].join("")},controlsRightTemplate:_.template(['<div class="pull-right">',"<% if( !history.purged ){ %>",'<div class="panel-menu order btn-group">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">','<span class="caret"></span>',"</button>",'<ul class="dropdown-menu pull-right" role="menu">',"<% if( !history.deleted ){ %>",'<li><a href="javascript:void(0);" class="copy-history">',_l("Copy"),"</a></li>",'<li><a href="javascript:void(0);" class="delete-history">',_l("Delete"),"</a></li>","<% } else /* if is deleted */ { %>",'<li><a href="javascript:void(0);" class="undelete-history">',_l("Undelete"),"</a></li>","<% } %>","</ul>","<% } %>","</div>","</div>"].join(""),{variable:"history"}),renderPanel:function h(C){C=(C!==undefined)?(C):("fast");this.panel.setElement(this.$panel()).render(C);if(this.currentHistory){this.panel.$list().before(this.panel._renderDropTargetHelp())}return this},events:{"click .switch-to.btn":function(){this.model.setAsCurrent()},"click .delete-history":function(){var C=this;this.model._delete().fail(function(F,D,E){alert(_l("Could not delete the history")+":\n"+E)}).done(function(D){C.render()})},"click .undelete-history":function(){var C=this;this.model.undelete().fail(function(F,D,E){alert(_l("Could not undelete the history")+":\n"+E)}).done(function(D){C.render()})},"click .purge-history":function(){if(confirm(_l("This will permanently remove the data. Are you sure?"))){var C=this;this.model.purge().fail(function(F,D,E){alert(_l("Could not purge the history")+":\n"+E)}).done(function(D){C.render()})}},"click .copy-history":"copy"},copy:function s(){g(this.model)},toString:function(){return"HistoryPanelColumn("+(this.panel?this.panel:"")+")"}});var m=Backbone.View.extend(z.LoggableMixin).extend({className:"multi-history-columns",initialize:function c(C){C=C||{};this.log(this+".init",C);if(!C.currentHistoryId){throw new Error(this+" requires a currentHistoryId in the options")}this.currentHistoryId=C.currentHistoryId;this.options={columnWidth:312,borderWidth:1,columnGap:8,headerHeight:29,footerHeight:0,controlsHeight:20};this.order=C.order||"update";this.hdaQueue=new a.NamedAjaxQueue([],false);this.collection=null;this.setCollection(C.histories||[]);this.columnMap={};this.createColumns(C.columnOptions);this.setUpListeners()},setUpListeners:function f(){},setCollection:function y(D){var C=this;C.stopListening(C.collection);C.collection=D;C.sortCollection(C.order,{silent:true});C.setUpCollectionListeners();C.trigger("new-collection",C);return C},setUpCollectionListeners:function(){var C=this,D=C.collection;C.listenTo(D,{add:C.addAsCurrentColumn,"set-as-current":C.setCurrentHistory,"change:deleted":C.handleDeletedHistory,sort:function(){C.renderColumns(0)}})},setCurrentHistory:function p(D){var C=this.columnMap[this.currentHistoryId];if(C){C.currentHistory=false;C.$el.height("")}this.currentHistoryId=D.id;var E=this.columnMap[this.currentHistoryId];E.currentHistory=true;this.sortCollection();multipanel._recalcFirstColumnHeight();return E},handleDeletedHistory:function b(D){if(D.get("deleted")){this.log("handleDeletedHistory",this.collection.includeDeleted,D);var C=this;column=C.columnMap[D.id];if(!column){return}if(column.model.id===this.currentHistoryId){}else{if(!C.collection.includeDeleted){C.removeColumn(column)}}}},sortCollection:function(C,D){C=C||this.order;var E=this.currentHistoryId;switch(C){case"name":this.collection.comparator=function(F){return[F.id!==E,F.get("name").toLowerCase()]};break;case"size":this.collection.comparator=function(F){return[F.id!==E,F.get("size")]};break;default:this.collection.comparator=function(F){return[F.id!==E,Date(F.get("update_time"))]}}this.collection.sort(D);return this.collection},setOrder:function(C){if(["update","name","size"].indexOf(C)===-1){C="update"}this.order=C;this.trigger("order:change",C,this);this.$(".current-order").text(C);this.sortCollection();return this},create:function(C){return this.collection.create({current:true})},createColumns:function r(D){D=D||{};var C=this;this.columnMap={};C.collection.each(function(E,F){var G=C.createColumn(E,D);C.columnMap[E.id]=G})},createColumn:function t(E,C){C=_.extend({},C,{model:E});var D=new B(C);if(E.id===this.currentHistoryId){D.currentHistory=true}this.setUpColumnListeners(D);return D},sortedFilteredColumns:function(C){C=C||this.filters;if(!C||!C.length){return this.sortedColumns()}var D=this;return D.sortedColumns().filter(function(G,F){var E=G.currentHistory||_.every(C.map(function(H){return H.call(G)}));return E})},sortedColumns:function(){var D=this;var C=this.collection.map(function(F,E){return D.columnMap[F.id]});return C},addColumn:function o(E,C){C=C!==undefined?C:true;var D=this.createColumn(E);this.columnMap[E.id]=D;if(C){this.renderColumns()}return D},addAsCurrentColumn:function o(E){var D=this,C=this.addColumn(E,false);this.setCurrentHistory(E);C.once("rendered",function(){D.queueHdaFetch(C)});return C},removeColumn:function x(E,D){D=D!==undefined?D:true;this.log("removeColumn",E);if(!E){return}var F=this,C=this.options.columnWidth+this.options.columnGap;E.$el.fadeOut("fast",function(){if(D){$(this).remove();F.$(".middle").width(F.$(".middle").width()-C);F.checkColumnsInView();F._recalcFirstColumnHeight()}F.stopListening(E.panel);F.stopListening(E);delete F.columnMap[E.model.id];E.remove()})},setUpColumnListeners:function n(C){var D=this;D.listenTo(C,{"in-view":D.queueHdaFetch});D.listenTo(C.panel,{"view:draggable:dragstart":function(H,F,E,G){D._dropData=JSON.parse(H.dataTransfer.getData("text"));D.currentColumnDropTargetOn()},"view:draggable:dragend":function(H,F,E,G){D._dropData=null;D.currentColumnDropTargetOff()},"droptarget:drop":function(G,H,F){var I=D._dropData.filter(function(J){return(_.isObject(J)&&J.id&&J.model_class==="HistoryDatasetAssociation")});D._dropData=null;var E=new a.NamedAjaxQueue();I.forEach(function(J){E.add({name:"copy-"+J.id,fn:function(){return F.model.contents.copy(J.id)}})});E.start();E.done(function(J){F.model.fetch()})}})},columnMapLength:function(){return Object.keys(this.columnMap).length},render:function A(D){D=D!==undefined?D:this.fxSpeed;var C=this;C.log(C+".render");C.$el.html(C.mainTemplate(C));C.renderColumns(D);C.setUpBehaviors();C.trigger("rendered",C);return C},renderColumns:function j(F){F=F!==undefined?F:this.fxSpeed;var E=this,C=E.sortedFilteredColumns();E.$(".middle").width(C.length*(this.options.columnWidth+this.options.columnGap)+this.options.columnGap+16);var D=E.$(".middle");D.empty();C.forEach(function(H,G){H.$el.appendTo(D);H.delegateEvents();E.renderColumn(H,F)});if(this.searchFor&&C.length<=1){}else{E.checkColumnsInView();this._recalcFirstColumnHeight()}return C},renderColumn:function(C,D){D=D!==undefined?D:this.fxSpeed;return C.render(D)},queueHdaFetch:function i(E){if(E.model.contents.length===0&&!E.model.get("empty")){var C={},D=_.values(E.panel.storage.get("expandedIds")).join();if(D){C.dataset_details=D}this.hdaQueue.add({name:E.model.id,fn:function(){var F=E.model.contents.fetch({data:C,silent:true});return F.done(function(G){E.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},queueHdaFetchDetails:function(C){if((C.model.contents.length===0&&!C.model.get("empty"))||(!C.model.contents.haveDetails())){this.hdaQueue.add({name:C.model.id,fn:function(){var D=C.model.contents.fetch({data:{details:"all"},silent:true});return D.done(function(E){C.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},renderInfo:function(C){this.$(".header .header-info").text(C)},events:{"click .done.btn":"close","click .create-new.btn":"create","click #include-deleted":"_clickToggleDeletedHistories","click .order .order-update":function(C){this.setOrder("update")},"click .order .order-name":function(C){this.setOrder("name")},"click .order .order-size":function(C){this.setOrder("size")},"click #toggle-deleted":"_clickToggleDeletedDatasets","click #toggle-hidden":"_clickToggleHiddenDatasets"},close:function(D){var C="/";if(Galaxy&&Galaxy.options&&Galaxy.options.root){C=Galaxy.options.root}else{if(galaxy_config&&galaxy_config.root){C=galaxy_config.root}}window.location=C},_clickToggleDeletedHistories:function(C){return this.toggleDeletedHistories($(C.currentTarget).is(":checked"))},toggleDeletedHistories:function(C){if(C){window.location=Galaxy.options.root+"history/view_multiple?include_deleted_histories=True"}else{window.location=Galaxy.options.root+"history/view_multiple"}},_clickToggleDeletedDatasets:function(C){return this.toggleDeletedDatasets($(C.currentTarget).is(":checked"))},toggleDeletedDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowDeleted(C,false)},E*200)})},_clickToggleHiddenDatasets:function(C){return this.toggleHiddenDatasets($(C.currentTarget).is(":checked"))},toggleHiddenDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowHidden(C,false)},E*200)})},setUpBehaviors:function(){var D=this;D._moreOptionsPopover();D.$("#search-histories").searchInput({name:"search-histories",placeholder:_l("search histories"),onsearch:function(E){D.searchFor=E;D.filters=[function(){return this.model.matchesAll(D.searchFor)}];D.renderColumns(0)},onclear:function(E){D.searchFor=null;D.filters=[];D.renderColumns(0)}});D.$("#search-datasets").searchInput({name:"search-datasets",placeholder:_l("search all datasets"),onfirstsearch:function(E){D.hdaQueue.clear();D.$("#search-datasets").searchInput("toggle-loading");D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E);D.queueHdaFetchDetails(F)});D.hdaQueue.progress(function(F){D.renderInfo([_l("searching"),(F.curr+1),_l("of"),F.total].join(" "))});D.hdaQueue.deferred.done(function(){D.renderInfo("");D.$("#search-datasets").searchInput("toggle-loading")})},onsearch:function(E){D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E)})},onclear:function(E){D.searchFor=null;D.sortedFilteredColumns().forEach(function(F){F.panel.clearSearch()})}});$(window).resize(function(){D._recalcFirstColumnHeight()});var C=_.debounce(_.bind(this.checkColumnsInView,this),100);this.$(".middle").parent().scroll(C)},_moreOptionsPopover:function(){return this.$(".open-more-options.btn").popover({container:".header",placement:"bottom",html:true,content:$(this.optionsPopoverTemplate(this))})},_recalcFirstColumnHeight:function(){var C=this.$(".history-column").first(),E=this.$(".middle").height(),D=C.find(".panel-controls").height();C.height(E).find(".inner").height(E-D)},_viewport:function(){var C=this.$(".middle").parent().offset().left;return{left:C,right:C+this.$(".middle").parent().width()}},columnsInView:function(){var C=this._viewport();return this.sortedFilteredColumns().filter(function(D){return D.currentHistory||D.inView(C.left,C.right)})},checkColumnsInView:function(){this.columnsInView().forEach(function(C){C.trigger("in-view",C)})},currentColumnDropTargetOn:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=function(D){};C.panel.dropTargetOn()},currentColumnDropTargetOff:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=l.HistoryPanelEdit.prototype.dataDrop;C.panel.dropTarget=false;C.panel.$(".history-drop-target").remove()},toString:function(){return"MultiPanelColumns("+(this.columns?this.columns.length:0)+")"},mainTemplate:_.template(['<div class="header flex-column-container">','<div class="control-column control-column-left flex-column">','<button class="create-new btn btn-default">',_l("Create new"),"</button> ",'<div id="search-histories" class="search-control"></div>','<div id="search-datasets" class="search-control"></div>','<button class="open-more-options btn btn-default">','<span class="fa fa-ellipsis-h" title="More options"></span>',"</button>","</div>",'<div class="control-column control-column-center flex-column">','<div class="header-info">',"</div>","</div>",'<div class="control-column control-column-right flex-column">','<button class="done btn btn-default">',_l("Done"),"</button>","</div>","</div>",'<div class="outer-middle flex-row flex-row-container">','<div class="middle flex-column-container flex-row"></div>',"</div>",'<div class="footer flex-column-container">',"</div>"].join(""),{variable:"view"}),optionsPopoverTemplate:_.template(['<div class="more-options">','<div class="checkbox"><label><input id="include-deleted" type="checkbox"','<%= view.collection.includeDeleted? " checked" : "" %>>',_l("Include deleted histories"),"</label></div>",'<div class="order btn-group">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',_l("Order histories by")+" ",'<span class="current-order"><%= view.order %></span> ','<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="javascript:void(0);" class="order-update">',_l("Time of last update"),"</a></li>",'<li><a href="javascript:void(0);" class="order-name">',_l("Name"),"</a></li>",'<li><a href="javascript:void(0);" class="order-size">',_l("Size"),"</a></li>","</ul>","</div>",'<div class="checkbox"><label><input id="toggle-deleted" type="checkbox">',_l("Include deleted datasets"),"</label></div>",'<div class="checkbox"><label><input id="toggle-hidden" type="checkbox">',_l("Include hidden datasets"),"</label></div>","</div>"].join(""),{variable:"view"})});return{MultiPanelColumns:m}});
\ No newline at end of file
+define(["mvc/history/history-model","mvc/history/history-panel-edit","mvc/base-mvc","utils/ajax-queue","ui/mode-button","ui/search-input"],function(d,l,z,a){function g(I,E){E=E||{};if(!(Galaxy&&Galaxy.modal)){return I.copy()}var F=I.get("name"),C="Copy of '"+F+"'";function D(K){if(!K){if(!Galaxy.modal.$("#invalid-title").size()){var J=$("<p/>").attr("id","invalid-title").css({color:"red","margin-top":"8px"}).addClass("bg-danger").text(_l("Please enter a valid history title"));Galaxy.modal.$(".modal-body").append(J)}return false}return K}function G(J){var K=$('<p><span class="fa fa-spinner fa-spin"></span> Copying history...</p>').css("margin-top","8px");Galaxy.modal.$(".modal-body").append(K);I.copy(true,J).fail(function(){alert(_l("History could not be copied. Please contact a Galaxy administrator"))}).always(function(){Galaxy.modal.hide()})}function H(){var J=Galaxy.modal.$("#copy-modal-title").val();if(!D(J)){return}G(J)}Galaxy.modal.show(_.extend({title:_l("Copying history")+' "'+F+'"',body:$(['<label for="copy-modal-title">',_l("Enter a title for the copied history"),":","</label><br />",'<input id="copy-modal-title" class="form-control" style="width: 100%" value="',C,'" />'].join("")),buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:H}},E));$("#copy-modal-title").focus().select();$("#copy-modal-title").on("keydown",function(J){if(J.keyCode===13){H()}})}var B=Backbone.View.extend(z.LoggableMixin).extend({tagName:"div",className:"history-column flex-column flex-row-container",id:function q(){if(!this.model){return""}return"history-column-"+this.model.get("id")},initialize:function c(C){C=C||{};this.panel=C.panel||this.createPanel(C);this.setUpListeners()},createPanel:function u(D){D=_.extend({model:this.model,dragItems:true},D);var C=new l.HistoryPanelEdit(D);C._renderEmptyMessage=this.__patch_renderEmptyMessage;return C},__patch_renderEmptyMessage:function(E){var D=this,F=_.chain(this.model.get("state_ids")).values().flatten().value().length,C=D.$emptyMessage(E);if(!_.isEmpty(D.hdaViews)){C.hide()}else{if(F&&!this.model.contents.length){C.empty().append($('<span class="fa fa-spinner fa-spin"></span><i>loading datasets...</i>')).show()}else{if(D.searchFor){C.text(D.noneFoundMsg).show()}else{C.text(D.emptyMsg).show()}}}return C},setUpListeners:function f(){var C=this;this.once("rendered",function(){C.trigger("rendered:initial",C)});this.setUpPanelListeners()},setUpPanelListeners:function k(){var C=this;this.listenTo(this.panel,{rendered:function(){C.trigger("rendered",C)}},this)},inView:function(C,D){var F=this.$el.offset().left,E=F+this.$el.width();if(E<C){return false}if(F>D){return false}return true},$panel:function e(){return this.$(".history-panel")},render:function A(D){D=(D!==undefined)?(D):("fast");var C=this.model?this.model.toJSON():{};this.$el.html(this.template(C));this.renderPanel(D);this.setUpBehaviors();return this},setUpBehaviors:function v(){},template:function w(C){C=_.extend(C||{},{isCurrentHistory:this.currentHistory});return $(['<div class="panel-controls clear flex-row">',this.controlsLeftTemplate(C),this.controlsRightTemplate(C),"</div>",'<div class="inner flex-row flex-column-container">','<div id="history-',C.id,'" class="history-column history-panel flex-column"></div>',"</div>"].join(""))},renderPanel:function h(C){C=(C!==undefined)?(C):("fast");this.panel.setElement(this.$panel()).render(C);if(this.currentHistory){this.panel.$list().before(this.panel._renderDropTargetHelp())}return this},events:{"click .switch-to.btn":function(){this.model.setAsCurrent()},"click .delete-history":function(){var C=this;this.model._delete().fail(function(F,D,E){alert(_l("Could not delete the history")+":\n"+E)}).done(function(D){C.render()})},"click .undelete-history":function(){var C=this;this.model.undelete().fail(function(F,D,E){alert(_l("Could not undelete the history")+":\n"+E)}).done(function(D){C.render()})},"click .purge-history":function(){if(confirm(_l("This will permanently remove the data. Are you sure?"))){var C=this;this.model.purge().fail(function(F,D,E){alert(_l("Could not purge the history")+":\n"+E)}).done(function(D){C.render()})}},"click .copy-history":"copy"},copy:function s(){g(this.model)},controlsLeftTemplate:_.template(['<div class="pull-left">',"<% if( history.isCurrentHistory ){ %>",'<strong class="current-label">',_l("Current History"),"</strong>","<% } else { %>",'<button class="switch-to btn btn-default">',_l("Switch to"),"</button>","<% } %>","</div>"].join(""),{variable:"history"}),controlsRightTemplate:_.template(['<div class="pull-right">',"<% if( !history.purged ){ %>",'<div class="panel-menu order btn-group">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">','<span class="caret"></span>',"</button>",'<ul class="dropdown-menu pull-right" role="menu">',"<% if( !history.deleted ){ %>",'<li><a href="javascript:void(0);" class="copy-history">',_l("Copy"),"</a></li>",'<li><a href="javascript:void(0);" class="delete-history">',_l("Delete"),"</a></li>","<% } else /* if is deleted */ { %>",'<li><a href="javascript:void(0);" class="undelete-history">',_l("Undelete"),"</a></li>","<% } %>","</ul>","<% } %>","</div>","</div>"].join(""),{variable:"history"}),toString:function(){return"HistoryPanelColumn("+(this.panel?this.panel:"")+")"}});var m=Backbone.View.extend(z.LoggableMixin).extend({className:"multi-history-columns",initialize:function c(C){C=C||{};this.log(this+".init",C);if(!C.currentHistoryId){throw new Error(this+" requires a currentHistoryId in the options")}this.currentHistoryId=C.currentHistoryId;this.options={columnWidth:312,borderWidth:1,columnGap:8,headerHeight:29,footerHeight:0,controlsHeight:20};this.order=C.order||"update";this.hdaQueue=new a.NamedAjaxQueue([],false);this.collection=null;this.setCollection(C.histories||[]);this.columnMap={};this.createColumns(C.columnOptions);this.setUpListeners()},setUpListeners:function f(){},setCollection:function y(D){var C=this;C.stopListening(C.collection);C.collection=D;C.sortCollection(C.order,{silent:true});C.setUpCollectionListeners();C.trigger("new-collection",C);return C},setUpCollectionListeners:function(){var C=this,D=C.collection;C.listenTo(D,{add:C.addAsCurrentColumn,"set-as-current":C.setCurrentHistory,"change:deleted":C.handleDeletedHistory,sort:function(){C.renderColumns(0)}})},setCurrentHistory:function p(D){var C=this.columnMap[this.currentHistoryId];if(C){C.currentHistory=false;C.$el.height("")}this.currentHistoryId=D.id;var E=this.columnMap[this.currentHistoryId];E.currentHistory=true;this.sortCollection();multipanel._recalcFirstColumnHeight();return E},handleDeletedHistory:function b(D){if(D.get("deleted")){this.log("handleDeletedHistory",this.collection.includeDeleted,D);var C=this;column=C.columnMap[D.id];if(!column){return}if(column.model.id===this.currentHistoryId){}else{if(!C.collection.includeDeleted){C.removeColumn(column)}}}},sortCollection:function(C,D){C=C||this.order;var E=this.currentHistoryId;switch(C){case"name":this.collection.comparator=function(F){return[F.id!==E,F.get("name").toLowerCase()]};break;case"size":this.collection.comparator=function(F){return[F.id!==E,F.get("size")]};break;default:this.collection.comparator=function(F){return[F.id!==E,Date(F.get("update_time"))]}}this.collection.sort(D);return this.collection},setOrder:function(C){if(["update","name","size"].indexOf(C)===-1){C="update"}this.order=C;this.trigger("order:change",C,this);this.$(".current-order").text(C);this.sortCollection();return this},create:function(C){return this.collection.create({current:true})},createColumns:function r(D){D=D||{};var C=this;this.columnMap={};C.collection.each(function(E,F){var G=C.createColumn(E,D);C.columnMap[E.id]=G})},createColumn:function t(E,C){C=_.extend({},C,{model:E});var D=new B(C);if(E.id===this.currentHistoryId){D.currentHistory=true}this.setUpColumnListeners(D);return D},sortedFilteredColumns:function(C){C=C||this.filters;if(!C||!C.length){return this.sortedColumns()}var D=this;return D.sortedColumns().filter(function(G,F){var E=G.currentHistory||_.every(C.map(function(H){return H.call(G)}));return E})},sortedColumns:function(){var D=this;var C=this.collection.map(function(F,E){return D.columnMap[F.id]});return C},addColumn:function o(E,C){C=C!==undefined?C:true;var D=this.createColumn(E);this.columnMap[E.id]=D;if(C){this.renderColumns()}return D},addAsCurrentColumn:function o(E){var D=this,C=this.addColumn(E,false);this.setCurrentHistory(E);C.once("rendered",function(){D.queueHdaFetch(C)});return C},removeColumn:function x(E,D){D=D!==undefined?D:true;this.log("removeColumn",E);if(!E){return}var F=this,C=this.options.columnWidth+this.options.columnGap;E.$el.fadeOut("fast",function(){if(D){$(this).remove();F.$(".middle").width(F.$(".middle").width()-C);F.checkColumnsInView();F._recalcFirstColumnHeight()}F.stopListening(E.panel);F.stopListening(E);delete F.columnMap[E.model.id];E.remove()})},setUpColumnListeners:function n(C){var D=this;D.listenTo(C,{"in-view":D.queueHdaFetch});D.listenTo(C.panel,{"view:draggable:dragstart":function(H,F,E,G){D._dropData=JSON.parse(H.dataTransfer.getData("text"));D.currentColumnDropTargetOn()},"view:draggable:dragend":function(H,F,E,G){D._dropData=null;D.currentColumnDropTargetOff()},"droptarget:drop":function(G,H,F){var I=D._dropData.filter(function(J){return(_.isObject(J)&&J.id&&J.model_class==="HistoryDatasetAssociation")});D._dropData=null;var E=new a.NamedAjaxQueue();I.forEach(function(J){E.add({name:"copy-"+J.id,fn:function(){return F.model.contents.copy(J.id)}})});E.start();E.done(function(J){F.model.fetch()})}})},columnMapLength:function(){return Object.keys(this.columnMap).length},render:function A(D){D=D!==undefined?D:this.fxSpeed;var C=this;C.log(C+".render");C.$el.html(C.mainTemplate(C));C.renderColumns(D);C.setUpBehaviors();C.trigger("rendered",C);return C},renderColumns:function j(F){F=F!==undefined?F:this.fxSpeed;var E=this,C=E.sortedFilteredColumns();E.$(".middle").width(C.length*(this.options.columnWidth+this.options.columnGap)+this.options.columnGap+16);var D=E.$(".middle");D.empty();C.forEach(function(H,G){H.$el.appendTo(D);H.delegateEvents();E.renderColumn(H,F)});if(this.searchFor&&C.length<=1){}else{E.checkColumnsInView();this._recalcFirstColumnHeight()}return C},renderColumn:function(C,D){D=D!==undefined?D:this.fxSpeed;return C.render(D)},queueHdaFetch:function i(E){if(E.model.contents.length===0&&!E.model.get("empty")){var C={},D=_.values(E.panel.storage.get("expandedIds")).join();if(D){C.dataset_details=D}this.hdaQueue.add({name:E.model.id,fn:function(){var F=E.model.contents.fetch({data:C,silent:true});return F.done(function(G){E.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},queueHdaFetchDetails:function(C){if((C.model.contents.length===0&&!C.model.get("empty"))||(!C.model.contents.haveDetails())){this.hdaQueue.add({name:C.model.id,fn:function(){var D=C.model.contents.fetch({data:{details:"all"},silent:true});return D.done(function(E){C.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},renderInfo:function(C){this.$(".header .header-info").text(C)},events:{"click .done.btn":"close","click .create-new.btn":"create","click #include-deleted":"_clickToggleDeletedHistories","click .order .order-update":function(C){this.setOrder("update")},"click .order .order-name":function(C){this.setOrder("name")},"click .order .order-size":function(C){this.setOrder("size")},"click #toggle-deleted":"_clickToggleDeletedDatasets","click #toggle-hidden":"_clickToggleHiddenDatasets"},close:function(D){var C="/";if(Galaxy&&Galaxy.options&&Galaxy.options.root){C=Galaxy.options.root}else{if(galaxy_config&&galaxy_config.root){C=galaxy_config.root}}window.location=C},_clickToggleDeletedHistories:function(C){return this.toggleDeletedHistories($(C.currentTarget).is(":checked"))},toggleDeletedHistories:function(C){if(C){window.location=Galaxy.options.root+"history/view_multiple?include_deleted_histories=True"}else{window.location=Galaxy.options.root+"history/view_multiple"}},_clickToggleDeletedDatasets:function(C){return this.toggleDeletedDatasets($(C.currentTarget).is(":checked"))},toggleDeletedDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowDeleted(C,false)},E*200)})},_clickToggleHiddenDatasets:function(C){return this.toggleHiddenDatasets($(C.currentTarget).is(":checked"))},toggleHiddenDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowHidden(C,false)},E*200)})},setUpBehaviors:function(){var D=this;D._moreOptionsPopover();D.$("#search-histories").searchInput({name:"search-histories",placeholder:_l("search histories"),onsearch:function(E){D.searchFor=E;D.filters=[function(){return this.model.matchesAll(D.searchFor)}];D.renderColumns(0)},onclear:function(E){D.searchFor=null;D.filters=[];D.renderColumns(0)}});D.$("#search-datasets").searchInput({name:"search-datasets",placeholder:_l("search all datasets"),onfirstsearch:function(E){D.hdaQueue.clear();D.$("#search-datasets").searchInput("toggle-loading");D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E);D.queueHdaFetchDetails(F)});D.hdaQueue.progress(function(F){D.renderInfo([_l("searching"),(F.curr+1),_l("of"),F.total].join(" "))});D.hdaQueue.deferred.done(function(){D.renderInfo("");D.$("#search-datasets").searchInput("toggle-loading")})},onsearch:function(E){D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E)})},onclear:function(E){D.searchFor=null;D.sortedFilteredColumns().forEach(function(F){F.panel.clearSearch()})}});$(window).resize(function(){D._recalcFirstColumnHeight()});var C=_.debounce(_.bind(this.checkColumnsInView,this),100);this.$(".middle").parent().scroll(C)},_moreOptionsPopover:function(){return this.$(".open-more-options.btn").popover({container:".header",placement:"bottom",html:true,content:$(this.optionsPopoverTemplate(this))})},_recalcFirstColumnHeight:function(){var C=this.$(".history-column").first(),E=this.$(".middle").height(),D=C.find(".panel-controls").height();C.height(E).find(".inner").height(E-D)},_viewport:function(){var C=this.$(".middle").parent().offset().left;return{left:C,right:C+this.$(".middle").parent().width()}},columnsInView:function(){var C=this._viewport();return this.sortedFilteredColumns().filter(function(D){return D.currentHistory||D.inView(C.left,C.right)})},checkColumnsInView:function(){this.columnsInView().forEach(function(C){C.trigger("in-view",C)})},currentColumnDropTargetOn:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=function(D){};C.panel.dropTargetOn()},currentColumnDropTargetOff:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=l.HistoryPanelEdit.prototype.dataDrop;C.panel.dropTarget=false;C.panel.$(".history-drop-target").remove()},toString:function(){return"MultiPanelColumns("+(this.columns?this.columns.length:0)+")"},mainTemplate:_.template(['<div class="header flex-column-container">','<div class="control-column control-column-left flex-column">','<button class="create-new btn btn-default">',_l("Create new"),"</button> ",'<div id="search-histories" class="search-control"></div>','<div id="search-datasets" class="search-control"></div>','<button class="open-more-options btn btn-default">','<span class="fa fa-ellipsis-h" title="More options"></span>',"</button>","</div>",'<div class="control-column control-column-center flex-column">','<div class="header-info">',"</div>","</div>",'<div class="control-column control-column-right flex-column">','<button class="done btn btn-default">',_l("Done"),"</button>","</div>","</div>",'<div class="outer-middle flex-row flex-row-container">','<div class="middle flex-column-container flex-row"></div>',"</div>",'<div class="footer flex-column-container">',"</div>"].join(""),{variable:"view"}),optionsPopoverTemplate:_.template(['<div class="more-options">','<div class="checkbox"><label><input id="include-deleted" type="checkbox"','<%= view.collection.includeDeleted? " checked" : "" %>>',_l("Include deleted histories"),"</label></div>",'<div class="order btn-group">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',_l("Order histories by")+" ",'<span class="current-order"><%= view.order %></span> ','<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="javascript:void(0);" class="order-update">',_l("Time of last update"),"</a></li>",'<li><a href="javascript:void(0);" class="order-name">',_l("Name"),"</a></li>",'<li><a href="javascript:void(0);" class="order-size">',_l("Size"),"</a></li>","</ul>","</div>",'<div class="checkbox"><label><input id="toggle-deleted" type="checkbox">',_l("Include deleted datasets"),"</label></div>",'<div class="checkbox"><label><input id="toggle-hidden" type="checkbox">',_l("Include hidden datasets"),"</label></div>","</div>"].join(""),{variable:"view"})});return{MultiPanelColumns:m}});
\ No newline at end of file
diff -r d540227165d54950208d3948e2bdecd4babc70ca -r a8d9371efef9f10e6c4fce18a6da8ed7916f10ba templates/webapps/galaxy/galaxy.panels.mako
--- a/templates/webapps/galaxy/galaxy.panels.mako
+++ b/templates/webapps/galaxy/galaxy.panels.mako
@@ -35,11 +35,11 @@
'libs/bootstrap',
'libs/underscore',
'libs/backbone/backbone',
+ 'libs/handlebars.runtime',
'libs/require',
'libs/d3',
'galaxy.base',
- 'galaxy.panels',
- 'libs/handlebars.runtime'
+ 'galaxy.panels'
)}
## send errors to Sntry server if configured
https://bitbucket.org/galaxy/galaxy-central/commits/6730c4cb28de/
Changeset: 6730c4cb28de
User: carlfeberhard
Date: 2015-02-12 20:35:47+00:00
Summary: Merge
Affected #: 2 files
diff -r a8d9371efef9f10e6c4fce18a6da8ed7916f10ba -r 6730c4cb28dead6bbf57a3e1f599136ab71dd34d lib/galaxy/eggs/__init__.py
--- a/lib/galaxy/eggs/__init__.py
+++ b/lib/galaxy/eggs/__init__.py
@@ -61,15 +61,13 @@
self.distribution = None
self.dir = None
self.removed_location = None
- self.enable_fetch = crate.galaxy_config.enable_egg_fetch
+ self.enable_fetch = crate.enable_egg_fetch
if self.name is not None and self.version is not None:
self.set_distribution()
def set_dir( self ):
global eggs_dir
self.dir = eggs_dir
- if not os.path.exists( self.dir ):
- os.makedirs( self.dir )
def set_distribution( self ):
"""
@@ -131,6 +129,8 @@
def _fetch():
if self.url is None:
return False
+ if not os.path.exists( self.dir ):
+ os.makedirs( self.dir )
alternative = None
try:
url = self.url + '/' + self.distribution.egg_name() + '.egg'
@@ -284,7 +284,7 @@
"""
config_file = os.path.join( galaxy_dir, 'eggs.ini' )
- def __init__( self, galaxy_config_file, platform=None ):
+ def __init__( self, galaxy_config_file=None, platform=None ):
self.eggs = {}
self.config = CaseSensitiveConfigParser()
self.repo = None
@@ -293,6 +293,9 @@
self.py_platform = None
if platform is not None:
self.py_platform = platform.split( '-' )[0]
+ self.enable_egg_fetch = string_as_bool(os.environ.get('GALAXY_CONFIG_ENABLE_EGG_FETCH', True))
+ self.enable_eggs = string_as_bool(os.environ.get('GALAXY_CONFIG_ENABLE_EGGS', True))
+ self.try_dependencies_from_env = string_as_bool(os.environ.get('GALAXY_CONFIG_TRY_DEPENDENCIES_FROM_ENV', False))
self.galaxy_config = GalaxyConfig( galaxy_config_file )
self.parse()
@@ -381,7 +384,7 @@
"""
Try to resolve (e.g. fetch) all eggs in the crate.
"""
- if self.galaxy_config.enable_eggs and not self.galaxy_config.try_dependencies_from_env:
+ if self.enable_eggs and not self.try_dependencies_from_env:
if all:
eggs = self.all_eggs
else:
@@ -403,19 +406,12 @@
always_conditional = ( 'pysam', 'ctypes', 'python_daemon' )
def __init__( self, config_file ):
- self.enable_egg_fetch = True
- self.enable_eggs = True
- self.try_dependencies_from_env = False
if config_file is None:
self.config = None
else:
self.config = ConfigParser.ConfigParser()
if self.config.read( config_file ) == []:
raise Exception( "error: unable to read Galaxy config from %s" % config_file )
- for opt in ('enable_egg_fetch', 'enable_eggs', 'try_dependencies_from_env'):
- var = 'GALAXY_CONFIG_' + opt.upper()
- if var in os.environ:
- setattr(self, opt, string_as_bool(os.environ[var]))
def check_conditional( self, egg_name ):
def check_pysam():
@@ -470,11 +466,11 @@
def require( req_str ):
c = Crate( None )
req = pkg_resources.Requirement.parse( req_str )
- if c.galaxy_config.try_dependencies_from_env or not c.galaxy_config.enable_eggs:
+ if c.try_dependencies_from_env or not c.enable_eggs:
try:
return pkg_resources.working_set.require( req_str )
except Exception as exc:
- if not c.galaxy_config.enable_eggs:
+ if not c.enable_eggs:
raise
log.info("%s not found in local environment, will try Galaxy egg: %s", (req_str, exc))
# TODO: This breaks egg version requirements. Not currently a problem, but
diff -r a8d9371efef9f10e6c4fce18a6da8ed7916f10ba -r 6730c4cb28dead6bbf57a3e1f599136ab71dd34d lib/galaxy/jobs/runners/__init__.py
--- a/lib/galaxy/jobs/runners/__init__.py
+++ b/lib/galaxy/jobs/runners/__init__.py
@@ -12,6 +12,7 @@
from Queue import Queue, Empty
+import galaxy.eggs
import galaxy.jobs
from galaxy.jobs.command_factory import build_command
from galaxy import model
@@ -269,12 +270,20 @@
external_metadata_proc.wait()
log.debug( 'execution of external set_meta for job %d finished' % job_wrapper.job_id )
+ def _get_egg_env_opts(self):
+ env = []
+ crate = galaxy.eggs.Crate()
+ for opt in ('enable_egg_fetch', 'enable_eggs', 'try_dependencies_from_env'):
+ env.append('GALAXY_CONFIG_%s="%s"; export GALAXY_CONFIG_%s' % (opt.upper(), getattr(crate, opt), opt.upper()))
+ return env
+
def get_job_file(self, job_wrapper, **kwds):
job_metrics = job_wrapper.app.job_metrics
job_instrumenter = job_metrics.job_instrumenters[ job_wrapper.job_destination.id ]
env_setup_commands = kwds.get( 'env_setup_commands', [] )
env_setup_commands.append( job_wrapper.get_env_setup_clause() or '' )
+ env_setup_commands.extend( self._get_egg_env_opts() or [] )
destination = job_wrapper.job_destination or {}
envs = destination.get( "env", [] )
for env in envs:
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.
1
0
commit/galaxy-central: natefoo: Pass the egg env variables onto jobs.
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/db70af871fd0/
Changeset: db70af871fd0
User: natefoo
Date: 2015-02-12 20:35:19+00:00
Summary: Pass the egg env variables onto jobs.
Affected #: 2 files
diff -r d540227165d54950208d3948e2bdecd4babc70ca -r db70af871fd0f32b67109dcf9a5a8f2ef5846e55 lib/galaxy/eggs/__init__.py
--- a/lib/galaxy/eggs/__init__.py
+++ b/lib/galaxy/eggs/__init__.py
@@ -61,15 +61,13 @@
self.distribution = None
self.dir = None
self.removed_location = None
- self.enable_fetch = crate.galaxy_config.enable_egg_fetch
+ self.enable_fetch = crate.enable_egg_fetch
if self.name is not None and self.version is not None:
self.set_distribution()
def set_dir( self ):
global eggs_dir
self.dir = eggs_dir
- if not os.path.exists( self.dir ):
- os.makedirs( self.dir )
def set_distribution( self ):
"""
@@ -131,6 +129,8 @@
def _fetch():
if self.url is None:
return False
+ if not os.path.exists( self.dir ):
+ os.makedirs( self.dir )
alternative = None
try:
url = self.url + '/' + self.distribution.egg_name() + '.egg'
@@ -284,7 +284,7 @@
"""
config_file = os.path.join( galaxy_dir, 'eggs.ini' )
- def __init__( self, galaxy_config_file, platform=None ):
+ def __init__( self, galaxy_config_file=None, platform=None ):
self.eggs = {}
self.config = CaseSensitiveConfigParser()
self.repo = None
@@ -293,6 +293,9 @@
self.py_platform = None
if platform is not None:
self.py_platform = platform.split( '-' )[0]
+ self.enable_egg_fetch = string_as_bool(os.environ.get('GALAXY_CONFIG_ENABLE_EGG_FETCH', True))
+ self.enable_eggs = string_as_bool(os.environ.get('GALAXY_CONFIG_ENABLE_EGGS', True))
+ self.try_dependencies_from_env = string_as_bool(os.environ.get('GALAXY_CONFIG_TRY_DEPENDENCIES_FROM_ENV', False))
self.galaxy_config = GalaxyConfig( galaxy_config_file )
self.parse()
@@ -381,7 +384,7 @@
"""
Try to resolve (e.g. fetch) all eggs in the crate.
"""
- if self.galaxy_config.enable_eggs and not self.galaxy_config.try_dependencies_from_env:
+ if self.enable_eggs and not self.try_dependencies_from_env:
if all:
eggs = self.all_eggs
else:
@@ -403,19 +406,12 @@
always_conditional = ( 'pysam', 'ctypes', 'python_daemon' )
def __init__( self, config_file ):
- self.enable_egg_fetch = True
- self.enable_eggs = True
- self.try_dependencies_from_env = False
if config_file is None:
self.config = None
else:
self.config = ConfigParser.ConfigParser()
if self.config.read( config_file ) == []:
raise Exception( "error: unable to read Galaxy config from %s" % config_file )
- for opt in ('enable_egg_fetch', 'enable_eggs', 'try_dependencies_from_env'):
- var = 'GALAXY_CONFIG_' + opt.upper()
- if var in os.environ:
- setattr(self, opt, string_as_bool(os.environ[var]))
def check_conditional( self, egg_name ):
def check_pysam():
@@ -470,11 +466,11 @@
def require( req_str ):
c = Crate( None )
req = pkg_resources.Requirement.parse( req_str )
- if c.galaxy_config.try_dependencies_from_env or not c.galaxy_config.enable_eggs:
+ if c.try_dependencies_from_env or not c.enable_eggs:
try:
return pkg_resources.working_set.require( req_str )
except Exception as exc:
- if not c.galaxy_config.enable_eggs:
+ if not c.enable_eggs:
raise
log.info("%s not found in local environment, will try Galaxy egg: %s", (req_str, exc))
# TODO: This breaks egg version requirements. Not currently a problem, but
diff -r d540227165d54950208d3948e2bdecd4babc70ca -r db70af871fd0f32b67109dcf9a5a8f2ef5846e55 lib/galaxy/jobs/runners/__init__.py
--- a/lib/galaxy/jobs/runners/__init__.py
+++ b/lib/galaxy/jobs/runners/__init__.py
@@ -12,6 +12,7 @@
from Queue import Queue, Empty
+import galaxy.eggs
import galaxy.jobs
from galaxy.jobs.command_factory import build_command
from galaxy import model
@@ -269,12 +270,20 @@
external_metadata_proc.wait()
log.debug( 'execution of external set_meta for job %d finished' % job_wrapper.job_id )
+ def _get_egg_env_opts(self):
+ env = []
+ crate = galaxy.eggs.Crate()
+ for opt in ('enable_egg_fetch', 'enable_eggs', 'try_dependencies_from_env'):
+ env.append('GALAXY_CONFIG_%s="%s"; export GALAXY_CONFIG_%s' % (opt.upper(), getattr(crate, opt), opt.upper()))
+ return env
+
def get_job_file(self, job_wrapper, **kwds):
job_metrics = job_wrapper.app.job_metrics
job_instrumenter = job_metrics.job_instrumenters[ job_wrapper.job_destination.id ]
env_setup_commands = kwds.get( 'env_setup_commands', [] )
env_setup_commands.append( job_wrapper.get_env_setup_clause() or '' )
+ env_setup_commands.extend( self._get_egg_env_opts() or [] )
destination = job_wrapper.job_destination or {}
envs = destination.get( "env", [] )
for env in envs:
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.
1
0