diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 65a277b4a30..10eebf00b9f 100644 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -295,6 +295,8 @@ class Tool: self.is_multi_byte = util.string_as_bool( root.get( "is_multi_byte", False ) ) # Type of tool self.tool_type = root.get( "tool_type", None ) + #Force history to fully refresh after job execution for this tool. Useful i.e. when an indeterminate number of outputs are created by a tool. + self.force_history_refresh = util.string_as_bool( root.get( 'force_history_refresh', 'False' ) ) # data_source tool if self.tool_type == "data_source": self.URL_method = root.get( "URL_method", "get" ) # get is the default diff --git a/lib/galaxy/web/controllers/root.py b/lib/galaxy/web/controllers/root.py index e04efdcedd7..a2ce03c7065 100644 --- a/lib/galaxy/web/controllers/root.py +++ b/lib/galaxy/web/controllers/root.py @@ -114,9 +114,16 @@ class RootController( BaseController ): for id, state in zip( ids, states ): data = self.app.model.HistoryDatasetAssociation.get( id ) if data.state != state: + job_hda = data + while job_hda.copied_from_history_dataset_association: + job_hda = job_hda.copied_from_history_dataset_association + force_history_refresh = False + if job_hda.creating_job_associations: + force_history_refresh = trans.app.toolbox.tools_by_id[ job_hda.creating_job_associations[ 0 ].job.tool_id ].force_history_refresh rval[id] = { "state": data.state, - "html": unicode( trans.fill_template( "root/history_item.mako", data=data, hid=data.hid ), 'utf-8' ) + "html": unicode( trans.fill_template( "root/history_item.mako", data=data, hid=data.hid ), 'utf-8' ), + "force_history_refresh": force_history_refresh } return rval diff --git a/templates/root/history.mako b/templates/root/history.mako index 2fa56d1d84a..21bd60dddae 100644 --- a/templates/root/history.mako +++ b/templates/root/history.mako @@ -186,6 +186,7 @@ ${h.js( "jquery", "jquery.cookie", "cookie_set" )} // Build request data var ids = [] var states = [] + var force_history_refresh = false $.each( tracked_datasets, function ( id, state ) { ids.push( id ); states.push( state ); @@ -205,13 +206,21 @@ ${h.js( "jquery", "jquery.cookie", "cookie_set" )} initShowHide(); // If new state was terminal, stop tracking if (( val.state == "ok") || ( val.state == "error") || ( val.state == "empty") || ( val.state == "deleted" ) || ( val.state == "discarded" )) { + if ( val.force_history_refresh ){ + force_history_refresh = true; + } delete tracked_datasets[ parseInt(id) ]; } else { tracked_datasets[ parseInt(id) ] = val.state; } }); - // Keep going (if there are still any items to track) - updater( tracked_datasets ); + if ( force_history_refresh ) { + parent.frames.galaxy_history.location.reload(); + } + else { + // Keep going (if there are still any items to track) + updater( tracked_datasets ); + } }, error: function() { // Just retry, like the old method, should try to be smarter