Commit 9d921032 authored by Philippe Bardou's avatar Philippe Bardou
Browse files

Start with workflow outputs

parent 023f0ca3
......@@ -274,6 +274,11 @@ class JFlowServer (object):
status.append(self.jsonify_workflow_status(workflow))
return status
@cherrypy.expose
@jsonify
def get_workflow_outputs(self, **kwargs):
return self.wfmanager.get_workflow_ouputs(kwargs["workflow_id"])
@cherrypy.expose
@jsonify
def validate_field(self, **kwargs):
......
......@@ -106,8 +106,12 @@
</div>
<div id="statusModalBody" class="modal-body"></div>
<div class="modal-footer">
<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 class="btn-group">
<button id="refresh_workflow" class="btn status-panel"><i class="icon-refresh"></i> Refresh</button>
<button id="rerun_workflow" class="btn status-panel"><i class="icon-cog"></i> ReRun</button>
</div>
<button id="output_workflow" class="btn btn-success status-panel"><i class="icon-chevron-right icon-white"></i> Output</button>
<button id="back_workflow" class="btn" style="display:none"><i class="icon-chevron-left"></i> Back</button>
</div>
</div>
</div> <!-- /container -->
......@@ -145,6 +149,7 @@
<script src='../src/js/jflow-activewf.js' type='text/javascript'></script>
<script src='../src/js/jflow-availablewf.js' type='text/javascript'></script>
<script src='../src/js/jflow-wfoutputs.js' type='text/javascript'></script>
<script src='../src/js/jflow-wfform.js' type='text/javascript'></script>
<script src='../src/js/jflow-wfstatus.js' type='text/javascript'></script>
<script src="../src/js/bootstrap-datepicker.js"></script>
......@@ -181,6 +186,11 @@
$("#refresh_workflow").click(function(){ $('#statusModalBody').wfstatus('reload'); });
$("#reset_workflow").click(function(){ $('#setAndRunModalBody').wfform('reset'); });
$("#back_workflow").click(function(){
$('#statusModalBody').wfstatus('reload');
$('#back_workflow').hide();
$('.status-panel').show();
});
$("#run_workflow").click(function(){ $('#setAndRunModalBody').wfform('run'); });
$("#active-workflows-list").activewf();
......@@ -190,6 +200,15 @@
workflowID: workflow["id"]
});
$('#statusModal').modal();
$('#back_workflow').hide();
$('.status-panel').show();
$("#output_workflow").click(function() {
$('#statusModalBody').wfoutputs({
workflowID: workflow.id
})
$('#back_workflow').show();
$('.status-panel').hide();
});
});
/**
......
......@@ -54,13 +54,14 @@ class Component(object):
return dynamic_outputs
def get_component_outputs(self):
outputs = list()
outputs = {}
for attribute_value in self.__dict__.values():
if ( issubclass( attribute_value.__class__, DynamicOutput ) or
issubclass( attribute_value.__class__, OutputFileList) ):
outputs.extend( attribute_value )
for f in attribute_value:
outputs[os.path.basename(f)] = f
elif issubclass( attribute_value.__class__, OutputFile):
outputs.append( attribute_value )
outputs[os.path.basename(str(attribute_value))] = attribute_value
return outputs
def _longestCommonSubstr(self, data, clean_end=True):
......
......@@ -117,7 +117,9 @@ class Workflow(threading.Thread):
def get_outputs_per_components(self):
outputs_files = {}
for current_components in self.components:
#status = self.get_component_status(current_components.get_nameid())
outputs_files[current_components.get_nameid()] = current_components.get_component_outputs()
#outputs_files["0"] = status["completed"]
return outputs_files
def __setstate__(self, state):
......
/***************************************************************
* 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 ;_;
/* WFOutputs CLASS DEFINITION
* ========================= */
var WFOutputs = function (element, options) {
this.$element = $(element);
this.options = $.extend({}, $.fn.wfoutputs.defaults, options);
if (this.options.serverURL == "") { this.options.serverURL = $.fn.wfoutputs.defaults.serverURL; }
}
WFOutputs.prototype.reload = function() {
var $this = this,
params = "",
waiting_animation = ['<div class="row-fluid"><div class="span1 offset3"><div class="inline floatingBarsG">',
'<div class="blockG" id="rotateG_01"></div>',
'<div class="blockG" id="rotateG_02"></div>',
'<div class="blockG" id="rotateG_03"></div>',
'<div class="blockG" id="rotateG_04"></div>',
'<div class="blockG" id="rotateG_05"></div>',
'<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');
$this.$element.html(waiting_animation);
if (this.options.workflowID) { params = "workflow_id=" + this.options.workflowID + "&"; }
$.ajax({
url: this.options.serverURL + '/get_workflow_outputs?'+params+'callback=?',
dataType: "json",
timeout: 20000,
error: function (xhr, ajaxOptions, thrownError) {
var alert_message = ['<div class="alert alert-error">',
'<strong>Error!</strong>',
'Jflow failed to connect to the specified server <strong>' + $this.options.serverURL + '</strong>',
'</div>'].join('\n');
$this.$element.html(alert_message);
},
success: function(data) {
$this.$element.html("");
$.tmpl($this.options.template, {data: data}).appendTo($this.$element);
console.log(data);
}
});
}
/* WFOutputs PLUGIN DEFINITION
* ========================== */
var old = $.fn.wfoutputs
$.fn.wfoutputs = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('wfoutputs')
, options = $.extend({}, $.fn.wfoutputs.defaults, typeof option == 'object' && option)
, action = typeof option == 'string' ? option : null
// if already exist
if (!data) $this.data('wfoutputs', (data = new WFOutputs(this, options)))
// otherwise change the workflow
else if (options.workflowID) { data.options.workflowID = options.workflowID; }
if (action) { data[action]() }
else { data.reload(); }
})
}
$.fn.wfoutputs.defaults = {
serverURL: "http://localhost:8080",
template: ['<dl class="dl-horizontal">',
'{{each(component_name, files) data}}',
'<dt>${component_name}</dt>',
'{{each(index, file) files}}',
'<dd><a href="${file}">${index}</a></dd>',
'{{/each}}',
'{{/each}}</dl>'].join('\n'),
workflowID: null
}
$.fn.wfoutputs.Constructor = WFOutputs
}(window.jQuery);
\ No newline at end of file
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