From 106c663e1a53cd27dc174b7a306146a4467e3e07 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Mon, 27 Jul 2009 15:55:32 -0400 Subject: [PATCH] A new flag, force_history_refresh, has been added to Tool Configurations. When set to "True", this flag will cause the entire history to reload when one of its outputs has finished running. Default is False. This is useful, i.e., when a tool creates an indeterminate number of output datasets by dumping them into new_file_path. Example: ... --- lib/galaxy/tools/__init__.py | 2 ++ lib/galaxy/web/controllers/root.py | 9 ++++++++- templates/root/history.mako | 13 +++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) 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