1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/75a8d88ba728/ Changeset: 75a8d88ba728 User: guerler Date: 2014-02-13 10:21:06 Summary: Ui: Apply naming convention Affected #: 12 files diff -r b6acb69067f808147e4e69a1cde74cbb8868c600 -r 75a8d88ba72893daaf27e57d496ca799c20df0b9 static/scripts/mvc/ui/popover.js --- a/static/scripts/mvc/ui/popover.js +++ /dev/null @@ -1,169 +0,0 @@ -// dependencies -define(['utils/utils'], function(Utils) { - -var View = Backbone.View.extend({ - - // default options - optionsDefault: { - with_close : true, - container : 'body', - title : null, - placement : 'top' - }, - - // visibility flag - visible: false, - - // initialize - initialize: function (options) { - - // link this - var self = this; - - // update options - this.options = _.defaults(options, this.optionsDefault); - - // set element - this.setElement(this._template(this.options)); - - // attach popover to parent - this.options.container.parent().append(this.$el); - - // attach close - if (this.options.with_close) { - this.$el.find('#close').on('click', function() { self.hide(); }); - } - - // generate unique id - this.uuid = Utils.uuid(); - - // add event to hide if click is outside of popup - var self = this; - $('body').on('mousedown.' + this.uuid, function(e) { self._hide(e) }); - }, - - // title - title: function(val) { - if (val !== undefined) { - this.$el.find('.popover-title-label').html(val); - } - }, - - // show - show: function () { - // show popover - this.$el.show(); - this.visible = true; - - // calculate position - var position = this._get_placement(this.options.placement); - - // set position - this.$el.css(position); - }, - - // calculate position and error - _get_placement: function(placement) { - // get popover dimensions - var width = this._get_width(this.$el); - var height = this.$el.height(); - - // get container details - var $container = this.options.container; - var container_width = this._get_width($container); - var container_height = this._get_height($container); - var container_position = $container.position(); - - // initialize position - var top = 0; - var left = 0; - - // calculate position - if (placement == 'top' || placement == 'bottom') { - left = container_position.left - width + (container_width + width) / 2; - if (placement == 'top') { - top = container_position.top - height - 5; - } else { - top = container_position.top + container_height + 5; - } - } - - // return - return {top: top, left: left}; - }, - - // width - _get_width: function($el) { - return $el.width() + parseInt($el.css('padding-left')) + parseInt($el.css('padding-right')) - }, - - // heigth - _get_height: function($el) { - return $el.height() + parseInt($el.css('padding-top')) + parseInt($el.css('padding-bottom')) - }, - - // hide - hide: function () { - this.$el.hide(); - this.visible = false; - }, - - // append - append: function($el) { - this.$el.find('.popover-content').append($el); - }, - - // empty - empty: function($el) { - this.$el.find('.popover-content').empty(); - }, - - // remove - remove: function() { - // remove event handler - $('body').off('mousedown.' + this.uuid); - - // remove element from dom - this.$el.remove(); - }, - - // remove - _hide : function(e) { - //the 'is' for buttons that trigger popups - //the 'has' for icons within a button that triggers a popup - if (!$(this.options.container).is(e.target) && - !$(this.el).is(e.target) && - $(this.el).has(e.target).length === 0) { - this.hide(); - } - }, - - // template - _template: function(options) { - var tmpl = '<div class="popover-view popover fade ' + options.placement + ' in">' + - '<div class="arrow"></div>' + - '<div class="popover-title">' + - '<div class="popover-title-label">' + - options.title + - '</div>'; - - // add close icon - if (options.with_close) { - tmpl += '<div id="close" class="popover-close fa fa-times-circle"></div>'; - } - - // finalize - tmpl += '</div>' + - '<div class="popover-content"></div>' + - '</div>'; - - // return - return tmpl; - } -}); - -return { - View: View -} - -}); \ No newline at end of file diff -r b6acb69067f808147e4e69a1cde74cbb8868c600 -r 75a8d88ba72893daaf27e57d496ca799c20df0b9 static/scripts/mvc/ui/select.js --- a/static/scripts/mvc/ui/select.js +++ /dev/null @@ -1,193 +0,0 @@ -// dependencies -define(['utils/utils'], function(Utils) { - -// plugin -var View = Backbone.View.extend( -{ - // options - optionsDefault: { - css : '', - placeholder : 'No data available', - data : [] - }, - - // initialize - initialize : function(options) { - // configure options - this.options = Utils.merge(options, this.optionsDefault); - - // create new element - this.setElement(this._template(this.options)); - - // add to dom - this.options.container.append(this.$el); - - // link selection dictionary - this.select_data = this.options.data; - - // refresh - this._refresh(); - - // initial value - if (this.options.value) { - this._setValue(this.options.value); - } - - // add change event - var self = this; - if (this.options.onchange) { - this.$el.on('change', function() { - self.options.onchange(self.value()); - }); - } - }, - - // value - value : function (new_value) { - // get current id/value - var before = this._getValue(); - - // check if new_value is defined - if (new_value !== undefined) { - this._setValue(new_value); - } - - // get current id/value - var after = this._getValue(); - if(after === undefined) { - return null; - } else { - // fire onchange - if ((after != before && this.options.onchange)) { - this.options.onchange(after); - } - - // return current value - return after; - } - }, - - // label - text : function () { - return this.$el.select2('data').text; - }, - - // disabled - disabled: function() { - return !this.$el.select2('enable'); - }, - - // enable - enable: function() { - this.$el.select2('enable', true); - }, - - // disable - disable: function() { - this.$el.select2('enable', false); - }, - - // add - add: function(options) { - // add options - this.select_data.push({ - id : options.id, - text : options.text - }); - - // refresh - this._refresh(); - }, - - // remove - del: function(id) { - // search option - var index = this._getIndex(id); - - // check if found - if (index != -1) { - // remove options - this.select_data.splice(index, 1); - - // refresh - this._refresh(); - } - }, - - // remove - remove: function() { - this.$el.select2('destroy'); - }, - - // update - update: function(options) { - // copy options - this.select_data = []; - for (var key in options.data) { - this.select_data.push(options.data[key]); - } - - // refresh - this._refresh(); - }, - - // refresh - _refresh: function() { - - // link select data - var select_data = this.select_data; - if (!select_data || select_data.length == 0) { - select_data = []; - } - - // selected - var selected = this._getValue(); - - // add select2 data - this.$el.select2({ - data : select_data, - containerCssClass : this.options.css, - placeholder : this.options.placeholder - }); - - // select - var index = this._getIndex(selected); - if (index != -1) { - this._setValue(selected); - } - }, - - // get index - _getIndex: function(value) { - // search index - for (var key in this.select_data) { - if (this.select_data[key].id == value) { - return key; - } - } - - // not found - return -1; - }, - - // get value - _getValue: function() { - return this.$el.select2('val'); - }, - - // set value - _setValue: function(new_value) { - this.$el.select2('val', new_value); - }, - - // element - _template: function(options) { - return '<input type="hidden"/>'; - } -}); - -return { - View : View -} - -}); diff -r b6acb69067f808147e4e69a1cde74cbb8868c600 -r 75a8d88ba72893daaf27e57d496ca799c20df0b9 static/scripts/mvc/ui/ui-popover.js --- /dev/null +++ b/static/scripts/mvc/ui/ui-popover.js @@ -0,0 +1,169 @@ +// dependencies +define(['utils/utils'], function(Utils) { + +var View = Backbone.View.extend({ + + // default options + optionsDefault: { + with_close : true, + container : 'body', + title : null, + placement : 'top' + }, + + // visibility flag + visible: false, + + // initialize + initialize: function (options) { + + // link this + var self = this; + + // update options + this.options = _.defaults(options, this.optionsDefault); + + // set element + this.setElement(this._template(this.options)); + + // attach popover to parent + this.options.container.parent().append(this.$el); + + // attach close + if (this.options.with_close) { + this.$el.find('#close').on('click', function() { self.hide(); }); + } + + // generate unique id + this.uuid = Utils.uuid(); + + // add event to hide if click is outside of popup + var self = this; + $('body').on('mousedown.' + this.uuid, function(e) { self._hide(e) }); + }, + + // title + title: function(val) { + if (val !== undefined) { + this.$el.find('.popover-title-label').html(val); + } + }, + + // show + show: function () { + // show popover + this.$el.show(); + this.visible = true; + + // calculate position + var position = this._get_placement(this.options.placement); + + // set position + this.$el.css(position); + }, + + // calculate position and error + _get_placement: function(placement) { + // get popover dimensions + var width = this._get_width(this.$el); + var height = this.$el.height(); + + // get container details + var $container = this.options.container; + var container_width = this._get_width($container); + var container_height = this._get_height($container); + var container_position = $container.position(); + + // initialize position + var top = 0; + var left = 0; + + // calculate position + if (placement == 'top' || placement == 'bottom') { + left = container_position.left - width + (container_width + width) / 2; + if (placement == 'top') { + top = container_position.top - height - 5; + } else { + top = container_position.top + container_height + 5; + } + } + + // return + return {top: top, left: left}; + }, + + // width + _get_width: function($el) { + return $el.width() + parseInt($el.css('padding-left')) + parseInt($el.css('padding-right')) + }, + + // heigth + _get_height: function($el) { + return $el.height() + parseInt($el.css('padding-top')) + parseInt($el.css('padding-bottom')) + }, + + // hide + hide: function () { + this.$el.hide(); + this.visible = false; + }, + + // append + append: function($el) { + this.$el.find('.popover-content').append($el); + }, + + // empty + empty: function($el) { + this.$el.find('.popover-content').empty(); + }, + + // remove + remove: function() { + // remove event handler + $('body').off('mousedown.' + this.uuid); + + // remove element from dom + this.$el.remove(); + }, + + // remove + _hide : function(e) { + //the 'is' for buttons that trigger popups + //the 'has' for icons within a button that triggers a popup + if (!$(this.options.container).is(e.target) && + !$(this.el).is(e.target) && + $(this.el).has(e.target).length === 0) { + this.hide(); + } + }, + + // template + _template: function(options) { + var tmpl = '<div class="popover-view popover fade ' + options.placement + ' in">' + + '<div class="arrow"></div>' + + '<div class="popover-title">' + + '<div class="popover-title-label">' + + options.title + + '</div>'; + + // add close icon + if (options.with_close) { + tmpl += '<div id="close" class="popover-close fa fa-times-circle"></div>'; + } + + // finalize + tmpl += '</div>' + + '<div class="popover-content"></div>' + + '</div>'; + + // return + return tmpl; + } +}); + +return { + View: View +} + +}); \ No newline at end of file diff -r b6acb69067f808147e4e69a1cde74cbb8868c600 -r 75a8d88ba72893daaf27e57d496ca799c20df0b9 static/scripts/mvc/ui/ui-select.js --- /dev/null +++ b/static/scripts/mvc/ui/ui-select.js @@ -0,0 +1,193 @@ +// dependencies +define(['utils/utils'], function(Utils) { + +// plugin +var View = Backbone.View.extend( +{ + // options + optionsDefault: { + css : '', + placeholder : 'No data available', + data : [] + }, + + // initialize + initialize : function(options) { + // configure options + this.options = Utils.merge(options, this.optionsDefault); + + // create new element + this.setElement(this._template(this.options)); + + // add to dom + this.options.container.append(this.$el); + + // link selection dictionary + this.select_data = this.options.data; + + // refresh + this._refresh(); + + // initial value + if (this.options.value) { + this._setValue(this.options.value); + } + + // add change event + var self = this; + if (this.options.onchange) { + this.$el.on('change', function() { + self.options.onchange(self.value()); + }); + } + }, + + // value + value : function (new_value) { + // get current id/value + var before = this._getValue(); + + // check if new_value is defined + if (new_value !== undefined) { + this._setValue(new_value); + } + + // get current id/value + var after = this._getValue(); + if(after === undefined) { + return null; + } else { + // fire onchange + if ((after != before && this.options.onchange)) { + this.options.onchange(after); + } + + // return current value + return after; + } + }, + + // label + text : function () { + return this.$el.select2('data').text; + }, + + // disabled + disabled: function() { + return !this.$el.select2('enable'); + }, + + // enable + enable: function() { + this.$el.select2('enable', true); + }, + + // disable + disable: function() { + this.$el.select2('enable', false); + }, + + // add + add: function(options) { + // add options + this.select_data.push({ + id : options.id, + text : options.text + }); + + // refresh + this._refresh(); + }, + + // remove + del: function(id) { + // search option + var index = this._getIndex(id); + + // check if found + if (index != -1) { + // remove options + this.select_data.splice(index, 1); + + // refresh + this._refresh(); + } + }, + + // remove + remove: function() { + this.$el.select2('destroy'); + }, + + // update + update: function(options) { + // copy options + this.select_data = []; + for (var key in options.data) { + this.select_data.push(options.data[key]); + } + + // refresh + this._refresh(); + }, + + // refresh + _refresh: function() { + + // link select data + var select_data = this.select_data; + if (!select_data || select_data.length == 0) { + select_data = []; + } + + // selected + var selected = this._getValue(); + + // add select2 data + this.$el.select2({ + data : select_data, + containerCssClass : this.options.css, + placeholder : this.options.placeholder + }); + + // select + var index = this._getIndex(selected); + if (index != -1) { + this._setValue(selected); + } + }, + + // get index + _getIndex: function(value) { + // search index + for (var key in this.select_data) { + if (this.select_data[key].id == value) { + return key; + } + } + + // not found + return -1; + }, + + // get value + _getValue: function() { + return this.$el.select2('val'); + }, + + // set value + _setValue: function(new_value) { + this.$el.select2('val', new_value); + }, + + // element + _template: function(options) { + return '<input type="hidden"/>'; + } +}); + +return { + View : View +} + +}); diff -r b6acb69067f808147e4e69a1cde74cbb8868c600 -r 75a8d88ba72893daaf27e57d496ca799c20df0b9 static/scripts/mvc/upload/upload-row.js --- a/static/scripts/mvc/upload/upload-row.js +++ b/static/scripts/mvc/upload/upload-row.js @@ -3,8 +3,8 @@ 'mvc/upload/upload-model', 'mvc/upload/upload-extensions', 'mvc/upload/upload-settings', - 'mvc/ui/popover', - 'mvc/ui/select'], + 'mvc/ui/ui-popover', + 'mvc/ui/ui-select'], function( Utils, UploadModel, diff -r b6acb69067f808147e4e69a1cde74cbb8868c600 -r 75a8d88ba72893daaf27e57d496ca799c20df0b9 static/scripts/mvc/upload/upload-view.js --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -5,7 +5,7 @@ "mvc/upload/upload-model", "mvc/upload/upload-row", "mvc/upload/upload-ftp", - "mvc/ui/popover", + "mvc/ui/ui-popover", "mvc/ui", "utils/uploadbox"], diff -r b6acb69067f808147e4e69a1cde74cbb8868c600 -r 75a8d88ba72893daaf27e57d496ca799c20df0b9 static/scripts/packed/mvc/ui/popover.js --- a/static/scripts/packed/mvc/ui/popover.js +++ /dev/null @@ -1,1 +0,0 @@ -define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{with_close:true,container:"body",title:null,placement:"top"},visible:false,initialize:function(d){var c=this;this.options=_.defaults(d,this.optionsDefault);this.setElement(this._template(this.options));this.options.container.parent().append(this.$el);if(this.options.with_close){this.$el.find("#close").on("click",function(){c.hide()})}this.uuid=a.uuid();var c=this;$("body").on("mousedown."+this.uuid,function(f){c._hide(f)})},title:function(c){if(c!==undefined){this.$el.find(".popover-title-label").html(c)}},show:function(){this.$el.show();this.visible=true;var c=this._get_placement(this.options.placement);this.$el.css(c)},_get_placement:function(h){var d=this._get_width(this.$el);var j=this.$el.height();var k=this.options.container;var c=this._get_width(k);var f=this._get_height(k);var g=k.position();var i=0;var e=0;if(h=="top"||h=="bottom"){e=g.left-d+(c+d)/2;if(h=="top"){i=g.top-j-5}else{i=g.top+f+5}}return{top:i,left:e}},_get_width:function(c){return c.width()+parseInt(c.css("padding-left"))+parseInt(c.css("padding-right"))},_get_height:function(c){return c.height()+parseInt(c.css("padding-top"))+parseInt(c.css("padding-bottom"))},hide:function(){this.$el.hide();this.visible=false},append:function(c){this.$el.find(".popover-content").append(c)},empty:function(c){this.$el.find(".popover-content").empty()},remove:function(){$("body").off("mousedown."+this.uuid);this.$el.remove()},_hide:function(c){if(!$(this.options.container).is(c.target)&&!$(this.el).is(c.target)&&$(this.el).has(c.target).length===0){this.hide()}},_template:function(d){var c='<div class="popover-view popover fade '+d.placement+' in"><div class="arrow"></div><div class="popover-title"><div class="popover-title-label">'+d.title+"</div>";if(d.with_close){c+='<div id="close" class="popover-close fa fa-times-circle"></div>'}c+='</div><div class="popover-content"></div></div>';return c}});return{View:b}}); \ No newline at end of file diff -r b6acb69067f808147e4e69a1cde74cbb8868c600 -r 75a8d88ba72893daaf27e57d496ca799c20df0b9 static/scripts/packed/mvc/ui/select.js --- a/static/scripts/packed/mvc/ui/select.js +++ /dev/null @@ -1,1 +0,0 @@ -define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{css:"",placeholder:"No data available",data:[]},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.options.container.append(this.$el);this.select_data=this.options.data;this._refresh();if(this.options.value){this._setValue(this.options.value)}var c=this;if(this.options.onchange){this.$el.on("change",function(){c.options.onchange(c.value())})}},value:function(c){var d=this._getValue();if(c!==undefined){this._setValue(c)}var e=this._getValue();if(e===undefined){return null}else{if((e!=d&&this.options.onchange)){this.options.onchange(e)}return e}},text:function(){return this.$el.select2("data").text},disabled:function(){return !this.$el.select2("enable")},enable:function(){this.$el.select2("enable",true)},disable:function(){this.$el.select2("enable",false)},add:function(c){this.select_data.push({id:c.id,text:c.text});this._refresh()},del:function(d){var c=this._getIndex(d);if(c!=-1){this.select_data.splice(c,1);this._refresh()}},remove:function(){this.$el.select2("destroy")},update:function(c){this.select_data=[];for(var d in c.data){this.select_data.push(c.data[d])}this._refresh()},_refresh:function(){var e=this.select_data;if(!e||e.length==0){e=[]}var d=this._getValue();this.$el.select2({data:e,containerCssClass:this.options.css,placeholder:this.options.placeholder});var c=this._getIndex(d);if(c!=-1){this._setValue(d)}},_getIndex:function(d){for(var c in this.select_data){if(this.select_data[c].id==d){return c}}return -1},_getValue:function(){return this.$el.select2("val")},_setValue:function(c){this.$el.select2("val",c)},_template:function(c){return'<input type="hidden"/>'}});return{View:b}}); \ No newline at end of file diff -r b6acb69067f808147e4e69a1cde74cbb8868c600 -r 75a8d88ba72893daaf27e57d496ca799c20df0b9 static/scripts/packed/mvc/ui/ui-popover.js --- /dev/null +++ b/static/scripts/packed/mvc/ui/ui-popover.js @@ -0,0 +1,1 @@ +define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{with_close:true,container:"body",title:null,placement:"top"},visible:false,initialize:function(d){var c=this;this.options=_.defaults(d,this.optionsDefault);this.setElement(this._template(this.options));this.options.container.parent().append(this.$el);if(this.options.with_close){this.$el.find("#close").on("click",function(){c.hide()})}this.uuid=a.uuid();var c=this;$("body").on("mousedown."+this.uuid,function(f){c._hide(f)})},title:function(c){if(c!==undefined){this.$el.find(".popover-title-label").html(c)}},show:function(){this.$el.show();this.visible=true;var c=this._get_placement(this.options.placement);this.$el.css(c)},_get_placement:function(h){var d=this._get_width(this.$el);var j=this.$el.height();var k=this.options.container;var c=this._get_width(k);var f=this._get_height(k);var g=k.position();var i=0;var e=0;if(h=="top"||h=="bottom"){e=g.left-d+(c+d)/2;if(h=="top"){i=g.top-j-5}else{i=g.top+f+5}}return{top:i,left:e}},_get_width:function(c){return c.width()+parseInt(c.css("padding-left"))+parseInt(c.css("padding-right"))},_get_height:function(c){return c.height()+parseInt(c.css("padding-top"))+parseInt(c.css("padding-bottom"))},hide:function(){this.$el.hide();this.visible=false},append:function(c){this.$el.find(".popover-content").append(c)},empty:function(c){this.$el.find(".popover-content").empty()},remove:function(){$("body").off("mousedown."+this.uuid);this.$el.remove()},_hide:function(c){if(!$(this.options.container).is(c.target)&&!$(this.el).is(c.target)&&$(this.el).has(c.target).length===0){this.hide()}},_template:function(d){var c='<div class="popover-view popover fade '+d.placement+' in"><div class="arrow"></div><div class="popover-title"><div class="popover-title-label">'+d.title+"</div>";if(d.with_close){c+='<div id="close" class="popover-close fa fa-times-circle"></div>'}c+='</div><div class="popover-content"></div></div>';return c}});return{View:b}}); \ No newline at end of file diff -r b6acb69067f808147e4e69a1cde74cbb8868c600 -r 75a8d88ba72893daaf27e57d496ca799c20df0b9 static/scripts/packed/mvc/ui/ui-select.js --- /dev/null +++ b/static/scripts/packed/mvc/ui/ui-select.js @@ -0,0 +1,1 @@ +define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{css:"",placeholder:"No data available",data:[]},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.options.container.append(this.$el);this.select_data=this.options.data;this._refresh();if(this.options.value){this._setValue(this.options.value)}var c=this;if(this.options.onchange){this.$el.on("change",function(){c.options.onchange(c.value())})}},value:function(c){var d=this._getValue();if(c!==undefined){this._setValue(c)}var e=this._getValue();if(e===undefined){return null}else{if((e!=d&&this.options.onchange)){this.options.onchange(e)}return e}},text:function(){return this.$el.select2("data").text},disabled:function(){return !this.$el.select2("enable")},enable:function(){this.$el.select2("enable",true)},disable:function(){this.$el.select2("enable",false)},add:function(c){this.select_data.push({id:c.id,text:c.text});this._refresh()},del:function(d){var c=this._getIndex(d);if(c!=-1){this.select_data.splice(c,1);this._refresh()}},remove:function(){this.$el.select2("destroy")},update:function(c){this.select_data=[];for(var d in c.data){this.select_data.push(c.data[d])}this._refresh()},_refresh:function(){var e=this.select_data;if(!e||e.length==0){e=[]}var d=this._getValue();this.$el.select2({data:e,containerCssClass:this.options.css,placeholder:this.options.placeholder});var c=this._getIndex(d);if(c!=-1){this._setValue(d)}},_getIndex:function(d){for(var c in this.select_data){if(this.select_data[c].id==d){return c}}return -1},_getValue:function(){return this.$el.select2("val")},_setValue:function(c){this.$el.select2("val",c)},_template:function(c){return'<input type="hidden"/>'}});return{View:b}}); \ No newline at end of file diff -r b6acb69067f808147e4e69a1cde74cbb8868c600 -r 75a8d88ba72893daaf27e57d496ca799c20df0b9 static/scripts/packed/mvc/upload/upload-row.js --- a/static/scripts/packed/mvc/upload/upload-row.js +++ b/static/scripts/packed/mvc/upload/upload-row.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-extensions","mvc/upload/upload-settings","mvc/ui/popover","mvc/ui/select"],function(d,b,f,a,c,e){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(j,h){this.app=j;var g=this;this.model=new b.Model(h);this.setElement(this._template(h));var i=this.$el;this.settings=new c.View({title:"Upload configuration",container:i.find("#settings"),placement:"bottom"});this.select_genome=new e.View({css:"genome",onchange:function(){g.model.set("genome",g.select_genome.value())},data:g.app.list_genomes,container:i.find("#genome"),value:g.model.get("genome")});this.select_extension=new e.View({css:"extension",onchange:function(){g.model.set("extension",g.select_extension.value())},data:g.app.list_extensions,container:i.find("#extension"),value:g.model.get("extension")});i.find("#symbol").on("click",function(){g._removeRow()});i.find("#extension-info").on("click",function(k){g._showExtensionInfo()}).on("mousedown",function(k){k.preventDefault()});i.find("#settings").on("click",function(k){g._showSettings()}).on("mousedown",function(k){k.preventDefault()});i.find("#text-content").on("keyup",function(k){g.model.set("url_paste",$(k.target).val());g.model.set("file_size",$(k.target).val().length)});i.find("#space_to_tabs").on("change",function(k){g.model.set("space_to_tabs",$(k.target).prop("checked"))});this.model.on("change:percentage",function(){g._refreshPercentage()});this.model.on("change:status",function(){g._refreshStatus()});this.model.on("change:info",function(){g._refreshInfo()});this.model.on("change:genome",function(){g._refreshGenome()});this.model.on("change:file_size",function(){g._refreshFileSize()});this.model.on("remove",function(){g.remove()});this.app.collection.on("reset",function(){g.remove()})},render:function(){var n=this.model.get("file_name");var h=this.model.get("file_size");var k=this.model.get("file_mode");var j=this.$el;j.find("#title").html(n);j.find("#size").html(d.bytesToString(h));j.find("#mode").removeClass().addClass("mode");if(k=="new"){var m=j.find("#text");var l=this.options.padding;var i=j.width()-2*l;var g=j.height()-l;m.css("width",i+"px");m.css("top",g+"px");j.height(g+m.height()+2*l);m.show();j.find("#mode").addClass("fa fa-pencil")}if(k=="local"){j.find("#mode").addClass("fa fa-laptop")}if(k=="ftp"){j.find("#mode").addClass("fa fa-code-fork")}},remove:function(){this.select_genome.remove();this.select_extension.remove();Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var g=this.model.get("genome");this.select_genome.value(g)},_refreshInfo:function(){var g=this.model.get("info");if(g){this.$el.find("#info").html("<strong>Failed: </strong>"+g).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var g=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:g+"%"});if(g!=100){this.$el.find("#percentage").html(g+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var h=this.$el;var g=this.model.get("status");var j=this.status_classes[g];var i=this.$el.find("#symbol");i.removeClass();i.addClass(j);if(g=="init"){this.select_genome.enable();this.select_extension.enable();h.find("#text-content").attr("disabled",false);h.find("#space_to_tabs").attr("disabled",false)}else{this.select_genome.disable();this.select_extension.disable();h.find("#text-content").attr("disabled",true);h.find("#space_to_tabs").attr("disabled",true)}if(g=="success"){h.addClass("success");h.find("#percentage").html("100%")}if(g=="error"){h.addClass("danger");h.find(".progress").remove()}},_refreshFileSize:function(){var g=this.model.get("file_size");this.$el.find("#size").html(d.bytesToString(g))},_removeRow:function(){var g=this.model.get("status");if(g=="init"||g=="success"||g=="error"){this.app.collection.remove(this.model)}},_showExtensionInfo:function(){var g=$(this.el).find("#extension-info");var i=this.model.get("extension");var h=this.select_extension.text();if(!this.extension_popup){this.extension_popup=new c.View({content:f(i),placement:"bottom",container:g})}if(!this.extension_popup.visible){this.extension_popup.title(h);this.extension_popup.empty();this.extension_popup.append(f(i));this.extension_popup.show()}else{this.extension_popup.hide()}},_showSettings:function(){if(!this.settings.visible){this.settings.empty();this.settings.append((new a(this)).$el);this.settings.show()}else{this.settings.hide()}},_template:function(g){return'<tr id="upload-item-'+g.id+'" class="upload-item"><td><div style="position: relative;"><div id="mode"></div><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td><td><div id="extension" class="extension" style="float: left;"/>  <div id="extension-info" class="upload-icon-button fa fa-search"/></td><td><div id="genome" class="genome" /></td><td><div id="settings" class="upload-icon-button fa fa-gear"></div><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>'}})}); \ No newline at end of file +define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-extensions","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(d,b,f,a,c,e){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(j,h){this.app=j;var g=this;this.model=new b.Model(h);this.setElement(this._template(h));var i=this.$el;this.settings=new c.View({title:"Upload configuration",container:i.find("#settings"),placement:"bottom"});this.select_genome=new e.View({css:"genome",onchange:function(){g.model.set("genome",g.select_genome.value())},data:g.app.list_genomes,container:i.find("#genome"),value:g.model.get("genome")});this.select_extension=new e.View({css:"extension",onchange:function(){g.model.set("extension",g.select_extension.value())},data:g.app.list_extensions,container:i.find("#extension"),value:g.model.get("extension")});i.find("#symbol").on("click",function(){g._removeRow()});i.find("#extension-info").on("click",function(k){g._showExtensionInfo()}).on("mousedown",function(k){k.preventDefault()});i.find("#settings").on("click",function(k){g._showSettings()}).on("mousedown",function(k){k.preventDefault()});i.find("#text-content").on("keyup",function(k){g.model.set("url_paste",$(k.target).val());g.model.set("file_size",$(k.target).val().length)});i.find("#space_to_tabs").on("change",function(k){g.model.set("space_to_tabs",$(k.target).prop("checked"))});this.model.on("change:percentage",function(){g._refreshPercentage()});this.model.on("change:status",function(){g._refreshStatus()});this.model.on("change:info",function(){g._refreshInfo()});this.model.on("change:genome",function(){g._refreshGenome()});this.model.on("change:file_size",function(){g._refreshFileSize()});this.model.on("remove",function(){g.remove()});this.app.collection.on("reset",function(){g.remove()})},render:function(){var n=this.model.get("file_name");var h=this.model.get("file_size");var k=this.model.get("file_mode");var j=this.$el;j.find("#title").html(n);j.find("#size").html(d.bytesToString(h));j.find("#mode").removeClass().addClass("mode");if(k=="new"){var m=j.find("#text");var l=this.options.padding;var i=j.width()-2*l;var g=j.height()-l;m.css("width",i+"px");m.css("top",g+"px");j.height(g+m.height()+2*l);m.show();j.find("#mode").addClass("fa fa-pencil")}if(k=="local"){j.find("#mode").addClass("fa fa-laptop")}if(k=="ftp"){j.find("#mode").addClass("fa fa-code-fork")}},remove:function(){this.select_genome.remove();this.select_extension.remove();Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var g=this.model.get("genome");this.select_genome.value(g)},_refreshInfo:function(){var g=this.model.get("info");if(g){this.$el.find("#info").html("<strong>Failed: </strong>"+g).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var g=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:g+"%"});if(g!=100){this.$el.find("#percentage").html(g+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var h=this.$el;var g=this.model.get("status");var j=this.status_classes[g];var i=this.$el.find("#symbol");i.removeClass();i.addClass(j);if(g=="init"){this.select_genome.enable();this.select_extension.enable();h.find("#text-content").attr("disabled",false);h.find("#space_to_tabs").attr("disabled",false)}else{this.select_genome.disable();this.select_extension.disable();h.find("#text-content").attr("disabled",true);h.find("#space_to_tabs").attr("disabled",true)}if(g=="success"){h.addClass("success");h.find("#percentage").html("100%")}if(g=="error"){h.addClass("danger");h.find(".progress").remove()}},_refreshFileSize:function(){var g=this.model.get("file_size");this.$el.find("#size").html(d.bytesToString(g))},_removeRow:function(){var g=this.model.get("status");if(g=="init"||g=="success"||g=="error"){this.app.collection.remove(this.model)}},_showExtensionInfo:function(){var g=$(this.el).find("#extension-info");var i=this.model.get("extension");var h=this.select_extension.text();if(!this.extension_popup){this.extension_popup=new c.View({content:f(i),placement:"bottom",container:g})}if(!this.extension_popup.visible){this.extension_popup.title(h);this.extension_popup.empty();this.extension_popup.append(f(i));this.extension_popup.show()}else{this.extension_popup.hide()}},_showSettings:function(){if(!this.settings.visible){this.settings.empty();this.settings.append((new a(this)).$el);this.settings.show()}else{this.settings.hide()}},_template:function(g){return'<tr id="upload-item-'+g.id+'" class="upload-item"><td><div style="position: relative;"><div id="mode"></div><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td><td><div id="extension" class="extension" style="float: left;"/>  <div id="extension-info" class="upload-icon-button fa fa-search"/></td><td><div id="genome" class="genome" /></td><td><div id="settings" class="upload-icon-button fa fa-gear"></div><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>'}})}); \ No newline at end of file diff -r b6acb69067f808147e4e69a1cde74cbb8868c600 -r 75a8d88ba72893daaf27e57d496ca799c20df0b9 static/scripts/packed/mvc/upload/upload-view.js --- a/static/scripts/packed/mvc/upload/upload-view.js +++ b/static/scripts/packed/mvc/upload/upload-view.js @@ -1,1 +1,1 @@ -define(["galaxy.modal","utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/popover","mvc/ui","utils/uploadbox"],function(a,f,e,c,b,g,d){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,upload_size:0,list_extensions:[{id:"auto",text:"Auto-detect"}],list_genomes:[],collection:new c.Collection(),ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(i){var h=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){h.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(j){if(j){h._eventShow(j)}},onunload:function(){if(h.counter.running>0){return"Several uploads are still processing."}}});$("#left .unified-panel-header-inner").append((new e.View(this.ui_button)).$el);var h=this;f.jsonFromUrl(galaxy_config.root+"api/datatypes?upload_only=True",function(j){for(key in j){h.list_extensions.push({id:j[key],text:j[key]})}});f.jsonFromUrl(galaxy_config.root+"api/genomes",function(j){for(key in j){h.list_genomes.push({id:j[key][1],text:j[key][0]})}h.list_genomes.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0})});if(i){this.options=_.defaults(i,this.options)}this.collection.on("remove",function(j){h._eventRemove(j)});this.collection.on("change:genome",function(k){var j=k.get("genome");h.collection.each(function(l){if(l.get("status")=="init"&&l.get("genome")=="?"){l.set("genome",j)}})})},_eventShow:function(j){j.preventDefault();if(!this.modal){var h=this;this.modal=new a.GalaxyModal({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){h.uploadbox.select()},"Choose FTP file":function(){h._eventFtp()},"Create new file":function(){h._eventCreate()},Start:function(){h._eventStart()},Pause:function(){h._eventStop()},Reset:function(){h._eventReset()},Close:function(){h.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var h=this;this.uploadbox=this.$el.uploadbox({announce:function(k,l,m){h._eventAnnounce(k,l,m)},initialize:function(k,l,m){return h._eventInitialize(k,l,m)},progress:function(k,l,m){h._eventProgress(k,l,m)},success:function(k,l,m){h._eventSuccess(k,l,m)},error:function(k,l,m){h._eventError(k,l,m)},complete:function(){h._eventComplete()}});this._updateScreen();if(this.options.ftp_upload_dir&&this.options.ftp_upload_site){var i=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:i})}else{this.modal.hideButton("Choose FTP file")}}this.modal.show()},_eventRemove:function(i){var h=i.get("status");if(h=="success"){this.counter.success--}else{if(h=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(i.id)},_eventAnnounce:function(h,i,k){this.counter.announce++;this._updateScreen();var j=new b(this,{id:h,file_name:i.name,file_size:i.size,file_mode:i.mode,file_path:i.path});this.collection.add(j.model);$(this.el).find("tbody:first").append(j.$el);j.render()},_eventInitialize:function(m,j,s){var k=this.collection.get(m);k.set("status","running");var o=k.get("file_name");var n=k.get("file_path");var h=k.get("file_mode");var p=k.get("extension");var r=k.get("genome");var q=k.get("url_paste");var l=k.get("space_to_tabs");var i=k.get("to_posix_lines");if(!q&&!(j.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(h=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(h=="new"){tool_input["files_0|url_paste"]=q}if(h=="ftp"){tool_input["files_0|ftp_files"]=n}tool_input.dbkey=r;tool_input.file_type=p;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=l;tool_input.to_posix_lines=i;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(i,j,h){var k=this.collection.get(i);k.set("percentage",h);this.ui_button.set("percentage",this._upload_percentage(h,j.size))},_eventSuccess:function(i,j,l){var k=this.collection.get(i);k.set("percentage",100);k.set("status","success");var h=k.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,h));this.upload_completed+=h*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(h,i,k){var j=this.collection.get(h);j.set("percentage",100);j.set("status","error");j.set("info",k);this.ui_button.set("percentage",this._upload_percentage(100,i.size));this.ui_button.set("status","danger");this.upload_completed+=i.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(h){if(h.get("status")=="queued"){h.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventFtp:function(){if(!this.ftp.visible){this.ftp.empty();this.ftp.append((new g(this)).$el);this.ftp.show()}else{this.ftp.hide()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var h=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(i){if(i.get("status")=="init"){i.set("status","queued");h.upload_size+=i.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.ui_button.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.ui_button.set("percentage",0)}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose local file");this.modal.enableButton("Choose FTP file");this.modal.enableButton("Create new file")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Create new file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("#upload-table").show()}else{$(this.el).find("#upload-table").hide()}},_upload_percentage:function(h,i){return(this.upload_completed+(h*i))/this.upload_size},_template:function(i,h){return'<div id="'+i+'" class="upload-box"><table id="upload-table" class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Settings</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+h+'" class="upload-info"></h6>'}})}); \ No newline at end of file +define(["galaxy.modal","utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui","utils/uploadbox"],function(a,f,e,c,b,g,d){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,upload_size:0,list_extensions:[{id:"auto",text:"Auto-detect"}],list_genomes:[],collection:new c.Collection(),ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(i){var h=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){h.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(j){if(j){h._eventShow(j)}},onunload:function(){if(h.counter.running>0){return"Several uploads are still processing."}}});$("#left .unified-panel-header-inner").append((new e.View(this.ui_button)).$el);var h=this;f.jsonFromUrl(galaxy_config.root+"api/datatypes?upload_only=True",function(j){for(key in j){h.list_extensions.push({id:j[key],text:j[key]})}});f.jsonFromUrl(galaxy_config.root+"api/genomes",function(j){for(key in j){h.list_genomes.push({id:j[key][1],text:j[key][0]})}h.list_genomes.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0})});if(i){this.options=_.defaults(i,this.options)}this.collection.on("remove",function(j){h._eventRemove(j)});this.collection.on("change:genome",function(k){var j=k.get("genome");h.collection.each(function(l){if(l.get("status")=="init"&&l.get("genome")=="?"){l.set("genome",j)}})})},_eventShow:function(j){j.preventDefault();if(!this.modal){var h=this;this.modal=new a.GalaxyModal({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){h.uploadbox.select()},"Choose FTP file":function(){h._eventFtp()},"Create new file":function(){h._eventCreate()},Start:function(){h._eventStart()},Pause:function(){h._eventStop()},Reset:function(){h._eventReset()},Close:function(){h.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var h=this;this.uploadbox=this.$el.uploadbox({announce:function(k,l,m){h._eventAnnounce(k,l,m)},initialize:function(k,l,m){return h._eventInitialize(k,l,m)},progress:function(k,l,m){h._eventProgress(k,l,m)},success:function(k,l,m){h._eventSuccess(k,l,m)},error:function(k,l,m){h._eventError(k,l,m)},complete:function(){h._eventComplete()}});this._updateScreen();if(this.options.ftp_upload_dir&&this.options.ftp_upload_site){var i=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:i})}else{this.modal.hideButton("Choose FTP file")}}this.modal.show()},_eventRemove:function(i){var h=i.get("status");if(h=="success"){this.counter.success--}else{if(h=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(i.id)},_eventAnnounce:function(h,i,k){this.counter.announce++;this._updateScreen();var j=new b(this,{id:h,file_name:i.name,file_size:i.size,file_mode:i.mode,file_path:i.path});this.collection.add(j.model);$(this.el).find("tbody:first").append(j.$el);j.render()},_eventInitialize:function(m,j,s){var k=this.collection.get(m);k.set("status","running");var o=k.get("file_name");var n=k.get("file_path");var h=k.get("file_mode");var p=k.get("extension");var r=k.get("genome");var q=k.get("url_paste");var l=k.get("space_to_tabs");var i=k.get("to_posix_lines");if(!q&&!(j.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(h=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(h=="new"){tool_input["files_0|url_paste"]=q}if(h=="ftp"){tool_input["files_0|ftp_files"]=n}tool_input.dbkey=r;tool_input.file_type=p;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=l;tool_input.to_posix_lines=i;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(i,j,h){var k=this.collection.get(i);k.set("percentage",h);this.ui_button.set("percentage",this._upload_percentage(h,j.size))},_eventSuccess:function(i,j,l){var k=this.collection.get(i);k.set("percentage",100);k.set("status","success");var h=k.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,h));this.upload_completed+=h*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(h,i,k){var j=this.collection.get(h);j.set("percentage",100);j.set("status","error");j.set("info",k);this.ui_button.set("percentage",this._upload_percentage(100,i.size));this.ui_button.set("status","danger");this.upload_completed+=i.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(h){if(h.get("status")=="queued"){h.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventFtp:function(){if(!this.ftp.visible){this.ftp.empty();this.ftp.append((new g(this)).$el);this.ftp.show()}else{this.ftp.hide()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var h=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(i){if(i.get("status")=="init"){i.set("status","queued");h.upload_size+=i.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.ui_button.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.ui_button.set("percentage",0)}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose local file");this.modal.enableButton("Choose FTP file");this.modal.enableButton("Create new file")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Create new file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("#upload-table").show()}else{$(this.el).find("#upload-table").hide()}},_upload_percentage:function(h,i){return(this.upload_completed+(h*i))/this.upload_size},_template:function(i,h){return'<div id="'+i+'" class="upload-box"><table id="upload-table" class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Settings</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+h+'" class="upload-info"></h6>'}})}); \ 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.