Commit 3a0916f5 authored by Jerome Mariette's avatar Jerome Mariette

save

parent 8b091c2d
......@@ -96,7 +96,7 @@
</div>
<div id="statusModalBody" class="modal-body"></div>
<div class="modal-footer">
<button class="btn"><i class="icon-refresh"></i> Reset</button>
<button id="refresh_workflow" class="btn"><i class="icon-refresh"></i> Refresh</button>
<button id="rerun_workflow" class="btn btn-primary"><i class="icon-cog icon-white"></i> ReRun</button>
</div>
</div>
......@@ -129,6 +129,7 @@
<script src='jflow-activewf.js' type='text/javascript'></script>
<script src='jflow-availablewf.js' type='text/javascript'></script>
<script src='jflow-wfform.js' type='text/javascript'></script>
<script src='jflow-wfstatus.js' type='text/javascript'></script>
<script type='text/javascript'>
......@@ -141,7 +142,15 @@
displayRunButton: false,
displayResetButton: false,
callback: function(workflow_id) {
alert(workflow_id);
$('#setAndRunModal').modal('hide');
$('#statusModalLabel').html(workflow_id);
$('#statusModalBody').wfstatus({
workflowID: workflow_id
});
$('#statusModal').modal();
$("#refresh_workflow").click(function(){
$('#statusModalBody').wfstatus('reload');
});
$("#active-workflows-list").activewf('reload');
}
});
......@@ -152,15 +161,18 @@
});
$("#active-workflows-list").activewf({
callback: function(workflow) {
alert(workflow["name"])
$('#statusModalLabel').html(workflow["name"] + " <small>" + workflow["id"] + "</small>");
$('#statusModalBody').wfstatus({
workflowID: workflow["id"]
});
$('#statusModal').modal();
$("#refresh_workflow").click(function(){
$('#statusModalBody').wfstatus('reload');
});
}
});
});
});
</script>
</body>
......
......@@ -88,7 +88,7 @@
, data = $this.data('wfform')
, options = $.extend({}, $.fn.wfform.defaults, typeof option == 'object' && option)
, action = typeof option == 'string' ? option : null
// if already exist, ok
// if already exist
if (!data) { $this.data('wfform', (data = new WFForm(this, options))) }
// otherwise change the workflow class
else { data.options.workflowClass = options.workflowClass }
......
/***************************************************************
* Copyright notice
*
* (c) 2013 PF bioinformatique de Toulouse
* All rights reserved
*
* It is distributed under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
!function ($) {
"use strict"; // jshint ;_;
/* WFStatus CLASS DEFINITION
* ========================= */
var WFStatus = function (element, options) {
this.$element = $(element);
this.options = $.extend({}, $.fn.wfstatus.defaults, options);
this.reload();
}
WFStatus.prototype.reload = function() {
var $this = this,
params = "";
if (this.options.workflowID) { params = "workflow_id=" + this.options.workflowID + "&"; }
$.ajax({
url: this.options.serverURL + '/get_workflows_status?'+params+'callback=?',
dataType: "json",
success: function(data) {
var workflow = {
name: data.name,
status: data.status,
elapsed_time: data.elapsed_time,
end_time: data.end_time,
id: data.id,
start_time: data.start_time,
components: new Array()
};
for (var i in data.components) {
var failed = parseInt(((parseInt(data.components[i].aborted) + parseInt(data.components[i].failed)) * 100) / parseInt(data.components[i].total)),
completed = parseInt((parseInt(data.components[i].completed) * 100) / parseInt(data.components[i].total)),
running = parseInt((parseInt(data.components[i].running) * 100) / parseInt(data.components[i].total)),
waiting = parseInt((parseInt(data.components[i].waiting) * 100) / parseInt(data.components[i].total));
workflow.components.push({
name: data.components[i].name,
elapsed_time: data.components[i].elapsed_time,
failed: failed,
running: running,
completed: completed,
waiting: waiting
});
}
$this.$element.html("");
$.tmpl($this.options.template, {workflow: workflow}).appendTo($this.$element);
}
});
}
/* WFStatus PLUGIN DEFINITION
* ========================== */
var old = $.fn.wfstatus
$.fn.wfstatus = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('wfstatus')
, options = $.extend({}, $.fn.wfstatus.defaults, typeof option == 'object' && option)
, action = typeof option == 'string' ? option : null
// if already exist
if (!data) $this.data('wfstatus', (data = new WFStatus(this, options)))
// otherwise change the workflow class
else if (options.workflowID) { data.options.workflowID = options.workflowID }
if (action) { data[action]() }
else { data.reload(); }
})
}
$.fn.wfstatus.defaults = {
serverURL: "http://localhost:8080",
template: ['<dl class="dl-horizontal">',
'<dt>Start</dt>',
'<dd>${workflow.start_time}</dd>',
'<dt>End</dt>',
'<dd>${workflow.end_time}</dd>',
'<dt>Elapsed time</dt>',
'<dd>${workflow.elapsed_time}</dd>',
'<br/>',
'{{each(index, component) workflow.components}}',
'<dt>${component.name}</dt>',
'<dd>',
'<div class="progress">',
'<div class="bar bar-success" style="width: ${component.completed}%;"></div>',
'<div class="bar bar-danger" style="width: ${component.failed}%;"></div>',
'<div class="bar bar-warning" style="width: ${component.waiting}%;"></div>',
'<div class="bar" style="width: ${component.running}%;"></div>',
'</div>',
'</dd>',
'{{/each}}',
'</dl>'].join('\n'),
workflowID: null
}
$.fn.wfstatus.Constructor = WFStatus
}(window.jQuery);
\ No newline at end of file
......@@ -96,12 +96,14 @@ class JFlowServer (object):
# if it's an append parameter, the result should be a list
if param.action == "append":
if kwargs.has_key(param.name):
extended_kwargs[param.name] = kwargs[param.name].split(",")
value = kwargs[param.name].encode('ascii','ignore')
extended_kwargs[param.name] = value.split(",")
else:
extended_kwargs[param.name] = []
else:
if kwargs.has_key(param.name):
extended_kwargs[param.name] = kwargs[param.name]
value = kwargs[param.name].encode('ascii','ignore')
extended_kwargs[param.name] = value
else:
extended_kwargs[param.name] = param.default
return extended_kwargs
......
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