Merge pull request #256 from dannon/release_15.05

[15.05] Fix workflow parameter/action display
This commit is contained in:
Nate Coraor
2015-05-13 16:54:34 -04:00
2 changed files with 16 additions and 9 deletions
+13 -7
View File
@@ -8,6 +8,9 @@ import logging
import socket
from galaxy.util import send_mail
from galaxy.util.json import dumps
from galaxy import eggs
eggs.require( "MarkupSafe" )
from markupsafe import escape
log = logging.getLogger( __name__ )
@@ -50,7 +53,7 @@ class DefaultJobAction(object):
@classmethod
def get_short_str(cls, pja):
if pja.action_arguments:
return "%s -> %s" % (pja.action_type, pja.action_arguments)
return "%s -> %s" % (pja.action_type, escape(pja.action_arguments))
else:
return "%s" % pja.action_type
@@ -91,7 +94,7 @@ class EmailAction(DefaultJobAction):
@classmethod
def get_short_str(cls, pja):
if pja.action_arguments and 'host' in pja.action_arguments:
return "Email the current user from server %s when this job is complete." % pja.action_arguments['host']
return "Email the current user from server %s when this job is complete." % escape(pja.action_arguments['host'])
else:
return "Email the current user when this job is complete."
@@ -127,7 +130,8 @@ class ChangeDatatypeAction(DefaultJobAction):
@classmethod
def get_short_str(cls, pja):
return "Set the datatype of output '%s' to '%s'" % (pja.output_name, pja.action_arguments['newtype'])
return "Set the datatype of output '%s' to '%s'" % (escape(pja.output_name),
escape(pja.action_arguments['newtype']))
class RenameDatasetAction(DefaultJobAction):
@@ -235,7 +239,8 @@ class RenameDatasetAction(DefaultJobAction):
def get_short_str(cls, pja):
# Prevent renaming a dataset to the empty string.
if pja.action_arguments and pja.action_arguments.get('newname', ''):
return "Rename output '%s' to '%s'." % (pja.output_name, pja.action_arguments['newname'])
return "Rename output '%s' to '%s'." % (escape(pja.output_name),
escape(pja.action_arguments['newname']))
else:
return "Rename action used without a new name specified. Output name will be unchanged."
@@ -260,7 +265,7 @@ class HideDatasetAction(DefaultJobAction):
@classmethod
def get_short_str(cls, pja):
return "Hide output '%s'." % pja.output_name
return "Hide output '%s'." % escape(pja.output_name)
class DeleteDatasetAction(DefaultJobAction):
@@ -336,7 +341,7 @@ class ColumnSetAction(DefaultJobAction):
@classmethod
def get_short_str(cls, pja):
return "Set the following metadata values:<br/>" + "<br/>".join(['%s : %s' % (k, v) for k, v in pja.action_arguments.iteritems()])
return "Set the following metadata values:<br/>" + "<br/>".join(['%s : %s' % (escape(k), escape(v)) for k, v in pja.action_arguments.iteritems()])
class SetMetadataAction(DefaultJobAction):
@@ -455,7 +460,8 @@ class TagDatasetAction(DefaultJobAction):
@classmethod
def get_short_str(cls, pja):
if pja.action_arguments and pja.action_arguments.get('tags', ''):
return "Add tag(s) '%s' to '%s'." % (pja.action_arguments['tags'], pja.output_name)
return "Add tag(s) '%s' to '%s'." % (escape(pja.action_arguments['tags']),
escape(pja.output_name))
else:
return "Tag addition action used without a tag specified. No tag will be added."
+3 -2
View File
@@ -583,9 +583,10 @@ if wf_parms:
<%
pja_ss_all = []
for pja_ss in [ActionBox.get_short_str(pja) for pja in step.post_job_actions]:
pja_ss = h.escape( pja_ss )
for rematch in re.findall('\$\{.+?\}', pja_ss):
pja_ss = pja_ss.replace(rematch, '<span style="background-color:%s" class="wfpspan wf_parm__%s pja_wfp">%s</span>' % (wf_parms[rematch[2:-1]], rematch[2:-1], rematch[2:-1]))
pja_ss = pja_ss.replace(rematch, '<span style="background-color:%s" class="wfpspan wf_parm__%s pja_wfp">%s</span>' % (wf_parms[rematch[2:-1]],
rematch[2:-1],
rematch[2:-1]))
pja_ss_all.append(pja_ss)
%>
${'<br/>'.join(pja_ss_all)}