Commit 6a1b2f9d authored by Jerome Mariette's avatar Jerome Mariette

save

parent e78caf5e
......@@ -145,7 +145,10 @@
}
});*/
$("#available-workflows-list").wfform({
workflow_class: "AddRun"
workflow_class: "AddProject",
callback: function(workflow_id) {
alert(workflow_id);
}
});
$("#active-workflows-list").activewf({
callback: function(workflow) {
......
......@@ -38,7 +38,18 @@
}
WFForm.prototype.run = function() {
alert("running")
var params = "",
$this = this;
$.each ( $('#workflow_form').serializeArray(), function(_, kv) {
params += kv.name + "=" +kv.value + "&";
});
$.ajax({
url: this.options.serverURL + '/run_workflow?' + params + 'callback=?',
dataType: "json",
success: function(data) {
$this.options.callback(data.workflow_id);
}
});
}
WFForm.prototype.load = function() {
......@@ -54,7 +65,14 @@
break;
}
}
$.tmpl($this.options.template, {workflow: workflow}).appendTo($this.$element);
$.tmpl($this.options.template, {workflow: workflow, display_run_button: $this.options.display_run_button,
display_reset_button: $this.options.display_reset_button}).appendTo($this.$element);
if ($this.options.display_run_button) {
$("#wfform_run_btn").click(function() { $this.run(); })
}
if ($this.options.display_reset_button) {
$("#wfform_reset_btn").click(function() { $this.reset(); })
}
}
});
}
......@@ -104,9 +122,22 @@
' {{/each}}',
// for all workflow add the workflow_class
' <input name="workflow_class" value="${workflow.class}" type="hidden">',
// add buttons if requested
' <div class="control-group">',
' <label class="control-label"></label>',
' <div class="controls">',
' {{if display_reset_button}}',
' <button id="wfform_reset_btn" class="btn" type="button"><i class="icon-refresh"></i> Reset</button>',
' {{/if}}',
' {{if display_run_button}}',
' <button id="wfform_run_btn" class="btn btn-primary" type="button"><i class="icon-white icon-cog"></i> Run</button>',
' {{/if}}',
' </div>',
' </div>',
'</fieldset>',
'</form>'].join('\n'),
workflow_class: null,
callback: function(workflow_id) {},
display_run_button: true,
display_reset_button: true
}
......
......@@ -129,7 +129,8 @@ class JFlowServer (object):
@jsonify
def run_workflow(self, **kwargs):
args = self.extend_parameters(kwargs["workflow_class"], kwargs)
self.wfmanager.run_workflow(kwargs["workflow_class"], args)
workflow_id = self.wfmanager.run_workflow(kwargs["workflow_class"], args)
return {"workflow_id": workflow_id}
@cherrypy.expose
@jsonify
......
......@@ -65,8 +65,9 @@ class WorkflowsManager(object):
__import__(modname)
# Search for Workflow classes
for class_name, obj in inspect.getmembers(sys.modules[modname], inspect.isclass):
if class_name == workflow_class: workflow = obj(args)
if class_name == workflow_class: workflow = obj(args, id=self.get_next_id())
workflow.start()
return workflow.id
def get_output_directory(self):
return self.config_reader.get_work_directory()
......
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