Commit 7fa2365e authored by Jerome Mariette's avatar Jerome Mariette

add display_name option

parent dc431124
......@@ -117,7 +117,8 @@ class JFlowServer (object):
"choices": param.choices,
"action": param.action,
"type": param.get_type(),
"name": param.name})
"name": param.name,
"display_name": param.display_name})
workflows.append({"name": instance.name,
"help": instance.description,
"class": instance.__class__.__name__,
......
......@@ -72,7 +72,7 @@ class Parameter(object):
"""
def __init__(self, name, help, flag, default=None, type=types.StringType, choices=None,
required=False, action="store", sub_parameters=[], group="default"):
required=False, action="store", sub_parameters=[], group="default", display_name=None):
self.name = name
self.flag = flag
......@@ -81,6 +81,9 @@ class Parameter(object):
self.nargs = None
self.sub_parameters = sub_parameters
self.group = group
if display_name == None:
self.display_name = name
else: self.display_name = display_name
if len(self.sub_parameters) > 0:
self.nargs = "+"
......
......@@ -328,6 +328,7 @@ class Workflow(threading.Thread):
else:
params[cparam][ckey] = cvalue
if cparam not in param_order: param_order.append(cparam)
for param_name in param_order:
sub_params, current_params, sub_objs = {}, {}, []
for param in params[param_name]:
......@@ -338,7 +339,10 @@ class Workflow(threading.Thread):
else:
sub_params[sub_params_values[0]][sub_params_values[1]] = params[param_name][param]
else:
if param == "name": current_params["display_name"] = params[param_name]["name"]
else: current_params[param] = params[param_name][param]
current_params[param] = params[param_name][param]
current_params["name"] = param_name
if sub_order.has_key(param_name):
for sub_param in sub_order[param_name]:
sub = Parameter(**sub_params[sub_param])
......@@ -349,7 +353,8 @@ class Workflow(threading.Thread):
except:
pass
# finally add the metadata parameter
metadata = Parameter(name="metadata", flag="--metadata", help="Which metadata should be linked to this workflow", action="append")
metadata = Parameter(name="metadata", flag="--metadata", help="Which metadata should be linked to this workflow",
action="append", display_name="Metadata")
parameters.append(metadata)
return [reader.get("global", "name"),
reader.get("global", "description"),
......
......@@ -208,7 +208,7 @@
// it the parameter has ne already been settled
' {{if Object.keys(parameters).indexOf(param.name) == -1 }}',
' <div class="control-group">',
' <label class="control-label">${param.name}</label>',
' <label class="control-label">${param.display_name}</label>',
' <div class="controls">',
// if it's a multiple choice parameter, add a select
' {{if param.choices}}',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment