Commit 8c26e017 authored by Jerome Mariette's avatar Jerome Mariette

add metadata to workflows

parent acf92a91
......@@ -94,6 +94,7 @@ class JFlowServer (object):
"completed": status_info["completed"]})
status = {"id":utils.get_nb_string(workflow.id),
"name": workflow.name,
"metadata": workflow.metadata,
"status": workflow.get_status(),
"elapsed_time": str(elapsed_time),
"start_time": start_time,
......@@ -146,7 +147,17 @@ class JFlowServer (object):
status = []
workflows = self.wfmanager.get_workflows()
for workflow in workflows:
status.append(self.jsonify_workflow_status(workflow))
if kwargs.has_key("metadata_filter"):
is_ok = False
for wf_meta in workflow.metadata:
for metadata in kwargs["metadata_filter"].split(","):
if wf_meta == metadata:
is_ok = True
break
if is_ok: break
if is_ok: status.append(self.jsonify_workflow_status(workflow))
else:
status.append(self.jsonify_workflow_status(workflow))
return status
......
......@@ -90,6 +90,7 @@ class Workflow(threading.Thread):
self.id = id
self.args = self._extend_and_format_args(args)
self.metadata = self.args["metadata"]
if self.id is not None:
self.directory = self.manager.get_workflow_directory(self.name, self.id)
if not os.path.isdir(self.directory):
......@@ -239,7 +240,7 @@ class Workflow(threading.Thread):
parameters = []
try:
params = {}
# First grab all parameters name
# first grab all parameters name
for param in reader.items("parameters"):
cvalue = reader.get("parameters", param[0])
cparam = param[0].split(".")[0]
......@@ -253,6 +254,9 @@ class Workflow(threading.Thread):
parameters.append(oparam)
except:
pass
# finally add the metadata parameter
metadata = Parameter("metadata", "--metadata", "Which metadata should be linked to this workflow", action="append")
parameters.append(metadata)
return [reader.get("global", "name"),
reader.get("global", "description"),
parameters]
......
......@@ -45,10 +45,15 @@
'<div class="blockG" id="rotateG_06"></div>',
'<div class="blockG" id="rotateG_07"></div>',
'<div class="blockG" id="rotateG_08"></div>',
'</div></div> <div class="span6">Please wait until modul is being loaded!</div></div>'].join('\n');
'</div></div> <div class="span6">Please wait until modul is being loaded!</div></div>'].join('\n'),
url = this.options.serverURL + '/get_workflows_status?';
if (this.options.metadataFilter.length > 0) {
url += 'metadata_filter='+this.options.metadataFilter.join(',')+'&';
}
url += 'callback=?';
$this.$element.html(waiting_animation);
$.ajax({
url: this.options.serverURL + '/get_workflows_status?callback=?',
url: url,
dataType: "json",
timeout: 20000,
error: function (xhr, ajaxOptions, thrownError) {
......@@ -125,7 +130,8 @@
'</tr>',
'{{/each}}',
'</table>',
'<p class="text-right"><button class="btn" id="activewf_refresh_btn" href="#"><i class="icon-refresh"></i> Refresh</button></p>'].join('\n')
'<p class="text-right"><button class="btn" id="activewf_refresh_btn" href="#"><i class="icon-refresh"></i> Refresh</button></p>'].join('\n'),
metadataFilter: []
}
$.fn.activewf.Constructor = ActiveWF
......
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