commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/3232c9fc4d8f/ Changeset: 3232c9fc4d8f User: dannon Date: 2015-01-23 19:39:53+00:00 Summary: Cut unused showSettings method from upload's view -- this is in upload-row. Affected #: 3 files diff -r 9ef517d8e767037e1633f6063c6edb3023f86499 -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f 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 @@ -295,19 +295,6 @@ } }, - _showSettings : function() { - // check if popover is visible - if (!this.settings.visible) { - // show popover - this.settings.empty(); - this.settings.append((new UploadSettings(this)).$el); - this.settings.show(); - } else { - // hide popover - this.settings.hide(); - } - }, - _templateDescription: function(options) { if (options.description) { var tmpl = options.description; diff -r 9ef517d8e767037e1633f6063c6edb3023f86499 -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f static/scripts/mvc/upload/upload-view.js --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -295,19 +295,6 @@ } }, - _showSettings : function() { - // check if popover is visible - if (!this.settings.visible) { - // show popover - this.settings.empty(); - this.settings.append((new UploadSettings(this)).$el); - this.settings.show(); - } else { - // hide popover - this.settings.hide(); - } - }, - _templateDescription: function(options) { if (options.description) { var tmpl = options.description; diff -r 9ef517d8e767037e1633f6063c6edb3023f86499 -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f 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,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(k){var j=this;if(k){this.options=_.defaults(k,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(l){if(l){l.preventDefault();j.show()}},onunload:function(){if(j.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var j=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(l){for(key in l){j.list_extensions.push({id:l[key].extension,text:l[key].extension,description:l[key].description,description_url:l[key].description_url})}j.list_extensions.sort(function(n,m){return n.id>m.id?1:n.id<m.id?-1:0});j.list_extensions.push({id:"---",text:"---",description:"",description_url:""});if(!j.options.datatypes_disable_auto){j.list_extensions.unshift(j.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(l){for(key in l){j.list_genomes.push({id:l[key][1],text:l[key][0]})}j.list_genomes.sort(function(n,m){return n.id>m.id?1:n.id<m.id?-1:0})}});this.collection.on("remove",function(l){j._eventRemove(l)});this.collection.on("change:genome",function(m){var l=m.get("genome");j.collection.each(function(n){if(n.get("status")=="init"&&n.get("genome")=="?"){n.set("genome",l)}})})},show:function(){var j=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){j.show()},500);return}if(!this.modal){var j=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(){j.uploadbox.select()},"Choose FTP file":function(){j._eventFtp()},"Paste/Fetch data":function(){j._eventCreate()},Start:function(){j._eventStart()},Pause:function(){j._eventStop()},Reset:function(){j._eventReset()},Close:function(){j.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var j=this;this.uploadbox=this.$el.uploadbox({announce:function(l,m,n){j._eventAnnounce(l,m,n)},initialize:function(l,m,n){return j._eventInitialize(l,m,n)},progress:function(l,m,n){j._eventProgress(l,m,n)},success:function(l,m,n){j._eventSuccess(l,m,n)},error:function(l,m,n){j._eventError(l,m,n)},complete:function(){j._eventComplete()}});var k=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:k});this.select_extension=new h.View({css:"extension",onchange:function(){var m=j.select_extension.value();var l=j.collection.models.length;if(!(m==="---")){for(i=0;i<l;i++){j.collection.models[i].attributes.row.select_extension.value(m)}}},data:j.list_extensions,container:j.$el.parents().find("#extension"),value:j.list_extensions[0]});j.$el.parents().find("#extension-info_out").on("click",function(l){j._showExtensionInfo()}).on("mousedown",function(l){l.preventDefault()})}this.modal.show();this._updateUser();this._updateScreen()},_showExtensionInfo:function(){var j=this;var k=$(this.el).parents().find("#extension-info_out");var n=j.select_extension.value();var m=this.select_extension.text();var l=_.findWhere(j.list_extensions,{id:n});if(!this.extension_popup){this.extension_popup=new d.View({placement:"bottom",container:k})}if(!this.extension_popup.visible){this.extension_popup.title(m);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(l));this.extension_popup.show()}else{this.extension_popup.hide()}},_showSettings:function(){if(!this.settings.visible){this.settings.empty();this.settings.append((new UploadSettings(this)).$el);this.settings.show()}else{this.settings.hide()}},_templateDescription:function(k){if(k.description){var j=k.description;if(k.description_url){j+=' (<a href="'+k.description_url+'" target="_blank">read more</a>)'}return j}else{return"There is no description available for this file extension."}},_eventRemove:function(k){var j=k.get("status");if(j=="success"){this.counter.success--}else{if(j=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(k.id)},_eventAnnounce:function(j,k,m){this.counter.announce++;this._updateScreen();var l=new b(this,{id:j,file_name:k.name,file_size:k.size,file_mode:k.mode,file_path:k.path});this.collection.add(l.model);$(this.el).find("tbody:first").append(l.$el);l.render()},_eventInitialize:function(o,l,u){var m=this.collection.get(o);m.set("status","running");var q=m.get("file_name");var p=m.get("file_path");var j=m.get("file_mode");var r=m.get("extension");var t=m.get("genome");var s=m.get("url_paste");var n=m.get("space_to_tabs");var k=m.get("to_posix_lines");if(!s&&!(l.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(j=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(j=="new"){tool_input["files_0|url_paste"]=s}if(j=="ftp"){tool_input["files_0|ftp_files"]=p}tool_input.dbkey=t;tool_input.file_type=r;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|space_to_tab"]=n&&"Yes"||null;tool_input["files_0|to_posix_lines"]=k&&"Yes"||null;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(k,l,j){var m=this.collection.get(k);m.set("percentage",j);this.ui_button.set("percentage",this._upload_percentage(j,l.size))},_eventSuccess:function(k,l,n){var m=this.collection.get(k);m.set("percentage",100);m.set("status","success");var j=m.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,j));this.upload_completed+=j*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(j,k,m){var l=this.collection.get(j);l.set("percentage",100);l.set("status","error");l.set("info",m);this.ui_button.set("percentage",this._upload_percentage(100,k.size));this.ui_button.set("status","danger");this.upload_completed+=k.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(j){if(j.get("status")=="queued"){j.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 j=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(k){if(k.get("status")=="init"){k.set("status","queued");j.upload_size+=k.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.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(j,k){return(this.upload_completed+(j*k))/this.upload_size},_template:function(k,j){return'<div id="uploadhead" class="uploadhead"><span class="fftext">"Set All" Types:  </span><span id="extension" class="extension"/>  <span id="extension-info_out" class="upload-icon-button fa fa-search"/></div><div id="'+k+'" 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 class="uploadfoot"><h6 id="'+j+'" class="upload-info"></h6></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,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(k){var j=this;if(k){this.options=_.defaults(k,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(l){if(l){l.preventDefault();j.show()}},onunload:function(){if(j.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var j=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(l){for(key in l){j.list_extensions.push({id:l[key].extension,text:l[key].extension,description:l[key].description,description_url:l[key].description_url})}j.list_extensions.sort(function(n,m){return n.id>m.id?1:n.id<m.id?-1:0});j.list_extensions.push({id:"---",text:"---",description:"",description_url:""});if(!j.options.datatypes_disable_auto){j.list_extensions.unshift(j.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(l){for(key in l){j.list_genomes.push({id:l[key][1],text:l[key][0]})}j.list_genomes.sort(function(n,m){return n.id>m.id?1:n.id<m.id?-1:0})}});this.collection.on("remove",function(l){j._eventRemove(l)});this.collection.on("change:genome",function(m){var l=m.get("genome");j.collection.each(function(n){if(n.get("status")=="init"&&n.get("genome")=="?"){n.set("genome",l)}})})},show:function(){var j=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){j.show()},500);return}if(!this.modal){var j=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(){j.uploadbox.select()},"Choose FTP file":function(){j._eventFtp()},"Paste/Fetch data":function(){j._eventCreate()},Start:function(){j._eventStart()},Pause:function(){j._eventStop()},Reset:function(){j._eventReset()},Close:function(){j.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var j=this;this.uploadbox=this.$el.uploadbox({announce:function(l,m,n){j._eventAnnounce(l,m,n)},initialize:function(l,m,n){return j._eventInitialize(l,m,n)},progress:function(l,m,n){j._eventProgress(l,m,n)},success:function(l,m,n){j._eventSuccess(l,m,n)},error:function(l,m,n){j._eventError(l,m,n)},complete:function(){j._eventComplete()}});var k=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:k});this.select_extension=new h.View({css:"extension",onchange:function(){var m=j.select_extension.value();var l=j.collection.models.length;if(!(m==="---")){for(i=0;i<l;i++){j.collection.models[i].attributes.row.select_extension.value(m)}}},data:j.list_extensions,container:j.$el.parents().find("#extension"),value:j.list_extensions[0]});j.$el.parents().find("#extension-info_out").on("click",function(l){j._showExtensionInfo()}).on("mousedown",function(l){l.preventDefault()})}this.modal.show();this._updateUser();this._updateScreen()},_showExtensionInfo:function(){var j=this;var k=$(this.el).parents().find("#extension-info_out");var n=j.select_extension.value();var m=this.select_extension.text();var l=_.findWhere(j.list_extensions,{id:n});if(!this.extension_popup){this.extension_popup=new d.View({placement:"bottom",container:k})}if(!this.extension_popup.visible){this.extension_popup.title(m);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(l));this.extension_popup.show()}else{this.extension_popup.hide()}},_templateDescription:function(k){if(k.description){var j=k.description;if(k.description_url){j+=' (<a href="'+k.description_url+'" target="_blank">read more</a>)'}return j}else{return"There is no description available for this file extension."}},_eventRemove:function(k){var j=k.get("status");if(j=="success"){this.counter.success--}else{if(j=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(k.id)},_eventAnnounce:function(j,k,m){this.counter.announce++;this._updateScreen();var l=new b(this,{id:j,file_name:k.name,file_size:k.size,file_mode:k.mode,file_path:k.path});this.collection.add(l.model);$(this.el).find("tbody:first").append(l.$el);l.render()},_eventInitialize:function(o,l,u){var m=this.collection.get(o);m.set("status","running");var q=m.get("file_name");var p=m.get("file_path");var j=m.get("file_mode");var r=m.get("extension");var t=m.get("genome");var s=m.get("url_paste");var n=m.get("space_to_tabs");var k=m.get("to_posix_lines");if(!s&&!(l.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(j=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(j=="new"){tool_input["files_0|url_paste"]=s}if(j=="ftp"){tool_input["files_0|ftp_files"]=p}tool_input.dbkey=t;tool_input.file_type=r;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|space_to_tab"]=n&&"Yes"||null;tool_input["files_0|to_posix_lines"]=k&&"Yes"||null;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(k,l,j){var m=this.collection.get(k);m.set("percentage",j);this.ui_button.set("percentage",this._upload_percentage(j,l.size))},_eventSuccess:function(k,l,n){var m=this.collection.get(k);m.set("percentage",100);m.set("status","success");var j=m.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,j));this.upload_completed+=j*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(j,k,m){var l=this.collection.get(j);l.set("percentage",100);l.set("status","error");l.set("info",m);this.ui_button.set("percentage",this._upload_percentage(100,k.size));this.ui_button.set("status","danger");this.upload_completed+=k.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(j){if(j.get("status")=="queued"){j.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 j=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(k){if(k.get("status")=="init"){k.set("status","queued");j.upload_size+=k.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.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(j,k){return(this.upload_completed+(j*k))/this.upload_size},_template:function(k,j){return'<div id="uploadhead" class="uploadhead"><span class="fftext">"Set All" Types:  </span><span id="extension" class="extension"/>  <span id="extension-info_out" class="upload-icon-button fa fa-search"/></div><div id="'+k+'" 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 class="uploadfoot"><h6 id="'+j+'" class="upload-info"></h6></div>'}})}); \ No newline at end of file https://bitbucket.org/galaxy/galaxy-central/commits/d8d20b31c15b/ Changeset: d8d20b31c15b User: dannon Date: 2015-01-23 19:46:08+00:00 Summary: Formatting/cleanup of upload.js's Affected #: 8 files diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 client/galaxy/scripts/mvc/upload/upload-button.js --- a/client/galaxy/scripts/mvc/upload/upload-button.js +++ b/client/galaxy/scripts/mvc/upload/upload-button.js @@ -20,24 +20,24 @@ initialize : function(model) { // link this var self = this; - + // create model this.model = model; - + // get options this.options = this.model.attributes; - + // create new element this.setElement(this._template(this.options)); - + // add event $(this.el).on('click', this.options.onclick); - + // add tooltip if (this.options.tooltip) { $(this.el).tooltip({title: this.options.tooltip, placement: 'bottom'}); } - + // events this.model.on('change:percentage', function() { self._percentage(self.model.get('percentage')); @@ -45,7 +45,7 @@ this.model.on('change:status', function() { self._status(self.model.get('status')); }); - + // unload event var self = this; $(window).on('beforeunload', function() { @@ -58,7 +58,7 @@ } }); }, - + // set status _status: function(value) { var $el = this.$el.find('.progress-bar'); @@ -69,13 +69,13 @@ $el.addClass('progress-bar-' + value); } }, - + // set percentage _percentage: function(value) { var $el = this.$el.find('.progress-bar'); $el.css({ width : value + '%' }); }, - + // template _template: function(options) { return '<div style="float: right">' + diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 client/galaxy/scripts/mvc/upload/upload-ftp.js --- a/client/galaxy/scripts/mvc/upload/upload-ftp.js +++ b/client/galaxy/scripts/mvc/upload/upload-ftp.js @@ -8,18 +8,18 @@ class_add : 'upload-icon-button fa fa-square-o', class_remove : 'upload-icon-button fa fa-check-square-o' }, - + // render initialize: function(app) { // link app this.app = app; - + // link this var self = this; - + // set template this.setElement(this._template()); - + // load extension Utils.get({ url : galaxy_config.root + 'api/ftp_files', @@ -27,26 +27,26 @@ error : function() { self._fill(); } }); }, - + // events events: { 'mousedown' : function(e) { e.preventDefault(); } }, - + // fill table _fill: function(ftp_files) { var self = this; if (ftp_files && ftp_files.length > 0) { // add table this.$el.find('#upload-ftp-content').html($(this._templateTable())); - + // add files to table var size = 0; for (key in ftp_files) { this.add(ftp_files[key]); size += ftp_files[key].size; } - + // update stats this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files'); this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true)); @@ -90,21 +90,21 @@ // hide spinner this.$el.find('#upload-ftp-wait').hide(); }, - + // add add: function(ftp_file) { // link this var self = this; - + // create new item var $it = $(this._templateRow(ftp_file)); - + // identify icon var $icon = $it.find('.icon'); - + // append to table $(this.el).find('tbody').append($it); - + // find model and set initial 'add' icon class var icon_class = ''; if (this._find(ftp_file)) { @@ -115,7 +115,7 @@ // add icon class $icon.addClass(icon_class); - + // add files to the uploadbox $it.on('updateUpBox', function() { // find model @@ -195,7 +195,7 @@ } return model_index; }, - + // template row _templateRow: function(options) { return '<tr class="upload-ftp-row" style="cursor: pointer;">' + @@ -205,7 +205,7 @@ '<td style="white-space: nowrap;">' + options.ctime + '</td>' + '</tr>'; }, - + // load table template _templateTable: function() { return '<span style="whitespace: nowrap; float: left;">Available files: </span>' + @@ -227,14 +227,14 @@ '<tbody></tbody>' + '</table>'; }, - + // load table template _templateInfo: function() { return '<div class="upload-ftp-warning warningmessage">' + 'Your FTP directory does not contain any files.' + '</div>'; }, - + // load html template _template: function() { return '<div class="upload-ftp">' + @@ -243,7 +243,7 @@ '<div id="upload-ftp-content"></div>' + '<div>'; } - + }); }); diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 client/galaxy/scripts/mvc/upload/upload-model.js --- a/client/galaxy/scripts/mvc/upload/upload-model.js +++ b/client/galaxy/scripts/mvc/upload/upload-model.js @@ -15,7 +15,6 @@ file_path : '', percentage : 0, row : null, - // settings space_to_tabs : false, to_posix_lines : true diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 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 @@ -8,7 +8,7 @@ "mvc/ui/ui-modal", "mvc/ui/ui-select", "utils/uploadbox"], - + function( Utils, UploadButton, UploadModel, @@ -25,44 +25,44 @@ options : { nginx_upload_path : '' }, - + // own modal modal : null, - + // button ui_button : null, - + // jquery uploadbox plugin uploadbox: null, - + // current history current_history: null, // extension selector select_extension : null, - + // current upload size upload_size: 0, - + // extension types list_extensions :[], - + // genomes list_genomes : [], - + // datatype placeholder for auto-detection 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 collection : new UploadModel.Collection(), - + // ftp file viewer ftp : null, - + // counter counter : { // stats @@ -70,13 +70,13 @@ success : 0, error : 0, running : 0, - + // reset stats reset : function() { this.announce = this.success = this.error = this.running = 0; } }, - + // initialize initialize : function(options) { // link this @@ -86,7 +86,7 @@ if (options) { this.options = _.defaults(options, this.options); } - + // create model this.ui_button = new UploadButton.Model({ icon : 'fa-upload', @@ -96,7 +96,7 @@ if (e) { // prevent default e.preventDefault(); - + // show self.show() } @@ -107,10 +107,10 @@ } } }); - + // define location $('.with-upload-button').append((new UploadButton.View(this.ui_button)).$el); - + // load extension var self = this; Utils.get({ @@ -137,14 +137,14 @@ description : "", description_url : "" }); - + // add auto field if (!self.options.datatypes_disable_auto) { self.list_extensions.unshift(self.auto); } } }); - + // load genomes Utils.get({ url : galaxy_config.root + "api/genomes", @@ -155,14 +155,14 @@ text : genomes[key][0] }); } - + // sort self.list_genomes.sort(function(a, b) { return a.id > b.id ? 1 : a.id < b.id ? -1 : 0; }); } }); - + // events this.collection.on('remove', function(item) { self._eventRemove(item); @@ -176,11 +176,11 @@ }); }); }, - + // // event triggered by upload button // - + // show/hide upload frame show: function () { // wait for galaxy history panel @@ -189,7 +189,7 @@ window.setTimeout(function() { self.show() }, 500) return; } - + // create modal if (!this.modal) { // make modal @@ -210,10 +210,10 @@ width : '900', closing_events : true }); - + // set element this.setElement('#upload-box'); - + // file upload var self = this; this.uploadbox = this.$el.uploadbox({ @@ -224,7 +224,7 @@ error : function(index, file, message) { self._eventError(index, file, message) }, complete : function() { self._eventComplete() } }); - + // add ftp file viewer var button = this.modal.getButton('Choose FTP file'); this.ftp = new Popover.View({ @@ -238,7 +238,7 @@ onchange : function() { var newExten = self.select_extension.value() var len = self.collection.models.length; - // Only trigger changing the rows if the "set all" isn't set to '---' + // Only trigger changing the rows if the "set all" isn't set to '---' // Prevents recursively changing the rows after an individual row has been changed if(!(newExten === '---')){ for(i = 0; i < len; i++){ @@ -255,13 +255,13 @@ self.$el.parents().find('#extension-info_out').on('click' , function(e) { self._showExtensionInfo(); }) .on('mousedown', function(e) { e.preventDefault(); }); } - + // show modal this.modal.show(); - + // refresh this._updateUser(); - + // setup info this._updateScreen(); }, @@ -271,7 +271,7 @@ var self = this; var $el = $(this.el).parents().find('#extension-info_out'); var extension = self.select_extension.value(); - + var title = this.select_extension.text(); var description = _.findWhere(self.list_extensions, {'id': extension}); @@ -310,12 +310,12 @@ // // events triggered by collection // - + // remove item from upload list _eventRemove : function(item) { // update status var status = item.get('status'); - + // reduce counter if (status == 'success') { this.counter.success--; @@ -324,26 +324,26 @@ } else { this.counter.announce--; } - + // show on screen info this._updateScreen(); - + // remove from queue this.uploadbox.remove(item.id); }, - + // // events triggered by the upload box plugin // - + // a new file has been dropped/selected through the uploadbox plugin _eventAnnounce : function(index, file, message) { // update counter this.counter.announce++; - + // update screen this._updateScreen(); - + // create view/model var upload_item = new UploadItem(this, { id : index, @@ -352,25 +352,25 @@ file_mode : file.mode, file_path : file.path }); - + // add to collection this.collection.add(upload_item.model); - + // add upload item element to table $(this.el).find('tbody:first').append(upload_item.$el); - + // render upload_item.render(); }, - + // the uploadbox plugin is initializing the upload for this file _eventInitialize : function(index, file, message) { // get element var it = this.collection.get(index); - + // update status it.set('status', 'running'); - + // get configuration var file_name = it.get('file_name'); var file_path = it.get('file_path'); @@ -380,113 +380,113 @@ var url_paste = it.get('url_paste'); var space_to_tabs = it.get('space_to_tabs'); var to_posix_lines = it.get('to_posix_lines'); - + // validate if (!url_paste && !(file.size > 0)) return null; - + // configure uploadbox this.uploadbox.configure({url : this.options.nginx_upload_path}); - + // local files if (file_mode == 'local') { this.uploadbox.configure({paramname : 'files_0|file_data'}); } else { this.uploadbox.configure({paramname : null}); } - + // configure tool tool_input = {}; - + // new files if (file_mode == 'new') { tool_input['files_0|url_paste'] = url_paste; } - + // files from ftp if (file_mode == 'ftp') { tool_input['files_0|ftp_files'] = file_path; } - + // add common configuration tool_input['dbkey'] = genome; tool_input['file_type'] = extension; tool_input['files_0|type'] = 'upload_dataset'; tool_input['files_0|space_to_tab'] = space_to_tabs && 'Yes' || null; tool_input['files_0|to_posix_lines'] = to_posix_lines && 'Yes' || null; - + // setup data data = {}; data['history_id'] = this.current_history; data['tool_id'] = 'upload1'; data['inputs'] = JSON.stringify(tool_input); - + // return additional data to be send with file return data; }, - + // progress _eventProgress : function(index, file, percentage) { // set progress for row var it = this.collection.get(index); it.set('percentage', percentage); - + // update ui button this.ui_button.set('percentage', this._upload_percentage(percentage, file.size)); }, - + // success _eventSuccess : function(index, file, message) { // update status var it = this.collection.get(index); it.set('percentage', 100); it.set('status', 'success'); - + // file size var file_size = it.get('file_size'); - + // update ui button this.ui_button.set('percentage', this._upload_percentage(100, file_size)); - + // update completed this.upload_completed += file_size * 100; - + // update counter this.counter.announce--; this.counter.success++; - + // update on screen info this._updateScreen(); - + // update galaxy history Galaxy.currHistoryPanel.refreshContents(); }, - + // error _eventError : function(index, file, message) { // get element var it = this.collection.get(index); - + // update status it.set('percentage', 100); it.set('status', 'error'); it.set('info', message); - + // update ui button this.ui_button.set('percentage', this._upload_percentage(100, file.size)); this.ui_button.set('status', 'danger'); - + // update completed this.upload_completed += file.size * 100; - + // update counter this.counter.announce--; this.counter.error++; - + // update on screen info this._updateScreen(); }, - + // queue is done _eventComplete: function() { // reset queued upload to initial status @@ -495,16 +495,16 @@ item.set('status', 'init'); } }); - + // update running this.counter.running = 0; this._updateScreen(); }, - + // // events triggered by this view // - + _eventFtp: function() { // check if popover is visible if (!this.ftp.visible) { @@ -533,7 +533,7 @@ if (this.counter.announce == 0 || this.counter.running > 0) { return; } - + // reset current size var self = this; this.upload_size = 0; @@ -545,19 +545,19 @@ self.upload_size += item.get('file_size'); } }); - + // reset progress this.ui_button.set('percentage', 0); this.ui_button.set('status', 'success'); - + // update running this.counter.running = this.counter.announce; this._updateScreen(); - + // initiate upload procedure in plugin this.uploadbox.start(); }, - + // pause upload process _eventStop : function() { // check @@ -570,35 +570,35 @@ // request pause this.uploadbox.stop(); - + // set html content $('#upload-info').html('Queue will pause after completing the current file...'); }, - + // remove all _eventReset : function() { // make sure queue is not running if (this.counter.running == 0){ // reset collection this.collection.reset(); - + // reset counter this.counter.reset(); - + // show on screen info this._updateScreen(); - + // remove from queue this.uploadbox.reset(); // reset value for universal type drop-down this.select_extension.value(this.list_extensions[0]); - + // reset button this.ui_button.set('percentage', 0); } }, - + // update uset _updateUser: function() { // backup current history @@ -608,13 +608,13 @@ this.current_history = Galaxy.currHistoryPanel.model.get('id'); } }, - + // set screen _updateScreen: function () { /* update on screen info */ - + // check default message if(this.counter.announce == 0){ if (this.uploadbox.compatible()) @@ -627,20 +627,20 @@ else message = 'Please wait...' + this.counter.announce + ' out of ' + this.counter.running + ' remaining.'; } - + // set html content $('#upload-info').html(message); - + /* update button status */ - + // update reset button if (this.counter.running == 0 && this.counter.announce + this.counter.success + this.counter.error > 0) this.modal.enableButton('Reset'); else this.modal.disableButton('Reset'); - + // update upload button if (this.counter.running == 0 && this.counter.announce > 0) this.modal.enableButton('Start'); @@ -652,7 +652,7 @@ this.modal.enableButton('Pause'); else this.modal.disableButton('Pause'); - + // select upload button if (this.counter.running == 0){ this.modal.enableButton('Choose local file'); @@ -663,14 +663,14 @@ this.modal.disableButton('Choose FTP file'); this.modal.disableButton('Paste/Fetch data'); } - + // ftp button 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'); } - + // table visibility if (this.counter.announce + this.counter.success + this.counter.error > 0) { $(this.el).find('#upload-table').show(); diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 static/scripts/mvc/upload/upload-button.js --- a/static/scripts/mvc/upload/upload-button.js +++ b/static/scripts/mvc/upload/upload-button.js @@ -20,24 +20,24 @@ initialize : function(model) { // link this var self = this; - + // create model this.model = model; - + // get options this.options = this.model.attributes; - + // create new element this.setElement(this._template(this.options)); - + // add event $(this.el).on('click', this.options.onclick); - + // add tooltip if (this.options.tooltip) { $(this.el).tooltip({title: this.options.tooltip, placement: 'bottom'}); } - + // events this.model.on('change:percentage', function() { self._percentage(self.model.get('percentage')); @@ -45,7 +45,7 @@ this.model.on('change:status', function() { self._status(self.model.get('status')); }); - + // unload event var self = this; $(window).on('beforeunload', function() { @@ -58,7 +58,7 @@ } }); }, - + // set status _status: function(value) { var $el = this.$el.find('.progress-bar'); @@ -69,13 +69,13 @@ $el.addClass('progress-bar-' + value); } }, - + // set percentage _percentage: function(value) { var $el = this.$el.find('.progress-bar'); $el.css({ width : value + '%' }); }, - + // template _template: function(options) { return '<div style="float: right">' + diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -8,18 +8,18 @@ class_add : 'upload-icon-button fa fa-square-o', class_remove : 'upload-icon-button fa fa-check-square-o' }, - + // render initialize: function(app) { // link app this.app = app; - + // link this var self = this; - + // set template this.setElement(this._template()); - + // load extension Utils.get({ url : galaxy_config.root + 'api/ftp_files', @@ -27,26 +27,26 @@ error : function() { self._fill(); } }); }, - + // events events: { 'mousedown' : function(e) { e.preventDefault(); } }, - + // fill table _fill: function(ftp_files) { var self = this; if (ftp_files && ftp_files.length > 0) { // add table this.$el.find('#upload-ftp-content').html($(this._templateTable())); - + // add files to table var size = 0; for (key in ftp_files) { this.add(ftp_files[key]); size += ftp_files[key].size; } - + // update stats this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files'); this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true)); @@ -90,21 +90,21 @@ // hide spinner this.$el.find('#upload-ftp-wait').hide(); }, - + // add add: function(ftp_file) { // link this var self = this; - + // create new item var $it = $(this._templateRow(ftp_file)); - + // identify icon var $icon = $it.find('.icon'); - + // append to table $(this.el).find('tbody').append($it); - + // find model and set initial 'add' icon class var icon_class = ''; if (this._find(ftp_file)) { @@ -115,7 +115,7 @@ // add icon class $icon.addClass(icon_class); - + // add files to the uploadbox $it.on('updateUpBox', function() { // find model @@ -195,7 +195,7 @@ } return model_index; }, - + // template row _templateRow: function(options) { return '<tr class="upload-ftp-row" style="cursor: pointer;">' + @@ -205,7 +205,7 @@ '<td style="white-space: nowrap;">' + options.ctime + '</td>' + '</tr>'; }, - + // load table template _templateTable: function() { return '<span style="whitespace: nowrap; float: left;">Available files: </span>' + @@ -227,14 +227,14 @@ '<tbody></tbody>' + '</table>'; }, - + // load table template _templateInfo: function() { return '<div class="upload-ftp-warning warningmessage">' + 'Your FTP directory does not contain any files.' + '</div>'; }, - + // load html template _template: function() { return '<div class="upload-ftp">' + @@ -243,7 +243,7 @@ '<div id="upload-ftp-content"></div>' + '<div>'; } - + }); }); diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 static/scripts/mvc/upload/upload-model.js --- a/static/scripts/mvc/upload/upload-model.js +++ b/static/scripts/mvc/upload/upload-model.js @@ -15,7 +15,6 @@ file_path : '', percentage : 0, row : null, - // settings space_to_tabs : false, to_posix_lines : true diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 static/scripts/mvc/upload/upload-view.js --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -8,7 +8,7 @@ "mvc/ui/ui-modal", "mvc/ui/ui-select", "utils/uploadbox"], - + function( Utils, UploadButton, UploadModel, @@ -25,44 +25,44 @@ options : { nginx_upload_path : '' }, - + // own modal modal : null, - + // button ui_button : null, - + // jquery uploadbox plugin uploadbox: null, - + // current history current_history: null, // extension selector select_extension : null, - + // current upload size upload_size: 0, - + // extension types list_extensions :[], - + // genomes list_genomes : [], - + // datatype placeholder for auto-detection 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 collection : new UploadModel.Collection(), - + // ftp file viewer ftp : null, - + // counter counter : { // stats @@ -70,13 +70,13 @@ success : 0, error : 0, running : 0, - + // reset stats reset : function() { this.announce = this.success = this.error = this.running = 0; } }, - + // initialize initialize : function(options) { // link this @@ -86,7 +86,7 @@ if (options) { this.options = _.defaults(options, this.options); } - + // create model this.ui_button = new UploadButton.Model({ icon : 'fa-upload', @@ -96,7 +96,7 @@ if (e) { // prevent default e.preventDefault(); - + // show self.show() } @@ -107,10 +107,10 @@ } } }); - + // define location $('.with-upload-button').append((new UploadButton.View(this.ui_button)).$el); - + // load extension var self = this; Utils.get({ @@ -137,14 +137,14 @@ description : "", description_url : "" }); - + // add auto field if (!self.options.datatypes_disable_auto) { self.list_extensions.unshift(self.auto); } } }); - + // load genomes Utils.get({ url : galaxy_config.root + "api/genomes", @@ -155,14 +155,14 @@ text : genomes[key][0] }); } - + // sort self.list_genomes.sort(function(a, b) { return a.id > b.id ? 1 : a.id < b.id ? -1 : 0; }); } }); - + // events this.collection.on('remove', function(item) { self._eventRemove(item); @@ -176,11 +176,11 @@ }); }); }, - + // // event triggered by upload button // - + // show/hide upload frame show: function () { // wait for galaxy history panel @@ -189,7 +189,7 @@ window.setTimeout(function() { self.show() }, 500) return; } - + // create modal if (!this.modal) { // make modal @@ -210,10 +210,10 @@ width : '900', closing_events : true }); - + // set element this.setElement('#upload-box'); - + // file upload var self = this; this.uploadbox = this.$el.uploadbox({ @@ -224,7 +224,7 @@ error : function(index, file, message) { self._eventError(index, file, message) }, complete : function() { self._eventComplete() } }); - + // add ftp file viewer var button = this.modal.getButton('Choose FTP file'); this.ftp = new Popover.View({ @@ -238,7 +238,7 @@ onchange : function() { var newExten = self.select_extension.value() var len = self.collection.models.length; - // Only trigger changing the rows if the "set all" isn't set to '---' + // Only trigger changing the rows if the "set all" isn't set to '---' // Prevents recursively changing the rows after an individual row has been changed if(!(newExten === '---')){ for(i = 0; i < len; i++){ @@ -255,13 +255,13 @@ self.$el.parents().find('#extension-info_out').on('click' , function(e) { self._showExtensionInfo(); }) .on('mousedown', function(e) { e.preventDefault(); }); } - + // show modal this.modal.show(); - + // refresh this._updateUser(); - + // setup info this._updateScreen(); }, @@ -271,7 +271,7 @@ var self = this; var $el = $(this.el).parents().find('#extension-info_out'); var extension = self.select_extension.value(); - + var title = this.select_extension.text(); var description = _.findWhere(self.list_extensions, {'id': extension}); @@ -310,12 +310,12 @@ // // events triggered by collection // - + // remove item from upload list _eventRemove : function(item) { // update status var status = item.get('status'); - + // reduce counter if (status == 'success') { this.counter.success--; @@ -324,26 +324,26 @@ } else { this.counter.announce--; } - + // show on screen info this._updateScreen(); - + // remove from queue this.uploadbox.remove(item.id); }, - + // // events triggered by the upload box plugin // - + // a new file has been dropped/selected through the uploadbox plugin _eventAnnounce : function(index, file, message) { // update counter this.counter.announce++; - + // update screen this._updateScreen(); - + // create view/model var upload_item = new UploadItem(this, { id : index, @@ -352,25 +352,25 @@ file_mode : file.mode, file_path : file.path }); - + // add to collection this.collection.add(upload_item.model); - + // add upload item element to table $(this.el).find('tbody:first').append(upload_item.$el); - + // render upload_item.render(); }, - + // the uploadbox plugin is initializing the upload for this file _eventInitialize : function(index, file, message) { // get element var it = this.collection.get(index); - + // update status it.set('status', 'running'); - + // get configuration var file_name = it.get('file_name'); var file_path = it.get('file_path'); @@ -380,113 +380,113 @@ var url_paste = it.get('url_paste'); var space_to_tabs = it.get('space_to_tabs'); var to_posix_lines = it.get('to_posix_lines'); - + // validate if (!url_paste && !(file.size > 0)) return null; - + // configure uploadbox this.uploadbox.configure({url : this.options.nginx_upload_path}); - + // local files if (file_mode == 'local') { this.uploadbox.configure({paramname : 'files_0|file_data'}); } else { this.uploadbox.configure({paramname : null}); } - + // configure tool tool_input = {}; - + // new files if (file_mode == 'new') { tool_input['files_0|url_paste'] = url_paste; } - + // files from ftp if (file_mode == 'ftp') { tool_input['files_0|ftp_files'] = file_path; } - + // add common configuration tool_input['dbkey'] = genome; tool_input['file_type'] = extension; tool_input['files_0|type'] = 'upload_dataset'; tool_input['files_0|space_to_tab'] = space_to_tabs && 'Yes' || null; tool_input['files_0|to_posix_lines'] = to_posix_lines && 'Yes' || null; - + // setup data data = {}; data['history_id'] = this.current_history; data['tool_id'] = 'upload1'; data['inputs'] = JSON.stringify(tool_input); - + // return additional data to be send with file return data; }, - + // progress _eventProgress : function(index, file, percentage) { // set progress for row var it = this.collection.get(index); it.set('percentage', percentage); - + // update ui button this.ui_button.set('percentage', this._upload_percentage(percentage, file.size)); }, - + // success _eventSuccess : function(index, file, message) { // update status var it = this.collection.get(index); it.set('percentage', 100); it.set('status', 'success'); - + // file size var file_size = it.get('file_size'); - + // update ui button this.ui_button.set('percentage', this._upload_percentage(100, file_size)); - + // update completed this.upload_completed += file_size * 100; - + // update counter this.counter.announce--; this.counter.success++; - + // update on screen info this._updateScreen(); - + // update galaxy history Galaxy.currHistoryPanel.refreshContents(); }, - + // error _eventError : function(index, file, message) { // get element var it = this.collection.get(index); - + // update status it.set('percentage', 100); it.set('status', 'error'); it.set('info', message); - + // update ui button this.ui_button.set('percentage', this._upload_percentage(100, file.size)); this.ui_button.set('status', 'danger'); - + // update completed this.upload_completed += file.size * 100; - + // update counter this.counter.announce--; this.counter.error++; - + // update on screen info this._updateScreen(); }, - + // queue is done _eventComplete: function() { // reset queued upload to initial status @@ -495,16 +495,16 @@ item.set('status', 'init'); } }); - + // update running this.counter.running = 0; this._updateScreen(); }, - + // // events triggered by this view // - + _eventFtp: function() { // check if popover is visible if (!this.ftp.visible) { @@ -533,7 +533,7 @@ if (this.counter.announce == 0 || this.counter.running > 0) { return; } - + // reset current size var self = this; this.upload_size = 0; @@ -545,19 +545,19 @@ self.upload_size += item.get('file_size'); } }); - + // reset progress this.ui_button.set('percentage', 0); this.ui_button.set('status', 'success'); - + // update running this.counter.running = this.counter.announce; this._updateScreen(); - + // initiate upload procedure in plugin this.uploadbox.start(); }, - + // pause upload process _eventStop : function() { // check @@ -570,35 +570,35 @@ // request pause this.uploadbox.stop(); - + // set html content $('#upload-info').html('Queue will pause after completing the current file...'); }, - + // remove all _eventReset : function() { // make sure queue is not running if (this.counter.running == 0){ // reset collection this.collection.reset(); - + // reset counter this.counter.reset(); - + // show on screen info this._updateScreen(); - + // remove from queue this.uploadbox.reset(); // reset value for universal type drop-down this.select_extension.value(this.list_extensions[0]); - + // reset button this.ui_button.set('percentage', 0); } }, - + // update uset _updateUser: function() { // backup current history @@ -608,13 +608,13 @@ this.current_history = Galaxy.currHistoryPanel.model.get('id'); } }, - + // set screen _updateScreen: function () { /* update on screen info */ - + // check default message if(this.counter.announce == 0){ if (this.uploadbox.compatible()) @@ -627,20 +627,20 @@ else message = 'Please wait...' + this.counter.announce + ' out of ' + this.counter.running + ' remaining.'; } - + // set html content $('#upload-info').html(message); - + /* update button status */ - + // update reset button if (this.counter.running == 0 && this.counter.announce + this.counter.success + this.counter.error > 0) this.modal.enableButton('Reset'); else this.modal.disableButton('Reset'); - + // update upload button if (this.counter.running == 0 && this.counter.announce > 0) this.modal.enableButton('Start'); @@ -652,7 +652,7 @@ this.modal.enableButton('Pause'); else this.modal.disableButton('Pause'); - + // select upload button if (this.counter.running == 0){ this.modal.enableButton('Choose local file'); @@ -663,14 +663,14 @@ this.modal.disableButton('Choose FTP file'); this.modal.disableButton('Paste/Fetch data'); } - + // ftp button 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'); } - + // table visibility if (this.counter.announce + this.counter.success + this.counter.error > 0) { $(this.el).find('#upload-table').show(); 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