mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
[WIP] Fix button states
This commit is contained in:
@@ -136,6 +136,18 @@ var Button = Backbone.View.extend({
|
||||
$(this.el).tooltip({title: options.tooltip, placement: 'bottom'});
|
||||
},
|
||||
|
||||
// disable
|
||||
disable: function() {
|
||||
this.$el.addClass('disabled');
|
||||
this.disabled = true;
|
||||
},
|
||||
|
||||
// enable
|
||||
enable: function() {
|
||||
this.$el.removeClass('disabled');
|
||||
this.disabled = false;
|
||||
},
|
||||
|
||||
// show spinner
|
||||
wait: function() {
|
||||
this.$el.removeClass(this.options.cls).addClass('btn btn-info').prop('disabled', true);
|
||||
|
||||
@@ -82,7 +82,7 @@ return Backbone.View.extend({
|
||||
|
||||
// file upload
|
||||
var self = this;
|
||||
this.uploadbox = this.$el.uploadbox({
|
||||
this.uploadbox = this.$('#upload-box').uploadbox({
|
||||
announce : function(index, file, message) { self._eventAnnounce(index, file, message) },
|
||||
initialize : function(index, file, message) { return self._eventInitialize(index, file, message) },
|
||||
progress : function(index, file, message) { self._eventProgress(index, file, message) },
|
||||
@@ -248,7 +248,7 @@ return Backbone.View.extend({
|
||||
|
||||
// setup data
|
||||
data = {};
|
||||
data['history_id'] = this.current_history;
|
||||
data['history_id'] = this.app.current_history;
|
||||
data['tool_id'] = 'upload1';
|
||||
data['inputs'] = JSON.stringify(tool_input);
|
||||
|
||||
@@ -501,41 +501,44 @@ return Backbone.View.extend({
|
||||
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 reset button
|
||||
if (this.counter.running == 0 && this.counter.announce + this.counter.success + this.counter.error > 0) {
|
||||
this.btnReset.enable();
|
||||
} else {
|
||||
this.btnReset.disable();
|
||||
}
|
||||
|
||||
// update upload button
|
||||
if (this.counter.running == 0 && this.counter.announce > 0)
|
||||
this.modal.enableButton('Start');
|
||||
else
|
||||
this.modal.disableButton('Start');
|
||||
if (this.counter.running == 0 && this.counter.announce > 0) {
|
||||
this.btnStart.enable();
|
||||
} else {
|
||||
this.btnStart.disable();
|
||||
}
|
||||
|
||||
// pause upload button
|
||||
if (this.counter.running > 0)
|
||||
this.modal.enableButton('Pause');
|
||||
else
|
||||
this.modal.disableButton('Pause');
|
||||
if (this.counter.running > 0) {
|
||||
this.btnStop.enable();
|
||||
} else {
|
||||
this.btnStop.disable();
|
||||
}
|
||||
|
||||
// select upload button
|
||||
if (this.counter.running == 0){
|
||||
this.modal.enableButton('Choose local file');
|
||||
this.modal.enableButton('Choose FTP file');
|
||||
this.modal.enableButton('Paste/Fetch data');
|
||||
if (this.counter.running == 0) {
|
||||
this.btnLocal.enable();
|
||||
this.btnFtp.enable();
|
||||
this.btnCreate.enable();
|
||||
} else {
|
||||
this.modal.disableButton('Choose local file');
|
||||
this.modal.disableButton('Choose FTP file');
|
||||
this.modal.disableButton('Paste/Fetch data');
|
||||
this.btnLocal.disable();
|
||||
this.btnFtp.disable();
|
||||
this.btnCreate.disable();
|
||||
}
|
||||
|
||||
// ftp button
|
||||
if (this.current_user && this.options.ftp_upload_dir && this.options.ftp_upload_site) {
|
||||
this.modal.showButton('Choose FTP file');
|
||||
if (this.app.current_user && this.options.ftp_upload_dir && this.options.ftp_upload_site) {
|
||||
this.btnFtp.$el.show();
|
||||
} else {
|
||||
this.modal.hideButton('Choose FTP file');
|
||||
}*/
|
||||
this.btnFtp.$el.hide();
|
||||
}
|
||||
|
||||
// table visibility
|
||||
if (this.counter.announce + this.counter.success + this.counter.error > 0) {
|
||||
|
||||
@@ -128,6 +128,9 @@ return Backbone.View.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
// refresh
|
||||
this.refresh();
|
||||
|
||||
// create modal
|
||||
if (!this.modal) {
|
||||
// build tabs
|
||||
@@ -149,9 +152,6 @@ return Backbone.View.extend({
|
||||
width : this.options.width,
|
||||
closing_events : true
|
||||
});
|
||||
|
||||
// refresh
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
// show modal
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{"version":3,"file":"upload-view.js","sources":["../../../src/mvc/upload/upload-view.js"],"names":["define","Utils","Modal","Tabs","UploadButton","UploadViewDefault","Backbone","View","extend","options","nginx_upload_path","ftp_upload_site","default_genome","default_extension","height","width","auto","id","text","description","modal","ui_button","current_history","list_extensions","list_genomes","initialize","self","this","merge","Model","ui_button_view","model","onclick","e","preventDefault","show","onunload","$","append","$el","get","url","galaxy_config","root","success","datatypes","key","push","extension","description_url","sort","a","b","datatypes_disable_auto","unshift","genomes","Galaxy","currHistoryPanel","tabs","default_view","add","title","body","closing_events","refresh","window","setTimeout","current_user","currUser"],"mappings":"AACAA,QAAQ,cACA,kBACA,iBACA,2BACA,kCACA,SAAYC,EACAC,EACAC,EACAC,EACAC,GACpB,MAAOC,UAASC,KAAKC,QAEjBC,SACIC,kBAAsB,GACtBC,gBAAsB,MACtBC,eAAsB,IACtBC,kBAAsB,OACtBC,OAAsB,IACtBC,MAAsB,IACtBC,MACIC,GAAc,OACdC,KAAc,cACdC,YAAc,wZAKtBC,MAAO,KAGPC,UAAW,KAGXC,gBAAiB,KAGjBC,mBAGAC,gBAGAC,WAAY,SAAShB,GAEjB,GAAIiB,GAAOC,IAGXA,MAAKlB,QAAUR,EAAM2B,MAAMnB,EAASkB,KAAKlB,SAGzCkB,KAAKN,UAAY,GAAIjB,GAAayB,MAGlCF,KAAKG,eAAiB,GAAI1B,GAAaG,MACnCwB,MAAcJ,KAAKN,UACnBW,QAAc,SAASC,GACnBA,EAAEC,iBACFR,EAAKS,QAETC,SAAc,eAQlBC,EAAE,uBAAuBC,OAAOX,KAAKG,eAAeS,IAGpD,IAAIb,GAAOC,IACX1B,GAAMuC,KACFC,IAAUC,cAAcC,KAAO,qCAC/BC,QAAU,SAASC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C,eAITrC,MAAKP,MAAMe,YA/BP8B,QAAOC,WAAW,WAAaxC,EAAKS,QAAU,MAmCtD6B,QAAS,WACLrC,KAAKwC,aAAeX,OAAOY,SAAS5B,IAAI,MACxCb,KAAKL,gBAAkB,KACnBK,KAAKwC,eACLxC,KAAKL,gBAAkBkC,OAAOC,iBAAiB1B,MAAMS,IAAI"}
|
||||
{"version":3,"file":"upload-view.js","sources":["../../../src/mvc/upload/upload-view.js"],"names":["define","Utils","Modal","Tabs","UploadButton","UploadViewDefault","Backbone","View","extend","options","nginx_upload_path","ftp_upload_site","default_genome","default_extension","height","width","auto","id","text","description","modal","ui_button","current_history","list_extensions","list_genomes","initialize","self","this","merge","Model","ui_button_view","model","onclick","e","preventDefault","show","onunload","$","append","$el","get","url","galaxy_config","root","success","datatypes","key","push","extension","description_url","sort","a","b","datatypes_disable_auto","unshift","genomes","Galaxy","currHistoryPanel","refresh","tabs","default_view","add","title","body","closing_events","window","setTimeout","current_user","currUser"],"mappings":"AACAA,QAAQ,cACA,kBACA,iBACA,2BACA,kCACA,SAAYC,EACAC,EACAC,EACAC,EACAC,GACpB,MAAOC,UAASC,KAAKC,QAEjBC,SACIC,kBAAsB,GACtBC,gBAAsB,MACtBC,eAAsB,IACtBC,kBAAsB,OACtBC,OAAsB,IACtBC,MAAsB,IACtBC,MACIC,GAAc,OACdC,KAAc,cACdC,YAAc,wZAKtBC,MAAO,KAGPC,UAAW,KAGXC,gBAAiB,KAGjBC,mBAGAC,gBAGAC,WAAY,SAAShB,GAEjB,GAAIiB,GAAOC,IAGXA,MAAKlB,QAAUR,EAAM2B,MAAMnB,EAASkB,KAAKlB,SAGzCkB,KAAKN,UAAY,GAAIjB,GAAayB,MAGlCF,KAAKG,eAAiB,GAAI1B,GAAaG,MACnCwB,MAAcJ,KAAKN,UACnBW,QAAc,SAASC,GACnBA,EAAEC,iBACFR,EAAKS,QAETC,SAAc,eAQlBC,EAAE,uBAAuBC,OAAOX,KAAKG,eAAeS,IAGpD,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5BzB,OAAkBa,KAAKlB,QAAQK,OAC/BC,MAAkBY,KAAKlB,QAAQM,MAC/BiD,gBAAkB,SAK1BrC,MAAKP,MAAMe,YA/BP8B,QAAOC,WAAW,WAAaxC,EAAKS,QAAU,MAmCtDuB,QAAS,WACL/B,KAAKwC,aAAeX,OAAOY,SAAS5B,IAAI,MACxCb,KAAKL,gBAAkB,KACnBK,KAAKwC,eACLxC,KAAKL,gBAAkBkC,OAAOC,iBAAiB1B,MAAMS,IAAI"}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
define(["utils/utils","mvc/ui/ui-modal","mvc/ui/ui-tabs","mvc/upload/upload-button","mvc/upload/upload-view-default"],function(a,b,c,d,e){return Backbone.View.extend({options:{nginx_upload_path:"",ftp_upload_site:"n/a",default_genome:"?",default_extension:"auto",height:400,width:900,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."}},modal:null,ui_button:null,current_history:null,list_extensions:[],list_genomes:[],initialize:function(b){var c=this;this.options=a.merge(b,this.options),this.ui_button=new d.Model,this.ui_button_view=new d.View({model:this.ui_button,onclick:function(a){a.preventDefault(),c.show()},onunload:function(){}}),$(".with-upload-button").append(this.ui_button_view.$el);var c=this;a.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(a){for(key in a)c.list_extensions.push({id:a[key].extension,text:a[key].extension,description:a[key].description,description_url:a[key].description_url});c.list_extensions.sort(function(a,b){return a.text>b.text?1:a.text<b.text?-1:0}),c.options.datatypes_disable_auto||c.list_extensions.unshift(c.options.auto)}}),a.get({url:galaxy_config.root+"api/genomes",success:function(a){for(key in a)c.list_genomes.push({id:a[key][1],text:a[key][0]});c.list_genomes.sort(function(a,b){return a.id==c.options.default_genome?-1:b.id==c.options.default_genome?1:a.text>b.text?1:a.text<b.text?-1:0})}})},show:function(){var a=this;return Galaxy.currHistoryPanel&&Galaxy.currHistoryPanel.model?(this.modal||(this.tabs=new c.View,this.default_view=new e(this),this.tabs.add({id:"default",title:"Default",$el:this.default_view.$el}),this.modal=new b.View({title:"Download data directly from web or upload files from your disk",body:this.tabs.$el,height:this.options.height,width:this.options.width,closing_events:!0}),this.refresh()),void this.modal.show()):void window.setTimeout(function(){a.show()},500)},refresh:function(){this.current_user=Galaxy.currUser.get("id"),this.current_history=null,this.current_user&&(this.current_history=Galaxy.currHistoryPanel.model.get("id"))}})});
|
||||
define(["utils/utils","mvc/ui/ui-modal","mvc/ui/ui-tabs","mvc/upload/upload-button","mvc/upload/upload-view-default"],function(a,b,c,d,e){return Backbone.View.extend({options:{nginx_upload_path:"",ftp_upload_site:"n/a",default_genome:"?",default_extension:"auto",height:400,width:900,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."}},modal:null,ui_button:null,current_history:null,list_extensions:[],list_genomes:[],initialize:function(b){var c=this;this.options=a.merge(b,this.options),this.ui_button=new d.Model,this.ui_button_view=new d.View({model:this.ui_button,onclick:function(a){a.preventDefault(),c.show()},onunload:function(){}}),$(".with-upload-button").append(this.ui_button_view.$el);var c=this;a.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(a){for(key in a)c.list_extensions.push({id:a[key].extension,text:a[key].extension,description:a[key].description,description_url:a[key].description_url});c.list_extensions.sort(function(a,b){return a.text>b.text?1:a.text<b.text?-1:0}),c.options.datatypes_disable_auto||c.list_extensions.unshift(c.options.auto)}}),a.get({url:galaxy_config.root+"api/genomes",success:function(a){for(key in a)c.list_genomes.push({id:a[key][1],text:a[key][0]});c.list_genomes.sort(function(a,b){return a.id==c.options.default_genome?-1:b.id==c.options.default_genome?1:a.text>b.text?1:a.text<b.text?-1:0})}})},show:function(){var a=this;return Galaxy.currHistoryPanel&&Galaxy.currHistoryPanel.model?(this.refresh(),this.modal||(this.tabs=new c.View,this.default_view=new e(this),this.tabs.add({id:"default",title:"Default",$el:this.default_view.$el}),this.modal=new b.View({title:"Download data directly from web or upload files from your disk",body:this.tabs.$el,height:this.options.height,width:this.options.width,closing_events:!0})),void this.modal.show()):void window.setTimeout(function(){a.show()},500)},refresh:function(){this.current_user=Galaxy.currUser.get("id"),this.current_history=null,this.current_user&&(this.current_history=Galaxy.currHistoryPanel.model.get("id"))}})});
|
||||
//# sourceMappingURL=../../../maps/mvc/upload/upload-view.js.map
|
||||
Reference in New Issue
Block a user