commit/galaxy-central: guerler: Upload: Improve user interaction
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/b962897b1dfe/ Changeset: b962897b1dfe User: guerler Date: 2015-01-29 07:55:56+00:00 Summary: Upload: Improve user interaction Affected #: 3 files diff -r c80c4227f2250a3b891d08b2c78d654dfd650691 -r b962897b1dfe60442bf5328637cb3e23b800d53f client/galaxy/scripts/mvc/upload/upload-view.js --- a/client/galaxy/scripts/mvc/upload/upload-view.js +++ b/client/galaxy/scripts/mvc/upload/upload-view.js @@ -137,6 +137,9 @@ if (!self.options.datatypes_disable_auto) { self.list_extensions.unshift(self.auto); } + + // set default extensions + self.default_extension = self.list_extensions[0] && self.list_extensions[0].id; } }); @@ -155,6 +158,9 @@ self.list_genomes.sort(function(a, b) { return a.id > b.id ? 1 : a.id < b.id ? -1 : 0; }); + + // set default extensions + self.default_genome = self.list_genomes[0] && self.list_genomes[0].id; } }); @@ -222,9 +228,16 @@ // select extension this.select_extension = new Select.View({ css : 'header-selection', - data : self.list_extensions, - container : self.$el.parent().find('#header-extension'), - value : self.list_extensions[0] + data : this.list_extensions, + container : this.$el.parent().find('#header-extension'), + value : this.default_extension, + onchange : function(extension) { + self.collection.each(function(item) { + if (item.get('status') == 'init' && item.get('extension') == self.default_extension) { + item.set('extension', extension); + } + }); + } }); // handle extension info popover @@ -232,16 +245,24 @@ self.showExtensionInfo({ $el : $(e.target), title : self.select_extension.text(), - extension : self.select_extension.value() + extension : self.select_extension.value(), + placement : 'top' }); }).on('mousedown', function(e) { e.preventDefault(); }); // genome extension this.select_genome = new Select.View({ css : 'header-selection', - data : self.list_genomes, - container : self.$el.parent().find('#header-genome'), - value : self.list_genomes[0] + data : this.list_genomes, + container : this.$el.parent().find('#header-genome'), + value : this.default_genome, + onchange : function(genome) { + self.collection.each(function(item) { + if (item.get('status') == 'init' && item.get('genome') == self.default_genome) { + item.set('genome', genome); + } + }); + } }); } @@ -266,7 +287,7 @@ // create popup this.extension_popup && this.extension_popup.remove(); this.extension_popup = new Popover.View({ - placement: 'bottom', + placement: options.placement || 'bottom', container: $el, destroy: true }); @@ -403,7 +424,7 @@ it.set('percentage', percentage); // update ui button - this.ui_button.set('percentage', this._upload_percentage(percentage, file.size)); + this.ui_button.set('percentage', this._uploadPercentage(percentage, file.size)); }, // success @@ -417,7 +438,7 @@ var file_size = it.get('file_size'); // update ui button - this.ui_button.set('percentage', this._upload_percentage(100, file_size)); + this.ui_button.set('percentage', this._uploadPercentage(100, file_size)); // update completed this.upload_completed += file_size * 100; @@ -444,7 +465,7 @@ it.set('info', message); // update ui button - this.ui_button.set('percentage', this._upload_percentage(100, file.size)); + this.ui_button.set('percentage', this._uploadPercentage(100, file.size)); this.ui_button.set('status', 'danger'); // update completed @@ -563,8 +584,8 @@ this.uploadbox.reset(); // reset value for universal type drop-down - this.select_extension.value(this.list_extensions[0]); - this.select_genome.value(this.list_genomes[0]); + this.select_extension.value(this.default_extension); + this.select_genome.value(this.default_genome); // reset button this.ui_button.set('percentage', 0); @@ -652,11 +673,10 @@ }, // calculate percentage of all queued uploads - _upload_percentage: function(percentage, size) { + _uploadPercentage: function(percentage, size) { return (this.upload_completed + (percentage * size)) / this.upload_size; }, - // template for extensions description _templateDescription: function(options) { if (options.description) { diff -r c80c4227f2250a3b891d08b2c78d654dfd650691 -r b962897b1dfe60442bf5328637cb3e23b800d53f static/scripts/mvc/upload/upload-view.js --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -137,6 +137,9 @@ if (!self.options.datatypes_disable_auto) { self.list_extensions.unshift(self.auto); } + + // set default extensions + self.default_extension = self.list_extensions[0] && self.list_extensions[0].id; } }); @@ -155,6 +158,9 @@ self.list_genomes.sort(function(a, b) { return a.id > b.id ? 1 : a.id < b.id ? -1 : 0; }); + + // set default extensions + self.default_genome = self.list_genomes[0] && self.list_genomes[0].id; } }); @@ -222,9 +228,16 @@ // select extension this.select_extension = new Select.View({ css : 'header-selection', - data : self.list_extensions, - container : self.$el.parent().find('#header-extension'), - value : self.list_extensions[0] + data : this.list_extensions, + container : this.$el.parent().find('#header-extension'), + value : this.default_extension, + onchange : function(extension) { + self.collection.each(function(item) { + if (item.get('status') == 'init' && item.get('extension') == self.default_extension) { + item.set('extension', extension); + } + }); + } }); // handle extension info popover @@ -232,16 +245,24 @@ self.showExtensionInfo({ $el : $(e.target), title : self.select_extension.text(), - extension : self.select_extension.value() + extension : self.select_extension.value(), + placement : 'top' }); }).on('mousedown', function(e) { e.preventDefault(); }); // genome extension this.select_genome = new Select.View({ css : 'header-selection', - data : self.list_genomes, - container : self.$el.parent().find('#header-genome'), - value : self.list_genomes[0] + data : this.list_genomes, + container : this.$el.parent().find('#header-genome'), + value : this.default_genome, + onchange : function(genome) { + self.collection.each(function(item) { + if (item.get('status') == 'init' && item.get('genome') == self.default_genome) { + item.set('genome', genome); + } + }); + } }); } @@ -266,7 +287,7 @@ // create popup this.extension_popup && this.extension_popup.remove(); this.extension_popup = new Popover.View({ - placement: 'bottom', + placement: options.placement || 'bottom', container: $el, destroy: true }); @@ -403,7 +424,7 @@ it.set('percentage', percentage); // update ui button - this.ui_button.set('percentage', this._upload_percentage(percentage, file.size)); + this.ui_button.set('percentage', this._uploadPercentage(percentage, file.size)); }, // success @@ -417,7 +438,7 @@ var file_size = it.get('file_size'); // update ui button - this.ui_button.set('percentage', this._upload_percentage(100, file_size)); + this.ui_button.set('percentage', this._uploadPercentage(100, file_size)); // update completed this.upload_completed += file_size * 100; @@ -444,7 +465,7 @@ it.set('info', message); // update ui button - this.ui_button.set('percentage', this._upload_percentage(100, file.size)); + this.ui_button.set('percentage', this._uploadPercentage(100, file.size)); this.ui_button.set('status', 'danger'); // update completed @@ -563,8 +584,8 @@ this.uploadbox.reset(); // reset value for universal type drop-down - this.select_extension.value(this.list_extensions[0]); - this.select_genome.value(this.list_genomes[0]); + this.select_extension.value(this.default_extension); + this.select_genome.value(this.default_genome); // reset button this.ui_button.set('percentage', 0); @@ -652,11 +673,10 @@ }, // calculate percentage of all queued uploads - _upload_percentage: function(percentage, size) { + _uploadPercentage: function(percentage, size) { return (this.upload_completed + (percentage * size)) / this.upload_size; }, - // template for extensions description _templateDescription: function(options) { if (options.description) { diff -r c80c4227f2250a3b891d08b2c78d654dfd650691 -r b962897b1dfe60442bf5328637cb3e23b800d53f 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(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","mvc/ui/ui-select","utils/uploadbox"],function(f,e,c,b,g,d,a,h){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,select_extension:null,select_genome:null,upload_size:0,list_extensions:[],list_genomes:[],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."},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(j){var i=this;if(j){this.options=_.defaults(j,this.options)}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(k){if(k){k.preventDefault();i.show()}},onunload:function(){if(i.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var i=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(k){for(key in k){i.list_extensions.push({id:k[key].extension,text:k[key].extension,description:k[key].description,description_url:k[key].description_url})}i.list_extensions.sort(function(m,l){return m.id>l.id?1:m.id<l.id?-1:0});if(!i.options.datatypes_disable_auto){i.list_extensions.unshift(i.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(k){for(key in k){i.list_genomes.push({id:k[key][1],text:k[key][0]})}i.list_genomes.sort(function(m,l){return m.id>l.id?1:m.id<l.id?-1:0})}});this.collection.on("remove",function(k){i._eventRemove(k)})},show:function(){var i=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){i.show()},500);return}if(!this.modal){var i=this;this.modal=new a.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){i.uploadbox.select()},"Choose FTP file":function(){i._eventFtp()},"Paste/Fetch data":function(){i._eventCreate()},Start:function(){i._eventStart()},Pause:function(){i._eventStop()},Reset:function(){i._eventReset()},Close:function(){i.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var i=this;this.uploadbox=this.$el.uploadbox({announce:function(k,l,m){i._eventAnnounce(k,l,m)},initialize:function(k,l,m){return i._eventInitialize(k,l,m)},progress:function(k,l,m){i._eventProgress(k,l,m)},success:function(k,l,m){i._eventSuccess(k,l,m)},error:function(k,l,m){i._eventError(k,l,m)},complete:function(){i._eventComplete()}});var j=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:j});this.select_extension=new h.View({css:"header-selection",data:i.list_extensions,container:i.$el.parent().find("#header-extension"),value:i.list_extensions[0]});i.$el.parent().find("#header-extension-info").on("click",function(k){i.showExtensionInfo({$el:$(k.target),title:i.select_extension.text(),extension:i.select_extension.value()})}).on("mousedown",function(k){k.preventDefault()});this.select_genome=new h.View({css:"header-selection",data:i.list_genomes,container:i.$el.parent().find("#header-genome"),value:i.list_genomes[0]})}this.modal.show();this._updateUser();this._updateScreen()},showExtensionInfo:function(j){var i=this;var k=j.$el;var n=j.extension;var m=j.title;var l=_.findWhere(i.list_extensions,{id:n});this.extension_popup&&this.extension_popup.remove();this.extension_popup=new d.View({placement:"bottom",container:k,destroy:true});this.extension_popup.title(m);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(l));this.extension_popup.show()},_eventRemove:function(j){var i=j.get("status");if(i=="success"){this.counter.success--}else{if(i=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(j.id)},_eventAnnounce:function(i,j,l){this.counter.announce++;this._updateScreen();var k=new b(this,{id:i,file_name:j.name,file_size:j.size,file_mode:j.mode,file_path:j.path});this.collection.add(k.model);$(this.el).find("tbody:first").append(k.$el);k.render()},_eventInitialize:function(n,k,t){var l=this.collection.get(n);l.set("status","running");var p=l.get("file_name");var o=l.get("file_path");var i=l.get("file_mode");var q=l.get("extension");var s=l.get("genome");var r=l.get("url_paste");var m=l.get("space_to_tabs");var j=l.get("to_posix_lines");if(!r&&!(k.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(i=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(i=="new"){tool_input["files_0|url_paste"]=r}if(i=="ftp"){tool_input["files_0|ftp_files"]=o}tool_input.dbkey=s;tool_input.file_type=q;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|space_to_tab"]=m&&"Yes"||null;tool_input["files_0|to_posix_lines"]=j&&"Yes"||null;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(j,k,i){var l=this.collection.get(j);l.set("percentage",i);this.ui_button.set("percentage",this._upload_percentage(i,k.size))},_eventSuccess:function(j,k,m){var l=this.collection.get(j);l.set("percentage",100);l.set("status","success");var i=l.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,i));this.upload_completed+=i*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(i,j,l){var k=this.collection.get(i);k.set("percentage",100);k.set("status","error");k.set("info",l);this.ui_button.set("percentage",this._upload_percentage(100,j.size));this.ui_button.set("status","danger");this.upload_completed+=j.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(i){if(i.get("status")=="queued"){i.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 i=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(j){if(j.get("status")=="init"){j.set("status","queued");i.upload_size+=j.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");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.select_extension.value(this.list_extensions[0]);this.select_genome.value(this.list_genomes[0]);this.ui_button.set("percentage",0)}},_updateUser:function(){this.current_user=Galaxy.currUser.get("id");this.current_history=null;if(this.current_user){this.current_history=Galaxy.currHistoryPanel.model.get("id")}},_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("Paste/Fetch data")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Paste/Fetch data")}if(this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site){this.modal.showButton("Choose FTP file")}else{this.modal.hideButton("Choose FTP 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(i,j){return(this.upload_completed+(i*j))/this.upload_size},_templateDescription:function(j){if(j.description){var i=j.description;if(j.description_url){i+=' (<a href="'+j.description_url+'" target="_blank">read more</a>)'}return i}else{return"There is no description available for this file extension."}},_template:function(j,i){return'<div class="upload-top"><h6 id="'+i+'" class="upload-info"></h6></div><div id="'+j+'" 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><div id="upload-header" class="upload-header"><span class="header-title">Type (default):</span><span id="header-extension"/><span id="header-extension-info" class="upload-icon-button fa fa-search"/><span class="header-title">Genome (default):</span><span id="header-genome"/></div>'}})}); \ No newline at end of file +define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","mvc/ui/ui-select","utils/uploadbox"],function(f,e,c,b,g,d,a,h){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,select_extension:null,select_genome:null,upload_size:0,list_extensions:[],list_genomes:[],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."},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(j){var i=this;if(j){this.options=_.defaults(j,this.options)}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(k){if(k){k.preventDefault();i.show()}},onunload:function(){if(i.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var i=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(k){for(key in k){i.list_extensions.push({id:k[key].extension,text:k[key].extension,description:k[key].description,description_url:k[key].description_url})}i.list_extensions.sort(function(m,l){return m.id>l.id?1:m.id<l.id?-1:0});if(!i.options.datatypes_disable_auto){i.list_extensions.unshift(i.auto)}i.default_extension=i.list_extensions[0]&&i.list_extensions[0].id}});f.get({url:galaxy_config.root+"api/genomes",success:function(k){for(key in k){i.list_genomes.push({id:k[key][1],text:k[key][0]})}i.list_genomes.sort(function(m,l){return m.id>l.id?1:m.id<l.id?-1:0});i.default_genome=i.list_genomes[0]&&i.list_genomes[0].id}});this.collection.on("remove",function(k){i._eventRemove(k)})},show:function(){var i=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){i.show()},500);return}if(!this.modal){var i=this;this.modal=new a.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){i.uploadbox.select()},"Choose FTP file":function(){i._eventFtp()},"Paste/Fetch data":function(){i._eventCreate()},Start:function(){i._eventStart()},Pause:function(){i._eventStop()},Reset:function(){i._eventReset()},Close:function(){i.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var i=this;this.uploadbox=this.$el.uploadbox({announce:function(k,l,m){i._eventAnnounce(k,l,m)},initialize:function(k,l,m){return i._eventInitialize(k,l,m)},progress:function(k,l,m){i._eventProgress(k,l,m)},success:function(k,l,m){i._eventSuccess(k,l,m)},error:function(k,l,m){i._eventError(k,l,m)},complete:function(){i._eventComplete()}});var j=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:j});this.select_extension=new h.View({css:"header-selection",data:this.list_extensions,container:this.$el.parent().find("#header-extension"),value:this.default_extension,onchange:function(k){i.collection.each(function(l){if(l.get("status")=="init"&&l.get("extension")==i.default_extension){l.set("extension",k)}})}});i.$el.parent().find("#header-extension-info").on("click",function(k){i.showExtensionInfo({$el:$(k.target),title:i.select_extension.text(),extension:i.select_extension.value(),placement:"top"})}).on("mousedown",function(k){k.preventDefault()});this.select_genome=new h.View({css:"header-selection",data:this.list_genomes,container:this.$el.parent().find("#header-genome"),value:this.default_genome,onchange:function(k){i.collection.each(function(l){if(l.get("status")=="init"&&l.get("genome")==i.default_genome){l.set("genome",k)}})}})}this.modal.show();this._updateUser();this._updateScreen()},showExtensionInfo:function(j){var i=this;var k=j.$el;var n=j.extension;var m=j.title;var l=_.findWhere(i.list_extensions,{id:n});this.extension_popup&&this.extension_popup.remove();this.extension_popup=new d.View({placement:j.placement||"bottom",container:k,destroy:true});this.extension_popup.title(m);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(l));this.extension_popup.show()},_eventRemove:function(j){var i=j.get("status");if(i=="success"){this.counter.success--}else{if(i=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(j.id)},_eventAnnounce:function(i,j,l){this.counter.announce++;this._updateScreen();var k=new b(this,{id:i,file_name:j.name,file_size:j.size,file_mode:j.mode,file_path:j.path});this.collection.add(k.model);$(this.el).find("tbody:first").append(k.$el);k.render()},_eventInitialize:function(n,k,t){var l=this.collection.get(n);l.set("status","running");var p=l.get("file_name");var o=l.get("file_path");var i=l.get("file_mode");var q=l.get("extension");var s=l.get("genome");var r=l.get("url_paste");var m=l.get("space_to_tabs");var j=l.get("to_posix_lines");if(!r&&!(k.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(i=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(i=="new"){tool_input["files_0|url_paste"]=r}if(i=="ftp"){tool_input["files_0|ftp_files"]=o}tool_input.dbkey=s;tool_input.file_type=q;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|space_to_tab"]=m&&"Yes"||null;tool_input["files_0|to_posix_lines"]=j&&"Yes"||null;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(j,k,i){var l=this.collection.get(j);l.set("percentage",i);this.ui_button.set("percentage",this._uploadPercentage(i,k.size))},_eventSuccess:function(j,k,m){var l=this.collection.get(j);l.set("percentage",100);l.set("status","success");var i=l.get("file_size");this.ui_button.set("percentage",this._uploadPercentage(100,i));this.upload_completed+=i*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(i,j,l){var k=this.collection.get(i);k.set("percentage",100);k.set("status","error");k.set("info",l);this.ui_button.set("percentage",this._uploadPercentage(100,j.size));this.ui_button.set("status","danger");this.upload_completed+=j.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(i){if(i.get("status")=="queued"){i.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 i=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(j){if(j.get("status")=="init"){j.set("status","queued");i.upload_size+=j.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");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.select_extension.value(this.default_extension);this.select_genome.value(this.default_genome);this.ui_button.set("percentage",0)}},_updateUser:function(){this.current_user=Galaxy.currUser.get("id");this.current_history=null;if(this.current_user){this.current_history=Galaxy.currHistoryPanel.model.get("id")}},_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("Paste/Fetch data")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Paste/Fetch data")}if(this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site){this.modal.showButton("Choose FTP file")}else{this.modal.hideButton("Choose FTP 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()}},_uploadPercentage:function(i,j){return(this.upload_completed+(i*j))/this.upload_size},_templateDescription:function(j){if(j.description){var i=j.description;if(j.description_url){i+=' (<a href="'+j.description_url+'" target="_blank">read more</a>)'}return i}else{return"There is no description available for this file extension."}},_template:function(j,i){return'<div class="upload-top"><h6 id="'+i+'" class="upload-info"></h6></div><div id="'+j+'" 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><div id="upload-header" class="upload-header"><span class="header-title">Type (default):</span><span id="header-extension"/><span id="header-extension-info" class="upload-icon-button fa fa-search"/><span class="header-title">Genome (default):</span><span id="header-genome"/></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.
participants (1)
-
commits-noreply@bitbucket.org