Commit 72f4c644 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

delete callback function, trigger events instead which is much better

parent 1002f0c7
......@@ -152,38 +152,38 @@
/**
* Use the plugins
*/
$("#available-workflows-list").availablewf({
callback: function(workflow) {
$('#setAndRunModalLabel').html(workflow["name"] + " <small>" + workflow["help"] + "</small>");
$('#setAndRunModalBody').wfform({
workflowClass: workflow["class"],
displayRunButton: false,
displayResetButton: false,
callback: function(running_wf) {
$('#setAndRunModal').modal('hide');
$('#statusModalLabel').html(running_wf["name"] + " <small>" + running_wf["id"] + "</small>");
$('#statusModalBody').wfstatus({
workflowID: running_wf.id,
forceUsingWorkflow: running_wf
});
$('#statusModal').modal();
$("#active-workflows-list").activewf('reload');
}
$("#available-workflows-list").availablewf();
$("#available-workflows-list").on('select', function(event, workflow) {
$('#setAndRunModalLabel').html(workflow["name"] + " <small>" + workflow["help"] + "</small>");
$('#setAndRunModalBody').wfform({
workflowClass: workflow["class"],
displayRunButton: false,
displayResetButton: false
});
$('#setAndRunModalBody').on('run', function(event, running_wf) {
$('#setAndRunModal').modal('hide');
$('#statusModalLabel').html(running_wf["name"] + " <small>" + running_wf["id"] + "</small>");
$('#statusModalBody').wfstatus({
workflowID: running_wf.id,
forceUsingWorkflow: running_wf
});
$('#setAndRunModal').modal();
}
$('#statusModal').modal();
$("#active-workflows-list").activewf('reload');
});
$('#setAndRunModal').modal();
});
$("#refresh_workflow").click(function(){ $('#statusModalBody').wfstatus('reload'); });
$("#reset_workflow").click(function(){ $('#setAndRunModalBody').wfform('reset'); });
$("#run_workflow").click(function(){ $('#setAndRunModalBody').wfform('run'); });
$("#active-workflows-list").activewf({
callback: function(workflow) {
$('#statusModalLabel').html(workflow["name"] + " <small>" + workflow["id"] + "</small>");
$('#statusModalBody').wfstatus({
workflowID: workflow["id"]
});
$('#statusModal').modal();
}
$("#active-workflows-list").activewf();
$("#active-workflows-list").on("select", function(event, workflow) {
$('#statusModalLabel').html(workflow["name"] + " <small>" + workflow["id"] + "</small>");
$('#statusModalBody').wfstatus({
workflowID: workflow["id"]
});
$('#statusModal').modal();
});
/**
......
......@@ -67,7 +67,7 @@
$.tmpl($this.options.template, {workflows: data}).appendTo($this.$element);
$("[id^=activewf_btn_]").click(function(){
var workflow_id = $(this).attr("id").split("activewf_btn_")[1];
$this.options.callback(workflow_by_id[workflow_id]);
$this.$element.trigger('select', workflow_by_id[workflow_id]);
});
$("#activewf_refresh_btn").click(function(){
$this.reload();
......@@ -125,8 +125,7 @@
'</tr>',
'{{/each}}',
'</table>',
'<p class="text-right"><a class="btn" id="activewf_refresh_btn" href="#"><i class="icon-refresh"></i> Refresh</a></p>'].join('\n'),
callback: function(workflow) {}
'<p class="text-right"><a class="btn" id="activewf_refresh_btn" href="#"><i class="icon-refresh"></i> Refresh</a></p>'].join('\n')
}
$.fn.activewf.Constructor = ActiveWF
......
......@@ -67,7 +67,7 @@
$.tmpl($this.options.template, {workflows: data}).appendTo($this.$element);
$("[id^=availablewf_btn_]").click(function(){
var workflow_class = $(this).attr("id").split("availablewf_btn_")[1];
$this.options.callback(workflow_by_class[workflow_class]);
$this.$element.trigger('select', workflow_by_class[workflow_class]);
});
}
});
......@@ -104,8 +104,7 @@
'<td>${workflow.help}</td>',
'</tr>',
'{{/each}}',
'</dl>'].join('\n'),
callback: function(workflow) {}
'</dl>'].join('\n')
}
$.fn.availablewf.Constructor = AvailableWF
......
......@@ -101,7 +101,7 @@
url: this.options.serverURL + '/run_workflow?' + params + 'callback=?',
dataType: "json",
success: function(running_wf) {
$this.options.callback(running_wf);
$this.$element.trigger('run', running_wf);
}
});
}
......@@ -254,7 +254,6 @@
'</fieldset>',
'</form>'].join('\n'),
workflowClass: null,
callback: function(running_wf) {},
displayRunButton: true,
displayResetButton: true
}
......
Supports Markdown
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