From fef1e548bba39c856f6086f0eb2300e6a50d8559 Mon Sep 17 00:00:00 2001 From: guerler Date: Fri, 6 Nov 2015 20:29:27 -0500 Subject: [PATCH 01/13] Fix job permission handling Catch unavailable history Fix test --- lib/galaxy/webapps/galaxy/api/jobs.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/api/jobs.py b/lib/galaxy/webapps/galaxy/api/jobs.py index f7ac3c2431b..c12e09bc06a 100644 --- a/lib/galaxy/webapps/galaxy/api/jobs.py +++ b/lib/galaxy/webapps/galaxy/api/jobs.py @@ -29,6 +29,7 @@ class JobController( BaseAPIController, UsesLibraryMixinItems ): def __init__( self, app ): super( JobController, self ).__init__( app ) self.hda_manager = managers.hdas.HDAManager( app ) + self.history_manager = managers.histories.HistoryManager( app ) @expose_api def index( self, trans, **kwd ): @@ -230,19 +231,15 @@ class JobController( BaseAPIController, UsesLibraryMixinItems ): decoded_job_id = self.decode_id( id ) except Exception: raise exceptions.MalformedId() - query = trans.sa_session.query( trans.app.model.Job ) - if trans.user_is_admin(): - query = query.filter( - trans.app.model.Job.id == decoded_job_id - ) - else: - query = query.filter( - trans.app.model.Job.user == trans.user, - trans.app.model.Job.id == decoded_job_id - ) - job = query.first() + job = trans.sa_session.query( trans.app.model.Job ).filter( trans.app.model.Job.id == decoded_job_id ).first() if job is None: raise exceptions.ObjectNotFound() + if not trans.user_is_admin() and job.user != trans.user: + history = self.history_manager.get_current( trans ) + if history is None: + raise exceptions.ObjectNotFound() + if len( [ hda.id for hda in history.datasets if hda.creating_job.id == job.id ] ) == 0: + raise exceptions.ItemAccessibilityException() return job @expose_api From a8147327af2e8a90108d11d7fa93fe4d4893f6ab Mon Sep 17 00:00:00 2001 From: guerler Date: Mon, 9 Nov 2015 20:21:22 -0500 Subject: [PATCH 02/13] Derive permission from job outputs Remove history manager Use dataset manager --- lib/galaxy/webapps/galaxy/api/jobs.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/api/jobs.py b/lib/galaxy/webapps/galaxy/api/jobs.py index c12e09bc06a..52fe43e8363 100644 --- a/lib/galaxy/webapps/galaxy/api/jobs.py +++ b/lib/galaxy/webapps/galaxy/api/jobs.py @@ -29,7 +29,7 @@ class JobController( BaseAPIController, UsesLibraryMixinItems ): def __init__( self, app ): super( JobController, self ).__init__( app ) self.hda_manager = managers.hdas.HDAManager( app ) - self.history_manager = managers.histories.HistoryManager( app ) + self.dataset_manager = managers.datasets.DatasetManager( app ) @expose_api def index( self, trans, **kwd ): @@ -235,11 +235,9 @@ class JobController( BaseAPIController, UsesLibraryMixinItems ): if job is None: raise exceptions.ObjectNotFound() if not trans.user_is_admin() and job.user != trans.user: - history = self.history_manager.get_current( trans ) - if history is None: - raise exceptions.ObjectNotFound() - if len( [ hda.id for hda in history.datasets if hda.creating_job.id == job.id ] ) == 0: - raise exceptions.ItemAccessibilityException() + for data_assoc in job.output_datasets: + if not self.dataset_manager.is_accessible( data_assoc.dataset.dataset, trans.user ): + raise exceptions.ItemAccessibilityException( "You are not allowed to rerun this job." ) return job @expose_api From 36797b3195c84b416710029d86cf7b7a24c1faf0 Mon Sep 17 00:00:00 2001 From: Marius van den Beek Date: Tue, 10 Nov 2015 17:37:28 +0100 Subject: [PATCH 03/13] Add changed static files. --- static/maps/mvc/library/library-folderrow-view.js.map | 2 +- static/scripts/mvc/library/library-folderrow-view.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/static/maps/mvc/library/library-folderrow-view.js.map b/static/maps/mvc/library/library-folderrow-view.js.map index 4a36934baef..ef741012f21 100644 --- a/static/maps/mvc/library/library-folderrow-view.js.map +++ b/static/maps/mvc/library/library-folderrow-view.js.map @@ -1 +1 @@ -{"version":3,"file":"library-folderrow-view.js","sources":["../../../src/mvc/library/library-folderrow-view.js"],"names":["define","mod_masthead","mod_utils","mod_toastr","mod_library_model","mod_library_dataset_view","FolderRowView","Backbone","View","extend","lastSelectedHistory","events","click .undelete_dataset_btn","click .undelete_folder_btn","options","type","initialize","folder_item","this","model","render","template","get","templateRowDeletedFolder","templateRowFolder","templateRowDeletedFile","templateRowFile","console","error","setElement","content_item","$el","show","showDatasetDetails","Galaxy","libraries","datasetView","LibraryDatasetView","id","undeleteDataset","event","$","hide","that","dataset_id","target","closest","dataset","folderListView","collection","url","urlRoot","destroy","success","response","remove","updated_dataset","Item","add","sortByNameAsc","onclick","folder_id","window","location","responseJSON","err_msg","undeleteFolder","folder","updated_folder","FolderAsModel","tmpl_array","push","_","join"],"mappings":"AAAAA,QACI,kBACA,cACA,cACA,4BACA,oCACJ,SAASC,EACAC,EACAC,EACAC,EACAC,GAET,GAAIC,GAAgBC,SAASC,KAAKC,QAEhCC,oBAAqB,GAErBC,QACEC,8BAAmC,kBACnCC,6BAAmC,kBAGrCC,SACEC,KAAM,MAGRC,WAAa,SAASC,GACpBC,KAAKC,MAAQF,EACbC,KAAKE,OAAOH,IAGdG,OAAQ,SAASH,GACf,GAAII,GAAW,IAqBf,OApBgC,WAA5BJ,EAAYK,IAAI,SAA2D,kBAAnCL,EAAYK,IAAI,gBAC1DJ,KAAKJ,QAAQC,KAAO,SAElBM,EADEJ,EAAYK,IAAI,WACPJ,KAAKK,2BAELL,KAAKM,qBAEmB,SAA5BP,EAAYK,IAAI,SAAyD,mBAAnCL,EAAYK,IAAI,gBAC/DJ,KAAKJ,QAAQC,KAAO,OAElBM,EADEJ,EAAYK,IAAI,WACPJ,KAAKO,yBAELP,KAAKQ,oBAGlBC,QAAQC,MAAM,oCACdD,QAAQC,MAAMX,EAAYK,IAAI,SAAWL,EAAYK,IAAI,iBAE3DJ,KAAKW,WAAWR,GAAUS,aAAab,KACvCC,KAAKa,IAAIC,OACFd,MAGTe,mBAAqB,WACnBC,OAAOC,UAAUC,YAAc,GAAI/B,GAAyBgC,oBAAoBC,GAAIpB,KAAKoB,MAM3FC,gBAAkB,SAASC,GACzBC,EAAE,YAAYC,MACd,IA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AK,8BAChBD,WAAWC,KAAK,uCAChBD,WAAWC,KAAK,WAChBD,WAAWC,KAAK,qBAChBD,WAAWC,KAAK,eAChBD,WAAWC,KAAK,+DAChBD,WAAWC,KAAK,wZAChBD,WAAWC,KAAK,SAETC,EAAEnD,SAASiD,WAAWG,KAAK,OAKtC,QACInE,cAAeA"} \ No newline at end of file +{"version":3,"file":"library-folderrow-view.js","sources":["../../../src/mvc/library/library-folderrow-view.js"],"names":["define","mod_masthead","mod_utils","mod_toastr","mod_library_model","mod_library_dataset_view","FolderRowView","Backbone","View","extend","lastSelectedHistory","events","click .undelete_dataset_btn","click .undelete_folder_btn","options","type","initialize","folder_item","this","model","render","template","get","templateRowDeletedFolder","templateRowFolder","templateRowDeletedFile","templateRowFile","console","error","setElement","content_item","$el","show","showDatasetDetails","Galaxy","libraries","datasetView","LibraryDatasetView","id","undeleteDataset","event","$","hide","that","dataset_id","target","closest","dataset","folderListView","collection","url","urlRoot","destroy","success","response","remove","updated_dataset","Item","add","sortByNameAsc","onclick","folder_id","window","location","responseJSON","err_msg","undeleteFolder","folder","updated_folder","FolderAsModel","tmpl_array","push","_","join"],"mappings":"AAAAA,QACI,kBACA,cACA,cACA,4BACA,oCACJ,SAASC,EACAC,EACAC,EACAC,EACAC,GAET,GAAIC,GAAgBC,SAASC,KAAKC,QAEhCC,oBAAqB,GAErBC,QACEC,8BAAmC,kBACnCC,6BAAmC,kBAGrCC,SACEC,KAAM,MAGRC,WAAa,SAASC,GACpBC,KAAKC,MAAQF,EACbC,KAAKE,OAAOH,IAGdG,OAAQ,SAASH,GACf,GAAII,GAAW,IAqBf,OApBgC,WAA5BJ,EAAYK,IAAI,SAA2D,kBAAnCL,EAAYK,IAAI,gBAC1DJ,KAAKJ,QAAQC,KAAO,SAElBM,EADEJ,EAAYK,IAAI,WACPJ,KAAKK,2BAELL,KAAKM,qBAEmB,SAA5BP,EAAYK,IAAI,SAAyD,qCAAnCL,EAAYK,IAAI,gBAC/DJ,KAAKJ,QA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AWC,KAAK,WAChBD,WAAWC,KAAK,eAChBD,WAAWC,KAAK,kEAChBD,WAAWC,KAAK,4DAChBD,WAAWC,KAAK,6DAChBD,WAAWC,KAAK,+DAChBD,WAAWC,KAAK,yZAChBD,WAAWC,KAAK,SAETC,EAAEnD,SAASiD,WAAWG,KAAK,MAGpClD,yBAA0B,WAiBxB,MAhBA+C,eAEAA,WAAWC,KAAK,gFAChBD,WAAWC,KAAK,UAChBD,WAAWC,KAAK,2DAChBD,WAAWC,KAAK,WAChBD,WAAWC,KAAK,eAChBD,WAAWC,KAAK,8BAChBD,WAAWC,KAAK,uCAChBD,WAAWC,KAAK,WAChBD,WAAWC,KAAK,qBAChBD,WAAWC,KAAK,eAChBD,WAAWC,KAAK,+DAChBD,WAAWC,KAAK,wZAChBD,WAAWC,KAAK,SAETC,EAAEnD,SAASiD,WAAWG,KAAK,OAKtC,QACInE,cAAeA"} \ No newline at end of file diff --git a/static/scripts/mvc/library/library-folderrow-view.js b/static/scripts/mvc/library/library-folderrow-view.js index 9f484f9acee..d9683065d0d 100644 --- a/static/scripts/mvc/library/library-folderrow-view.js +++ b/static/scripts/mvc/library/library-folderrow-view.js @@ -1,2 +1,2 @@ -define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-dataset-view"],function(a,b,c,d,e){var f=Backbone.View.extend({lastSelectedHistory:"",events:{"click .undelete_dataset_btn":"undeleteDataset","click .undelete_folder_btn":"undeleteFolder"},options:{type:null},initialize:function(a){this.model=a,this.render(a)},render:function(a){var b=null;return"folder"===a.get("type")||"LibraryFolder"===a.get("model_class")?(this.options.type="folder",b=a.get("deleted")?this.templateRowDeletedFolder():this.templateRowFolder()):"file"===a.get("type")||"LibraryDataset"===a.get("model_class")?(this.options.type="file",b=a.get("deleted")?this.templateRowDeletedFile():this.templateRowFile()):(console.error("Unknown library item type found."),console.error(a.get("type")||a.get("model_class"))),this.setElement(b({content_item:a})),this.$el.show(),this},showDatasetDetails:function(){Galaxy.libraries.datasetView=new e.LibraryDatasetView({id:this.id})},undeleteDataset:function(a){$(".tooltip").hide();var b=this,e=$(a.target).closest("tr")[0].id,f=Galaxy.libraries.folderListView.collection.get(e);f.url=f.urlRoot+f.id+"?undelete=true",f.destroy({success:function(a,f){Galaxy.libraries.folderListView.collection.remove(e);var g=new d.Item(f);Galaxy.libraries.folderListView.collection.add(g),Galaxy.libraries.folderListView.collection.sortByNameAsc(),c.success("Dataset undeleted. Click this to see it.","",{onclick:function(){var a=b.model.get("folder_id");window.location="#folders/"+a+"/datasets/"+b.id}})},error:function(a,b){c.error("undefined"!=typeof b.responseJSON?"Dataset was not undeleted. "+b.responseJSON.err_msg:"An error occured! Dataset was not undeleted. Please try again.")}})},undeleteFolder:function(a){$(".tooltip").hide();var b=$(a.target).closest("tr")[0].id,e=Galaxy.libraries.folderListView.collection.get(b);e.url=e.urlRoot+e.id+"?undelete=true",e.destroy({success:function(a,e){Galaxy.libraries.folderListView.collection.remove(b);var f=new d.FolderAsModel(e);Galaxy.libraries.folderListView.collection.add(f),Galaxy.libraries.folderListView.collection.sortByNameAsc(),c.success("Folder undeleted.")},error:function(a,b){c.error("undefined"!=typeof b.responseJSON?"Folder was not undeleted. "+b.responseJSON.err_msg:"An error occured! Folder was not undeleted. Please try again.")}})},templateRowFolder:function(){return tmpl_array=[],tmpl_array.push(''),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(" "),tmpl_array.push(' <%- content_item.get("name") %>'),tmpl_array.push(" "),tmpl_array.push(" folder"),tmpl_array.push(" "),tmpl_array.push(' <%= _.escape(content_item.get("update_time")) %>'),tmpl_array.push(" "),tmpl_array.push(' <% if (content_item.get("can_manage")) { %><% } %>'),tmpl_array.push(" "),tmpl_array.push(""),_.template(tmpl_array.join(""))},templateRowFile:function(){return tmpl_array=[],tmpl_array.push(''),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(' /datasets/<%- content_item.id %>" class="library-dataset"><%- content_item.get("name") %>'),tmpl_array.push(' <%= _.escape(content_item.get("file_ext")) %>'),tmpl_array.push(' <%= _.escape(content_item.get("file_size")) %>'),tmpl_array.push(' <%= _.escape(content_item.get("update_time")) %>'),tmpl_array.push(" "),tmpl_array.push(' <% if (content_item.get("is_unrestricted")) { %><% } %>'),tmpl_array.push(' <% if (content_item.get("is_private")) { %><% } %>'),tmpl_array.push(' <% if ((content_item.get("is_unrestricted") === false) && (content_item.get("is_private") === false)) { %><% } %>'),tmpl_array.push(' <% if (content_item.get("can_manage")) { %>/datasets/<%- content_item.id %>/permissions"><% } %>'),tmpl_array.push(" "),tmpl_array.push(""),_.template(tmpl_array.join(""))},templateRowDeletedFile:function(){return tmpl_array=[],tmpl_array.push(''),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(" "),tmpl_array.push(" "),tmpl_array.push(' <%- content_item.get("name") %>'),tmpl_array.push(' <%= _.escape(content_item.get("file_ext")) %>'),tmpl_array.push(' <%= _.escape(content_item.get("file_size")) %>'),tmpl_array.push(' <%= _.escape(content_item.get("update_time")) %>'),tmpl_array.push(' '),tmpl_array.push(""),_.template(tmpl_array.join(""))},templateRowDeletedFolder:function(){return tmpl_array=[],tmpl_array.push(''),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(" "),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(' <%- content_item.get("name") %>'),tmpl_array.push(" "),tmpl_array.push(" folder"),tmpl_array.push(" "),tmpl_array.push(' <%= _.escape(content_item.get("update_time")) %>'),tmpl_array.push(' '),tmpl_array.push(""),_.template(tmpl_array.join(""))}});return{FolderRowView:f}}); +define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-dataset-view"],function(a,b,c,d,e){var f=Backbone.View.extend({lastSelectedHistory:"",events:{"click .undelete_dataset_btn":"undeleteDataset","click .undelete_folder_btn":"undeleteFolder"},options:{type:null},initialize:function(a){this.model=a,this.render(a)},render:function(a){var b=null;return"folder"===a.get("type")||"LibraryFolder"===a.get("model_class")?(this.options.type="folder",b=a.get("deleted")?this.templateRowDeletedFolder():this.templateRowFolder()):"file"===a.get("type")||"LibraryDatasetDatasetAssociation"===a.get("model_class")?(this.options.type="file",b=a.get("deleted")?this.templateRowDeletedFile():this.templateRowFile()):(console.error("Unknown library item type found."),console.error(a.get("type")||a.get("model_class"))),this.setElement(b({content_item:a})),this.$el.show(),this},showDatasetDetails:function(){Galaxy.libraries.datasetView=new e.LibraryDatasetView({id:this.id})},undeleteDataset:function(a){$(".tooltip").hide();var b=this,e=$(a.target).closest("tr")[0].id,f=Galaxy.libraries.folderListView.collection.get(e);f.url=f.urlRoot+f.id+"?undelete=true",f.destroy({success:function(a,f){Galaxy.libraries.folderListView.collection.remove(e);var g=new d.Item(f);Galaxy.libraries.folderListView.collection.add(g),Galaxy.libraries.folderListView.collection.sortByNameAsc(),c.success("Dataset undeleted. Click this to see it.","",{onclick:function(){var a=b.model.get("folder_id");window.location="#folders/"+a+"/datasets/"+b.id}})},error:function(a,b){c.error("undefined"!=typeof b.responseJSON?"Dataset was not undeleted. "+b.responseJSON.err_msg:"An error occured! Dataset was not undeleted. Please try again.")}})},undeleteFolder:function(a){$(".tooltip").hide();var b=$(a.target).closest("tr")[0].id,e=Galaxy.libraries.folderListView.collection.get(b);e.url=e.urlRoot+e.id+"?undelete=true",e.destroy({success:function(a,e){Galaxy.libraries.folderListView.collection.remove(b);var f=new d.FolderAsModel(e);Galaxy.libraries.folderListView.collection.add(f),Galaxy.libraries.folderListView.collection.sortByNameAsc(),c.success("Folder undeleted.")},error:function(a,b){c.error("undefined"!=typeof b.responseJSON?"Folder was not undeleted. "+b.responseJSON.err_msg:"An error occured! Folder was not undeleted. Please try again.")}})},templateRowFolder:function(){return tmpl_array=[],tmpl_array.push(''),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(" "),tmpl_array.push(' <%- content_item.get("name") %>'),tmpl_array.push(" "),tmpl_array.push(" folder"),tmpl_array.push(" "),tmpl_array.push(' <%= _.escape(content_item.get("update_time")) %>'),tmpl_array.push(" "),tmpl_array.push(' <% if (content_item.get("can_manage")) { %><% } %>'),tmpl_array.push(" "),tmpl_array.push(""),_.template(tmpl_array.join(""))},templateRowFile:function(){return tmpl_array=[],tmpl_array.push(''),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(' /datasets/<%- content_item.id %>" class="library-dataset"><%- content_item.get("name") %>'),tmpl_array.push(' <%= _.escape(content_item.get("file_ext")) %>'),tmpl_array.push(' <%= _.escape(content_item.get("file_size")) %>'),tmpl_array.push(' <%= _.escape(content_item.get("update_time")) %>'),tmpl_array.push(" "),tmpl_array.push(' <% if (content_item.get("is_unrestricted")) { %><% } %>'),tmpl_array.push(' <% if (content_item.get("is_private")) { %><% } %>'),tmpl_array.push(' <% if ((content_item.get("is_unrestricted") === false) && (content_item.get("is_private") === false)) { %><% } %>'),tmpl_array.push(' <% if (content_item.get("can_manage")) { %>/datasets/<%- content_item.id %>/permissions"><% } %>'),tmpl_array.push(" "),tmpl_array.push(""),_.template(tmpl_array.join(""))},templateRowDeletedFile:function(){return tmpl_array=[],tmpl_array.push(''),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(" "),tmpl_array.push(" "),tmpl_array.push(' <%- content_item.get("name") %>'),tmpl_array.push(' <%= _.escape(content_item.get("file_ext")) %>'),tmpl_array.push(' <%= _.escape(content_item.get("file_size")) %>'),tmpl_array.push(' <%= _.escape(content_item.get("update_time")) %>'),tmpl_array.push(' '),tmpl_array.push(""),_.template(tmpl_array.join(""))},templateRowDeletedFolder:function(){return tmpl_array=[],tmpl_array.push(''),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(" "),tmpl_array.push(" "),tmpl_array.push(' '),tmpl_array.push(' <%- content_item.get("name") %>'),tmpl_array.push(" "),tmpl_array.push(" folder"),tmpl_array.push(" "),tmpl_array.push(' <%= _.escape(content_item.get("update_time")) %>'),tmpl_array.push(' '),tmpl_array.push(""),_.template(tmpl_array.join(""))}});return{FolderRowView:f}}); //# sourceMappingURL=../../../maps/mvc/library/library-folderrow-view.js.map \ No newline at end of file From ad016460dc2799e95ff26fdd0a69bf605f78358b Mon Sep 17 00:00:00 2001 From: Marius van den Beek Date: Tue, 10 Nov 2015 17:28:51 +0100 Subject: [PATCH 04/13] Fix import of history datasets into library. --- client/galaxy/scripts/mvc/library/library-folderrow-view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/galaxy/scripts/mvc/library/library-folderrow-view.js b/client/galaxy/scripts/mvc/library/library-folderrow-view.js index 51b1686a848..6c357d1458d 100644 --- a/client/galaxy/scripts/mvc/library/library-folderrow-view.js +++ b/client/galaxy/scripts/mvc/library/library-folderrow-view.js @@ -37,7 +37,7 @@ var FolderRowView = Backbone.View.extend({ } else{ template = this.templateRowFolder(); } - } else if (folder_item.get('type') === 'file' || folder_item.get('model_class') === 'LibraryDataset'){ + } else if (folder_item.get('type') === 'file' || folder_item.get('model_class') === 'LibraryDatasetDatasetAssociation'){ this.options.type = 'file'; if (folder_item.get('deleted')){ template = this.templateRowDeletedFile(); From b88864586c760e0e644bdc32c5d2349b1613446c Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 10 Nov 2015 13:45:20 -0500 Subject: [PATCH 05/13] Fix warning statement --- lib/galaxy/tools/parameters/dynamic_options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/parameters/dynamic_options.py b/lib/galaxy/tools/parameters/dynamic_options.py index 637d0b6b581..14a9c42f66c 100644 --- a/lib/galaxy/tools/parameters/dynamic_options.py +++ b/lib/galaxy/tools/parameters/dynamic_options.py @@ -582,8 +582,8 @@ class DynamicOptions( object ): def get_fields( self, trans, other_values ): if self.dataset_ref_name: dataset = other_values.get( self.dataset_ref_name, None ) - assert dataset is not None, "Required dataset '%s' missing from input" % self.dataset_ref_name if not dataset: + log.warn( "Required dataset '%s' missing from input" % self.dataset_ref_name ) return [] # no valid dataset in history # Ensure parsing dynamic options does not consume more than a megabyte worth memory. path = dataset.file_name From b2723e7467c5fb9722a1c6cb009251b0deaf9bc4 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 10 Nov 2015 15:08:21 -0500 Subject: [PATCH 06/13] Disable invalid test case. Add validation criteria. Fix comments Fix comment --- lib/galaxy/webapps/galaxy/api/jobs.py | 2 ++ test/api/test_jobs.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/api/jobs.py b/lib/galaxy/webapps/galaxy/api/jobs.py index 52fe43e8363..121770e3ba2 100644 --- a/lib/galaxy/webapps/galaxy/api/jobs.py +++ b/lib/galaxy/webapps/galaxy/api/jobs.py @@ -235,6 +235,8 @@ class JobController( BaseAPIController, UsesLibraryMixinItems ): if job is None: raise exceptions.ObjectNotFound() if not trans.user_is_admin() and job.user != trans.user: + if not job.output_datasets: + raise exceptions.ItemAccessibilityException( "Job has no output datasets." ) for data_assoc in job.output_datasets: if not self.dataset_manager.is_accessible( data_assoc.dataset.dataset, trans.user ): raise exceptions.ItemAccessibilityException( "You are not allowed to rerun this job." ) diff --git a/test/api/test_jobs.py b/test/api/test_jobs.py index 192da79f465..cd8ad52ccd6 100644 --- a/test/api/test_jobs.py +++ b/test/api/test_jobs.py @@ -110,9 +110,10 @@ class JobsApiTestCase( api.ApiTestCase, TestsDatasets ): show_jobs_response = self._get( "jobs/%s" % job_id, admin=False ) self._assert_not_has_keys( show_jobs_response.json(), "command_line", "external_id" ) - with self._different_user(): - show_jobs_response = self._get( "jobs/%s" % job_id, admin=False ) - self._assert_status_code_is( show_jobs_response, 404 ) + # TODO: Re-activate test case when API accepts privacy settings + # with self._different_user(): + # show_jobs_response = self._get( "jobs/%s" % job_id, admin=False ) + # self._assert_status_code_is( show_jobs_response, 200 ) show_jobs_response = self._get( "jobs/%s" % job_id, admin=True ) self._assert_has_keys( show_jobs_response.json(), "command_line", "external_id" ) From 65807013957c3f845b0b8fd793b52b6d9f057505 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 10 Nov 2015 19:20:48 -0500 Subject: [PATCH 07/13] Fix parsing of message configuration Fix default value Add root to Galaxy object --- client/galaxy/scripts/galaxy-app-base.js | 3 ++- lib/galaxy/managers/configuration.py | 4 ++++ static/maps/galaxy-app-base.js.map | 2 +- static/scripts/galaxy-app-base.js | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/client/galaxy/scripts/galaxy-app-base.js b/client/galaxy/scripts/galaxy-app-base.js index 0f5187e809b..b068c966027 100644 --- a/client/galaxy/scripts/galaxy-app-base.js +++ b/client/galaxy/scripts/galaxy-app-base.js @@ -27,7 +27,6 @@ GalaxyApp.prototype.defaultOptions = { /** monkey patch attributes from existing window.Galaxy object? */ patchExisting : true, /** root url of this app */ - // move to self.root? root : '/' }; @@ -53,6 +52,8 @@ GalaxyApp.prototype._init = function init( options ){ self._initUser( options.user || bootstrapped.user || {} ); self.debug( 'GalaxyApp.user: ', self.user ); + self.root = options.root; + self.debug( 'GalaxyApp.root: ', self.root ); //TODO: temp self.trigger( 'ready', self ); //if( typeof options.onload === 'function' ){ diff --git a/lib/galaxy/managers/configuration.py b/lib/galaxy/managers/configuration.py index f410fc7d2ab..4f5aa7786d7 100644 --- a/lib/galaxy/managers/configuration.py +++ b/lib/galaxy/managers/configuration.py @@ -62,6 +62,10 @@ class ConfigSerializer( base.ModelSerializer ): 'ftp_upload_dir' : _defaults_to( None ), 'ftp_upload_site' : _defaults_to( None ), 'version_major' : _defaults_to( None ), + 'inactivity_box_content' : _defaults_to( None ), + 'message_box_content' : _defaults_to( None ), + 'message_box_visible' : _defaults_to( False ), + 'message_box_class' : _defaults_to( 'info' ), } diff --git a/static/maps/galaxy-app-base.js.map b/static/maps/galaxy-app-base.js.map index e3c16c485d1..1b752b17025 100644 --- a/static/maps/galaxy-app-base.js.map +++ b/static/maps/galaxy-app-base.js.map @@ -1 +1 @@ -{"version":3,"file":"galaxy-app-base.js","sources":["../src/galaxy-app-base.js"],"names":["define","userModel","metricsLogger","addLogging","localize","bootstrapped","GalaxyApp","options","self","this","_init","prototype","defaultOptions","patchExisting","root","_","extend","Backbone","Events","_processOptions","debug","_patchGalaxy","window","Galaxy","_initLogger","loggerOptions","logger","_initLocale","config","_initUser","user","trigger","_setUpListeners","defaults","k","hasOwnProperty","patchWith","MetricsLogger","_l","userJSON","User","currUser","lastAjax","$","document","bind","ev","xhr","data","JSON","parse","err","url","location","href","slice","toString","userEmail","get"],"mappings":"AAAAA,QACI,sBACA,uBACA,oBACA,qBACA,qBACD,SAAUC,EAAWC,EAAeC,EAAYC,EAAUC,GAU7D,QAASC,GAAWC,GAChB,GAAIC,GAAOC,IACX,OAAOD,GAAKE,MAAOH,OA0InB,MAtIJJ,GAAYG,EAAW,aAGvBA,EAAUK,UAAUC,gBAEhBC,eAAkB,EAGlBC,KAAkB,KAItBR,EAAUK,UAAUD,MAAQ,SAAeH,GACvC,GAAIC,GAAOC,IA4BX,OA3BAM,GAAEC,OAAQR,EAAMS,SAASC,QAEzBV,EAAKW,gBAAiBZ,GACtBC,EAAKY,MAAO,sBAAuBZ,EAAKD,SAExCC,EAAKa,aAAcC,OAAOC,QAE1Bf,EAAKgB,YAAajB,EAAQkB,mBAC1BjB,EAAKY,MAAO,qBAAsBZ,EAAKkB,QAEvClB,EAAKmB,cACLnB,EAAKY,MAAO,uBAAwBZ,EAAKJ,UAEzCI,EAAKoB,OAASrB,EAAQqB,QAAUvB,EAAauB,WAC7CpB,EAAKY,MAAO,qBAAsBZ,EAAKoB,QAEvCpB,EAAKqB,UAAWtB,EAAQuB,MAAQzB,EAAayB,UAC7CtB,EAAKY,MAAO,mBAAoBZ,EAAKsB,MAGrCtB,EAAKuB,QAAS,QAASvB,GAKvBA,EAAKwB,kBAEExB,GAIXF,EAAUK,UAAUQ,gB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IAAUC,SAASC,KAAKC,MAAO,EAAG,IAAOhD,EAAQ6C,IACjDJ,KAAUA,KAIXxC,GAIXF,EAAUK,UAAU6C,SAAW,WAC3B,GAAIC,GAAYhD,KAAKqB,KAAK4B,IAAK,UAAa,aAC5C,OAAO,aAAeD,EAAY,MAM9BnD,UAAYA"} \ No newline at end of file +{"version":3,"file":"galaxy-app-base.js","sources":["../src/galaxy-app-base.js"],"names":["define","userModel","metricsLogger","addLogging","localize","bootstrapped","GalaxyApp","options","self","this","_init","prototype","defaultOptions","patchExisting","root","_","extend","Backbone","Events","_processOptions","debug","_patchGalaxy","window","Galaxy","_initLogger","loggerOptions","logger","_initLocale","config","_initUser","user","trigger","_setUpListeners","defaults","k","hasOwnProperty","patchWith","MetricsLogger","_l","userJSON","User","currUser","lastAjax","$","document","bind","ev","xhr","data","JSON","parse","err","url","location","href","slice","toString","userEmail","get"],"mappings":"AAAAA,QACI,sBACA,uBACA,oBACA,qBACA,qBACD,SAAUC,EAAWC,EAAeC,EAAYC,EAAUC,GAU7D,QAASC,GAAWC,GAChB,GAAIC,GAAOC,IACX,OAAOD,GAAKE,MAAOH,OA2InB,MAvIJJ,GAAYG,EAAW,aAGvBA,EAAUK,UAAUC,gBAEhBC,eAAkB,EAElBC,KAAkB,KAItBR,EAAUK,UAAUD,MAAQ,SAAeH,GACvC,GAAIC,GAAOC,IA8BX,OA7BAM,GAAEC,OAAQR,EAAMS,SAASC,QAEzBV,EAAKW,gBAAiBZ,GACtBC,EAAKY,MAAO,sBAAuBZ,EAAKD,SAExCC,EAAKa,aAAcC,OAAOC,QAE1Bf,EAAKgB,YAAajB,EAAQkB,mBAC1BjB,EAAKY,MAAO,qBAAsBZ,EAAKkB,QAEvClB,EAAKmB,cACLnB,EAAKY,MAAO,uBAAwBZ,EAAKJ,UAEzCI,EAAKoB,OAASrB,EAAQqB,QAAUvB,EAAauB,WAC7CpB,EAAKY,MAAO,qBAAsBZ,EAAKoB,QAEvCpB,EAAKqB,UAAWtB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AUqB,gBAAkB,WAClC,GAAIxB,GAAOC,IAiBX,OAbAD,GAAKkC,YACLC,EAAGC,UAAWC,KAAM,WAAY,SAAUC,EAAIC,EAAKxC,GAC/C,GAAIyC,GAAOzC,EAAQyC,IACnB,KACIA,EAAOC,KAAKC,MAAOF,GACrB,MAAOG,IAET3C,EAAKkC,UACDU,IAAUC,SAASC,KAAKC,MAAO,EAAG,IAAOhD,EAAQ6C,IACjDJ,KAAUA,KAIXxC,GAIXF,EAAUK,UAAU6C,SAAW,WAC3B,GAAIC,GAAYhD,KAAKqB,KAAK4B,IAAK,UAAa,aAC5C,OAAO,aAAeD,EAAY,MAM9BnD,UAAYA"} \ No newline at end of file diff --git a/static/scripts/galaxy-app-base.js b/static/scripts/galaxy-app-base.js index 77a034a27e8..cee9a76d279 100644 --- a/static/scripts/galaxy-app-base.js +++ b/static/scripts/galaxy-app-base.js @@ -1,2 +1,2 @@ -define(["mvc/user/user-model","utils/metrics-logger","utils/add-logging","utils/localization","bootstrapped-data"],function(a,b,c,d,e){function f(a){var b=this;return b._init(a||{})}return c(f,"GalaxyApp"),f.prototype.defaultOptions={patchExisting:!0,root:"/"},f.prototype._init=function(a){var b=this;return _.extend(b,Backbone.Events),b._processOptions(a),b.debug("GalaxyApp.options: ",b.options),b._patchGalaxy(window.Galaxy),b._initLogger(a.loggerOptions||{}),b.debug("GalaxyApp.logger: ",b.logger),b._initLocale(),b.debug("GalaxyApp.localize: ",b.localize),b.config=a.config||e.config||{},b.debug("GalaxyApp.config: ",b.config),b._initUser(a.user||e.user||{}),b.debug("GalaxyApp.user: ",b.user),b.trigger("ready",b),b._setUpListeners(),b},f.prototype._processOptions=function(a){var b=this,c=b.defaultOptions;b.debug("_processOptions: ",a),b.options={};for(var d in c)c.hasOwnProperty(d)&&(b.options[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},f.prototype._patchGalaxy=function(a){var b=this;if(b.options.patchExisting&&a){b.debug("found existing Galaxy object:",a);for(var c in a)a.hasOwnProperty(c)&&(b.debug(" patching in "+c+" to Galaxy"),b[c]=a[c])}},f.prototype._initLogger=function(a){var c=this;return c.debug("_initLogger:",a),c.logger=new b.MetricsLogger(a),c},f.prototype._initLocale=function(a){var b=this;return b.debug("_initLocale:",a),b.localize=d,window._l=b.localize,b},f.prototype._initUser=function(b){var c=this;return c.debug("_initUser:",b),c.user=new a.User(b),c.currUser=c.user,c},f.prototype._setUpListeners=function(){var a=this;return a.lastAjax={},$(document).bind("ajaxSend",function(b,c,d){var e=d.data;try{e=JSON.parse(e)}catch(f){}a.lastAjax={url:location.href.slice(0,-1)+d.url,data:e}}),a},f.prototype.toString=function(){var a=this.user.get("email")||"(anonymous)";return"GalaxyApp("+a+")"},{GalaxyApp:f}}); +define(["mvc/user/user-model","utils/metrics-logger","utils/add-logging","utils/localization","bootstrapped-data"],function(a,b,c,d,e){function f(a){var b=this;return b._init(a||{})}return c(f,"GalaxyApp"),f.prototype.defaultOptions={patchExisting:!0,root:"/"},f.prototype._init=function(a){var b=this;return _.extend(b,Backbone.Events),b._processOptions(a),b.debug("GalaxyApp.options: ",b.options),b._patchGalaxy(window.Galaxy),b._initLogger(a.loggerOptions||{}),b.debug("GalaxyApp.logger: ",b.logger),b._initLocale(),b.debug("GalaxyApp.localize: ",b.localize),b.config=a.config||e.config||{},b.debug("GalaxyApp.config: ",b.config),b._initUser(a.user||e.user||{}),b.debug("GalaxyApp.user: ",b.user),b.root=a.root,b.debug("GalaxyApp.root: ",b.root),b.trigger("ready",b),b._setUpListeners(),b},f.prototype._processOptions=function(a){var b=this,c=b.defaultOptions;b.debug("_processOptions: ",a),b.options={};for(var d in c)c.hasOwnProperty(d)&&(b.options[d]=a.hasOwnProperty(d)?a[d]:c[d]);return b},f.prototype._patchGalaxy=function(a){var b=this;if(b.options.patchExisting&&a){b.debug("found existing Galaxy object:",a);for(var c in a)a.hasOwnProperty(c)&&(b.debug(" patching in "+c+" to Galaxy"),b[c]=a[c])}},f.prototype._initLogger=function(a){var c=this;return c.debug("_initLogger:",a),c.logger=new b.MetricsLogger(a),c},f.prototype._initLocale=function(a){var b=this;return b.debug("_initLocale:",a),b.localize=d,window._l=b.localize,b},f.prototype._initUser=function(b){var c=this;return c.debug("_initUser:",b),c.user=new a.User(b),c.currUser=c.user,c},f.prototype._setUpListeners=function(){var a=this;return a.lastAjax={},$(document).bind("ajaxSend",function(b,c,d){var e=d.data;try{e=JSON.parse(e)}catch(f){}a.lastAjax={url:location.href.slice(0,-1)+d.url,data:e}}),a},f.prototype.toString=function(){var a=this.user.get("email")||"(anonymous)";return"GalaxyApp("+a+")"},{GalaxyApp:f}}); //# sourceMappingURL=../maps/galaxy-app-base.js.map \ No newline at end of file From e4c9f06d3bd319cc1addfdf3d6fd1f6e48e9e4f3 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Wed, 11 Nov 2015 11:37:21 +0000 Subject: [PATCH 08/13] Attempt to fix timing out tests. Continuation of work started by @nsoranzo here 92a152d89c507168a6085cc34acfa13566b6eda9. In addition to increasing the max timeout it will now print the timeout in the assertion error so we can see if it is being overridden and attempt to adjust timeouts too small. --- test/api/helpers.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/api/helpers.py b/test/api/helpers.py index ebe0d493046..98087760950 100644 --- a/test/api/helpers.py +++ b/test/api/helpers.py @@ -440,7 +440,7 @@ class DatasetCollectionPopulator( BaseDatasetCollectionPopulator ): return create_response -def wait_on_state( state_func, assert_ok=False, timeout=5 ): +def wait_on_state( state_func, assert_ok=False, timeout=DEFAULT_TIMEOUT ): def get_state( ): response = state_func() assert response.status_code == 200, "Failed to fetch state update while waiting." @@ -454,12 +454,16 @@ def wait_on_state( state_func, assert_ok=False, timeout=5 ): return wait_on( get_state, desc="state", timeout=timeout) -def wait_on( function, desc, timeout=5 ): +def wait_on( function, desc, timeout=DEFAULT_TIMEOUT ): delta = .25 iteration = 0 while True: - if (delta * iteration) > timeout: - assert False, "Timed out waiting on %s." % desc + total_wait = delta * iteration + if total_wait > timeout: + timeout_message = "Timed out after %s seconds waiting on %s." % ( + total_wait, desc + ) + assert False, timeout_message iteration += 1 value = function() if value is not None: From 177f73fcdb53ab4e172f7cf7f7a9950d4c842cd3 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Wed, 11 Nov 2015 14:43:51 +0000 Subject: [PATCH 09/13] Fix lower timeout caught by @nsoranzo. --- test/api/test_workflow_extraction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api/test_workflow_extraction.py b/test/api/test_workflow_extraction.py index 39cf87abba2..cf50590fc66 100644 --- a/test/api/test_workflow_extraction.py +++ b/test/api/test_workflow_extraction.py @@ -357,7 +357,7 @@ test_data: run_workflow_response = self._post( "workflows", data=workflow_request ) self._assert_status_code_is( run_workflow_response, 200 ) - self.dataset_populator.wait_for_history( history_id, assert_ok=True, timeout=10 ) + self.dataset_populator.wait_for_history( history_id, assert_ok=True ) return self.__cat_job_id( history_id ) def _assert_first_step_is_paired_input( self, downloaded_workflow ): From 559c89afde2bb8b2be28d52a9973b72aa6c03edf Mon Sep 17 00:00:00 2001 From: carlfeberhard Date: Mon, 19 Oct 2015 15:45:13 -0400 Subject: [PATCH 10/13] Testing: update casperjs functional tests; change expected size string; remove nice_size from expected history api keys; remove test for rerun button on uploaded dataset; attempt to fix linux+python unicode error in hda api tests --- test/casperjs/anon-history-tests.js | 2 +- test/casperjs/api-hda-tests.js | 2 +- test/casperjs/api-history-tests.js | 2 +- test/casperjs/hda-state-tests.js | 4 ++-- test/casperjs/history-panel-tests.js | 11 ++++++----- test/casperjs/modules/historypanel.js | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/test/casperjs/anon-history-tests.js b/test/casperjs/anon-history-tests.js index e2b2ccd0566..80e16a16f87 100644 --- a/test/casperjs/anon-history-tests.js +++ b/test/casperjs/anon-history-tests.js @@ -40,7 +40,7 @@ spaceghost.test.begin( 'Testing histories for anonymous users', 0, function suit this.test.assertVisible( nameSelector, 'History name is visible' ); this.test.assertSelectorHasText( nameSelector, unnamedName, 'History name is ' + unnamedName ); - this.test.comment( "history should display size and size should be 0 bytes" ); + this.test.comment( "history should display size and size should be " + initialSizeStr ); this.test.assertExists( sizeSelector, 'Found ' + sizeSelector ); this.test.assertVisible( sizeSelector, 'History size is visible' ); this.test.assertSelectorHasText( sizeSelector, initialSizeStr, diff --git a/test/casperjs/api-hda-tests.js b/test/casperjs/api-hda-tests.js index 882cd2c144e..8f0395a9567 100644 --- a/test/casperjs/api-hda-tests.js +++ b/test/casperjs/api-hda-tests.js @@ -124,7 +124,7 @@ spaceghost.test.begin( 'Test the HDA API', 0, function suite( test ){ //this.test.comment( 'update should sanitize any new name' ); this.test.comment( 'update should allow unicode in names' ); - var unicodeName = 'Ржевский сапоги'; + var unicodeName = 'ржевский сапоги'; returned = this.api.hdas.update( lastHistory.id, firstHda.id, { name : unicodeName }); diff --git a/test/casperjs/api-history-tests.js b/test/casperjs/api-history-tests.js index d97063cc739..31fdc2afa65 100644 --- a/test/casperjs/api-history-tests.js +++ b/test/casperjs/api-history-tests.js @@ -37,7 +37,7 @@ spaceghost.openHomePage().then( function(){ var historyShow = this.api.histories.show( firstHistory.id ); //this.debug( this.jsonStr( historyShow ) ); this.test.assert( this.hasKeys( historyShow, [ - 'id', 'name', 'annotation', 'nice_size', 'contents_url', + 'id', 'name', 'annotation', 'size', 'contents_url', 'state', 'state_details', 'state_ids' ]), 'Has the proper keys' ); diff --git a/test/casperjs/hda-state-tests.js b/test/casperjs/hda-state-tests.js index 3e13fac90ca..e1584885dec 100644 --- a/test/casperjs/hda-state-tests.js +++ b/test/casperjs/hda-state-tests.js @@ -173,8 +173,8 @@ spaceghost.test.begin( 'Test the form of various HDA states', 0, function suite( // different states, datatypes will have different action buttons testIconButton.call( this, hdaDbId, buttonsSelector, 'info', this.historypanel.data.hdaPrimaryActionButtons.info ); - testIconButton.call( this, hdaDbId, buttonsSelector, 'rerun', - this.historypanel.data.hdaPrimaryActionButtons.rerun ); + // testIconButton.call( this, hdaDbId, buttonsSelector, 'rerun', + // this.historypanel.data.hdaPrimaryActionButtons.rerun ); //TODO: move to testDownloadButton as its own step if( !expectedMetadataFiles ){ diff --git a/test/casperjs/history-panel-tests.js b/test/casperjs/history-panel-tests.js index 9e78b3b7fd7..bf6488b9a48 100644 --- a/test/casperjs/history-panel-tests.js +++ b/test/casperjs/history-panel-tests.js @@ -33,12 +33,13 @@ spaceghost.test.begin( 'Testing the form of the main/current history panel', 0, annoIconSelector = spaceghost.historypanel.data.selectors.history.annoIcon, emptyMsgSelector = spaceghost.historypanel.data.selectors.history.emptyMsg, emptyMsgStr = spaceghost.historypanel.data.text.history.emptyMsg, - tagAreaSelector = spaceghost.historypanel.data.selectors.history.tagArea, - annoAreaSelector = spaceghost.historypanel.data.selectors.history.annoArea, + tagAreaSelector = spaceghost.historypanel.data.selectors.history.tagArea, + annoAreaSelector = spaceghost.historypanel.data.selectors.history.annoArea, nameTooltip = spaceghost.historypanel.data.text.history.tooltips.name, refreshButtonSelector = 'a#history-refresh-button', - refreshButtonIconSelector = 'span.fa-refresh'; + refreshButtonIconSelector = 'span.fa-refresh', + bytesString = 'b'; // local var newHistoryName = "Test History", @@ -145,8 +146,8 @@ spaceghost.test.begin( 'Testing the form of the main/current history panel', 0, this.test.assertSelectorHasText( nameSelector, newHistoryName, 'History name is ' + newHistoryName ); var onetxtFilesize = require( 'fs' ).size( filepathToUpload ), - expectedSize = onetxtFilesize + ' bytes'; - this.test.comment( "history should display size and size should be " + onetxtFilesize + " bytes" ); + expectedSize = onetxtFilesize + ' ' + bytesString; + this.test.comment( "history should display size and size should be " + onetxtFilesize + " " + bytesString ); this.test.assertExists( sizeSelector, 'Found ' + sizeSelector ); this.test.assertVisible( sizeSelector, 'History size is visible' ); this.test.assertSelectorHasText( sizeSelector, expectedSize, diff --git a/test/casperjs/modules/historypanel.js b/test/casperjs/modules/historypanel.js index 0067a2d01a2..963bafd340e 100644 --- a/test/casperjs/modules/historypanel.js +++ b/test/casperjs/modules/historypanel.js @@ -414,7 +414,7 @@ HistoryPanel.prototype.data = { annoIcon : 'Edit history annotation' }, newName : 'Unnamed history', - newSize : '0 bytes', + newSize : '0 b', emptyMsg : "This history is empty. You can load your own data or get data from an external source" }, hda : { From d824cca31fcebe97b8c7cfd1040eecbb9e5f03d3 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Thu, 12 Nov 2015 16:56:16 -0500 Subject: [PATCH 11/13] In interactive environments, the /import volume can now be made conditional. Also, fix a bug when using a proxy for the node proxy and cookie_path is / --- .../ipython/config/ipython.ini.sample | 2 +- .../ipython/templates/ipython.mako | 19 +++++-------------- .../web/base/interactive_environments.py | 12 +++++++++--- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/config/plugins/interactive_environments/ipython/config/ipython.ini.sample b/config/plugins/interactive_environments/ipython/config/ipython.ini.sample index 01926333c51..17ea7128a89 100644 --- a/config/plugins/interactive_environments/ipython/config/ipython.ini.sample +++ b/config/plugins/interactive_environments/ipython/config/ipython.ini.sample @@ -17,7 +17,7 @@ #command = docker {docker_args} # The docker image name that should be started. -image = bgruening/docker-ipython-notebook:15.10 +image = bgruening/docker-ipython-notebook:15.10-1 # Additional arguments that are passed to the `docker run` command. #command_inject = --sig-proxy=true -e DEBUG=false diff --git a/config/plugins/interactive_environments/ipython/templates/ipython.mako b/config/plugins/interactive_environments/ipython/templates/ipython.mako index 2e87c5ae221..3c3686735c5 100644 --- a/config/plugins/interactive_environments/ipython/templates/ipython.mako +++ b/config/plugins/interactive_environments/ipython/templates/ipython.mako @@ -8,8 +8,7 @@ import hashlib # Sets ID and sets up a lot of other variables ie_request.load_deploy_config() ie_request.attr.docker_port = 6789 -# Create tempdir in galaxy -temp_dir = ie_request.temp_dir +ie_request.attr.import_volume = False if ie_request.attr.PASSWORD_AUTH: m = hashlib.sha1() @@ -19,23 +18,15 @@ else: PASSWORD = "none" ## IPython Specific -# Prepare an empty notebook -notebook_id = ie_request.generate_hex(64) -with open( os.path.join( ie_request.attr.our_template_dir, 'notebook.ipynb' ), 'r') as nb_handle: - empty_nb = nb_handle.read() -empty_nb = empty_nb % notebook_id -# Copy over default notebook, unless the dataset this viz is running on is a notebook -empty_nb_path = os.path.join(temp_dir, 'ipython_galaxy_notebook.ipynb') - -if hda.datatype.__class__.__name__ != "Ipynb": - with open( empty_nb_path, 'w+' ) as handle: - handle.write( empty_nb ) +if hda.datatype.__class__.__name__ == "Ipynb": + DATASET_HID = hda.hid else: - shutil.copy( hda.file_name, empty_nb_path ) + DATASET_HID = None # Add all environment variables collected from Galaxy's IE infrastructure ie_request.launch(env_override={ 'notebook_password': PASSWORD, + 'dataset_hid': DATASET_HID, }) ## General IE specific diff --git a/lib/galaxy/web/base/interactive_environments.py b/lib/galaxy/web/base/interactive_environments.py index 52c5886f569..9967d83a519 100644 --- a/lib/galaxy/web/base/interactive_environments.py +++ b/lib/galaxy/web/base/interactive_environments.py @@ -31,6 +31,7 @@ class InteractiveEnviornmentRequest(object): self.attr.galaxy_root_dir = os.path.abspath(self.attr.galaxy_config.root) self.attr.root = web.url_for("/") self.attr.app_root = self.attr.root + "plugins/interactive_environments/" + self.attr.viz_id + "/static/" + self.attr.import_volume = True plugin_path = os.path.abspath( plugin.path ) @@ -60,8 +61,12 @@ class InteractiveEnviornmentRequest(object): # This duplicates the logic in the proxy manager if self.attr.galaxy_config.dynamic_proxy_external_proxy: - self.attr.proxy_prefix = '%s/%s' % ( + slash = '/' + if self.attr.galaxy_config.cookie_path.endswith('/'): + slash = '' + self.attr.proxy_prefix = '%s%s%s' % ( self.attr.galaxy_config.cookie_path, + slash, self.attr.galaxy_config.dynamic_proxy_prefix) else: self.attr.proxy_prefix = '' @@ -184,18 +189,19 @@ class InteractiveEnviornmentRequest(object): conf.update(env_override) env_str = ' '.join(['-e "%s=%s"' % (key.upper(), item) for key, item in conf.items()]) volume_str = ' '.join(['-v "%s"' % volume for volume in volumes]) + import_volume_str = '-v "{temp_dir}:/import/"'.format(temp_dir=temp_dir) if self.attr.import_volume else '' # This is the basic docker command such as "sudo -u docker docker {docker_args}" # or just "docker {docker_args}" command = self.attr.viz_config.get("docker", "command") # Then we format in the entire docker command in place of # {docker_args}, so as to let the admin not worry about which args are # getting passed - command = command.format(docker_args='run {command_inject} {environment} -d -P -v "{temp_dir}:/import/" {volume_str} {image}') + command = command.format(docker_args='run {command_inject} {environment} -d -P {import_volume_str} {volume_str} {image}') # Once that's available, we format again with all of our arguments command = command.format( command_inject=self.attr.viz_config.get("docker", "command_inject"), environment=env_str, - temp_dir=temp_dir, + import_volume_str=import_volume_str, volume_str=volume_str, image=self.attr.viz_config.get("docker", "image") ) From c4351413265796dacc15b8e3fc7382b8514f5b59 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Fri, 13 Nov 2015 10:55:25 -0500 Subject: [PATCH 12/13] Built image tag differs from intended. --- .../interactive_environments/ipython/config/ipython.ini.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/plugins/interactive_environments/ipython/config/ipython.ini.sample b/config/plugins/interactive_environments/ipython/config/ipython.ini.sample index 17ea7128a89..95f4430c17a 100644 --- a/config/plugins/interactive_environments/ipython/config/ipython.ini.sample +++ b/config/plugins/interactive_environments/ipython/config/ipython.ini.sample @@ -17,7 +17,7 @@ #command = docker {docker_args} # The docker image name that should be started. -image = bgruening/docker-ipython-notebook:15.10-1 +image = bgruening/docker-ipython-notebook:15.10.1 # Additional arguments that are passed to the `docker run` command. #command_inject = --sig-proxy=true -e DEBUG=false From 75e7e4c2cf7a0cb18b8096c8119e4b0cb207e2a3 Mon Sep 17 00:00:00 2001 From: Dave B Date: Fri, 13 Nov 2015 11:50:22 -0500 Subject: [PATCH 13/13] Fix 500 error when attempting to update installed repository. --- lib/galaxy/webapps/tool_shed/framework/middleware/hg.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/webapps/tool_shed/framework/middleware/hg.py b/lib/galaxy/webapps/tool_shed/framework/middleware/hg.py index 9248b9adb1b..184710662ed 100644 --- a/lib/galaxy/webapps/tool_shed/framework/middleware/hg.py +++ b/lib/galaxy/webapps/tool_shed/framework/middleware/hg.py @@ -5,6 +5,7 @@ import os import sqlalchemy import sys import tempfile +import urlparse from paste.auth.basic import AuthBasicAuthenticator from paste.httpheaders import AUTH_TYPE from paste.httpheaders import REMOTE_USER @@ -51,11 +52,11 @@ class Hg( object ): # a clone or a pull. However, we do not want to increment the times_downloaded count if we're only setting repository # metadata. if cmd == 'getbundle' and not self.setting_repository_metadata: - common, _ = environ[ 'HTTP_X_HGARG_1' ].split( '&' ) + hg_args = urlparse.parse_qs( environ[ 'HTTP_X_HGARG_1' ] ) # The 'common' parameter indicates the full sha-1 hash of the changeset the client currently has checked out. If # this is 0000000000000000000000000000000000000000, then the client is performing a fresh checkout. If it has any # other value, the client is getting updates to an existing checkout. - if common == 'common=0000000000000000000000000000000000000000': + if 'common' in hg_args and hg_args[ 'common' ][-1] == '0000000000000000000000000000000000000000': # Increment the value of the times_downloaded column in the repository table for the cloned repository. if 'PATH_INFO' in environ: # Instantiate a database connection