Commit 377c3aa9 authored by Ibouniyamine Nabihoudine's avatar Ibouniyamine Nabihoudine
Browse files

workflow group filter

parent 351d4bab
......@@ -63,4 +63,11 @@ tmp_directory = <path>/tmp
#java7 = /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
#gatk = /usr/bin/GenomeAnalysisTK-3.0-0/GenomeAnalysisTK.jar
#add_read_group = /usr/bin//picard-tools-1.109/AddOrReplaceReadGroups.jar
#create_dictionary = /usr/bin//picard-tools-1.109/CreateSequenceDictionary.jar
\ No newline at end of file
#create_dictionary = /usr/bin//picard-tools-1.109/CreateSequenceDictionary.jar
# Set cluster parameters of some components
[components]
# Set workflows group
[workflows]
......@@ -182,7 +182,7 @@ function(){function a(a){this._value=a}function b(a,b,c,d){var e,f,g=Math.pow(10
//activewf
!function(t){"use strict";var e=function(e,a){this.$element=t(e),this.options=t.extend({},t.fn.activewf.defaults,a),""==this.options.serverURL&&(this.options.serverURL=t.fn.activewf.defaults.serverURL),this.reload()};e.prototype.reload=function(){var e=this,a=['<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><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="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join("\n"),s=this.options.serverURL+"/get_workflows_status?";this.options.metadataFilter.length>0&&(s+="metadata_filter="+this.options.metadataFilter.join(",")+"&"),s+="callback=?",e.$element.html(a),t.ajax({url:s,dataType:"json",timeout:2e4,error:function(){var t=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+e.options.serverURL+"</strong>","</div>"].join("\n");e.$element.html(t)},success:function(a){var s={},l=new Array,i=new Array;for(var o in a)s[a[o].id]=a[o],l.push(a[o].id);l.sort(function(t,e){return e-t});for(var o in l)i.push(s[l[o]]);e.$element.html(""),t.tmpl(e.options.template,{workflows:i}).appendTo(e.$element),t("[id^=activewf_btn_]").click(function(){var a=t(this).attr("id").split("activewf_btn_")[1];e.$element.trigger("select.activewf",s[a])}),t("[id^=activewf_refresh_]").click(function(){e.reload()}),t("[id^=activewf_delete_]").click(function(){var a=t(this).attr("id").split("activewf_delete_")[1];t.ajax({url:e.options.serverURL+"/delete_workflow?workflow_id="+a+"&callback=?",dataType:"json",timeout:2e4,error:function(){var t=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+e.options.serverURL+"</strong>","</div>"].join("\n");e.$element.html(t)},success:function(){e.reload()}})})}})};t.fn.activewf;t.fn.activewf=function(a){return this.each(function(){var s=t(this),l=s.data("activewf"),i=t.extend({},t.fn.activewf.defaults,"object"==typeof a&&a),o="string"==typeof a?a:null;l||s.data("activewf",l=new e(this,i)),o&&l[o]()})},t.fn.activewf.defaults={serverURL:"http://localhost:8080",template:['<table class="table table-striped table-striped">',"<thead>","<tr>","<th>ID<th>","<th>Name</th>","<th>Status</th>","<th>Start time</th>","<th>End time</th>","<th>Actions</th>","</tr>","</thead>","{{each(index, workflow) workflows}}","<tr>",'<td><a id="activewf_btn_${workflow.id}" href="#">${workflow.id}</a><td>',"<td>${workflow.name}</td>",'{{if workflow.status == "completed"}}','<td> <span class="label label-success">${workflow.status}</span></td>','{{else workflow.status == "failed"}}','<td> <span class="label label-danger">${workflow.status}</span></td>','{{else workflow.status == "aborted"}}','<td> <span class="label label-danger">${workflow.status}</span></td>','{{else workflow.status == "started"}}','<td> <span class="label label-info">${workflow.status}</span></td>','{{else workflow.status == "reseted"}}','<td> <span class="label label-default">${workflow.status}</span></td>',"{{else}}","<td>${workflow.status}</td>","{{/if}}","<td>${workflow.start_time}</td>","<td>${workflow.end_time}</td>","<td>",' <div class="btn-group">',' {{if workflow.status == "started"}}',' <button type="button" id="activewf_refresh_${workflow.id}" class="btn btn-default btn-xs" aria-label="Left Align">'," {{else}}",' <button type="button" id="activewf_refresh_${workflow.id}" disabled class="btn btn-default btn-xs" aria-label="Left Align">'," {{/if}}",' <span class="glyphicon glyphicon-refresh"></span>'," </button>",' {{if workflow.status == "started"}}',' <button type="button" id="activewf_delete_${workflow.id}" disabled class="btn btn-default btn-xs" aria-label="Left Align">'," {{else}}",' <button type="button" id="activewf_delete_${workflow.id}" class="btn btn-default btn-xs" aria-label="Left Align">'," {{/if}}",' <span class="glyphicon glyphicon-remove"></span>'," </button>"," </div>","</td>","</tr>","{{/each}}","</table>"].join("\n"),metadataFilter:[]},t.fn.activewf.Constructor=e}(window.jQuery);
//availablewf
!function(t){"use strict";var e=function(e,a){this.$element=t(e),this.options=t.extend({},t.fn.availablewf.defaults,a),""==this.options.serverURL&&(this.options.serverURL=t.fn.availablewf.defaults.serverURL),this.reload()};e.prototype.reload=function(){var e=this,a=['<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><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="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join("\n");e.$element.html(a),t.ajax({url:this.options.serverURL+"/get_available_workflows?callback=?",dataType:"json",timeout:2e4,error:function(){var t=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+e.options.serverURL+"</strong>","</div>"].join("\n");e.$element.html(t)},success:function(a){var l={};for(var i in a)l[a[i]["class"]]=a[i];e.$element.html(""),t.tmpl(e.options.template,{workflows:a,filters:e.options.filters}).appendTo(e.$element),t("[id^=availablewf_btn_]").click(function(){var a=t(this).attr("id").split("availablewf_btn_")[1];e.$element.trigger("select.availablewf",l[a])})}})};t.fn.availablewf;t.fn.availablewf=function(a){return this.each(function(){var l=t(this),i=l.data("availablewf"),s=t.extend({},t.fn.availablewf.defaults,"object"==typeof a&&a),o="string"==typeof a?a:null;i||l.data("availablewf",i=new e(this,s)),o&&i[o]()})},t.fn.availablewf.defaults={serverURL:"http://localhost:8080",template:['<table class="table table-striped table-striped">',"<thead>","<tr>","<th>Name</th>","<th>Description</th>","</tr>","</thead>","{{each(index, workflow) workflows}}"," {{if filters.indexOf(workflow.class) == -1 }}"," <tr>",' <td><a id="availablewf_btn_${workflow.class}" href="#">${workflow.name}</a></td>'," <td>${workflow.help}</td>"," </tr>"," {{/if}}","{{/each}}","</dl>"].join("\n"),filters:[]},t.fn.availablewf.Constructor=e}(window.jQuery);
!function(t){"use strict";var e=function(e,i){this.$element=t(e),this.options=t.extend({},t.fn.availablewf.defaults,i),""==this.options.serverURL&&(this.options.serverURL=t.fn.availablewf.defaults.serverURL),this.reload()};e.prototype.reload=function(){var e=this,i=['<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><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="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join("\n");e.$element.html(i),t.ajax({url:this.options.serverURL+"/get_available_workflows?filter_groups="+this.options.filter_groups.join(",")+"&select="+this.options.select+"&callback=?",dataType:"json",timeout:2e4,error:function(t,i,l){var a=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+e.options.serverURL+"</strong>","</div>"].join("\n");e.$element.html(a)},success:function(i){var l={};for(var a in i)l[i[a]["class"]]=i[a];e.$element.html(""),t.tmpl(e.options.template,{workflows:i,filters:e.options.filters}).appendTo(e.$element),t("[id^=availablewf_btn_]").click(function(){var i=t(this).attr("id").split("availablewf_btn_")[1];e.$element.trigger("select.availablewf",l[i])})}})};t.fn.availablewf;t.fn.availablewf=function(i){return this.each(function(){var l=t(this),a=l.data("availablewf"),s=t.extend({},t.fn.availablewf.defaults,"object"==typeof i&&i),o="string"==typeof i?i:null;a||l.data("availablewf",a=new e(this,s)),o&&a[o]()})},t.fn.availablewf.defaults={serverURL:"http://localhost:8080",template:['<table class="table table-striped table-striped">',"<thead>","<tr>","<th>Name</th>","<th>Description</th>","</tr>","</thead>","{{each(index, workflow) workflows}}"," {{if filters.indexOf(workflow.class) == -1 }}"," <tr>",' <td><a id="availablewf_btn_${workflow.class}" href="#">${workflow.name}</a></td>'," <td>${workflow.help}</td>"," </tr>"," {{/if}}","{{/each}}","</dl>"].join("\n"),filters:[],filter_groups:[],select:!1},t.fn.availablewf.Constructor=e}(window.jQuery);
//wfoutputs
!function(t){"use strict";var o=function(o,e){this.$element=t(o),this.options=t.extend({},t.fn.wfoutputs.defaults,e),""==this.options.serverURL&&(this.options.serverURL=t.fn.wfoutputs.defaults.serverURL)};o.prototype.reload=function(){var o=this,e="",l=['<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><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="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join("\n");o.$element.html(l),this.options.workflowID&&(e="workflow_id="+this.options.workflowID+"&"),t.ajax({url:this.options.serverURL+"/get_workflow_outputs?"+e+"callback=?",dataType:"json",timeout:2e4,error:function(){var t=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+o.options.serverURL+"</strong>","</div>"].join("\n");o.$element.html(t)},success:function(e){o.$element.html(""),t.tmpl(o.options.template,{data:e}).appendTo(o.$element);var l=new Array;t.each(e,function(e,s){t.each(s,function(e,s){-1==t.inArray(s.extension,l)&&-1==t.inArray(s.extension,o.options.logFile)&&l.push(s.extension)})}),t.each(l,function(o,e){t("#jflow_file_type").append(t("<option>",{text:e}))}),t(".output-file").each(function(){var e=t(this).find("A").text().substr(t(this).find("A").text().lastIndexOf("."));-1==t.inArray(e,o.options.logFile)?t(this).addClass("output"):(t(this).addClass("log"),t(this).hide())}),t("#jflow_log_on").click(function(){t(".log").each(function(){t(this).fadeIn(500)}),t("#jflow_log_on").hide(),t("#jflow_log_off").show()}),t("#jflow_log_off").click(function(){t(".log").each(function(){t(this).fadeOut(500)}),t("#jflow_log_off").hide(),t("#jflow_log_on").show()}),t("#jflow_file_type").on("change",function(){var o=t("#jflow_file_type option:selected").val(),e=new RegExp(o);t(".output").each(function(){"all"==o?t(this).fadeIn(500):e.test(t(this).text())?t(this).fadeIn(500):t(this).fadeOut(500)})})}})};t.fn.wfoutputs;t.fn.wfoutputs=function(e){return this.each(function(){var l=t(this),s=l.data("wfoutputs"),i=t.extend({},t.fn.wfoutputs.defaults,"object"==typeof e&&e),n="string"==typeof e?e:null;s?i.workflowID&&(s.options.workflowID=i.workflowID):l.data("wfoutputs",s=new o(this,i)),n?s[n]():s.reload()})},t.fn.wfoutputs.defaults={serverURL:"http://localhost:8080",template:['<div style="float:right;margin-bottom:14px">',' <button id="jflow_log_on" class="btn btn-default btn-xs" type="button"><span class="glyphicon glyphicon-eye-open"></span> View log files</button>',' <button id="jflow_log_off" style="display:none" class="btn btn-default btn-xs" type="button"><span class="glyphicon glyphicon-eye-close"></span> Mask log files</button>',' <span class="btn-xs">- View:</span>',' <select id="jflow_file_type" class="btn btn-default btn-xs" style="width:auto">'," view: <option>all</option>",' </select><span class="btn-xs"> files.</span>',"</div>",'<div style="clear:both;">',' <dl "style=margin-bottom:15px">'," {{each(component_name, files) data}}",' <div style="clear:both"></div>',' <dt style="margin-top:15px;background-color: #eee">',' <span class="glyphicon glyphicon-play" style="color:white;left:-3px"></span>'," ${component_name}"," </dt>"," {{each(file_name, href) files}}",' <dd class="output-file" style="float:left;margin-left:20px;width:265px;overflow:hidden;white-space: nowrap;text-overflow:ellipsis;">',' <span class="glyphicon glyphicon-file"></span>',' <a href="${href.url}" download>${file_name}</a>',' <span style="color:grey">| ${href.size}</span>'," </dd>"," {{/each}}"," {{/each}}</dl>","</div>"].join("\n"),logFile:[".stderr",".stdout",".log"],workflowID:null},t.fn.wfoutputs.Constructor=o}(window.jQuery);
//wfform
......
......@@ -44,6 +44,8 @@ class Component(object):
self.output_directory = None
self.config_reader = JFlowConfigReader()
self.version = self.get_version()
if isinstance(self.version, bytes):
self.version = self.version.decode()
self.batch_options = self.config_reader.get_component_batch_options(self.__class__.__name__)
def is_dynamic(self):
......
......@@ -119,4 +119,11 @@ class JFlowConfigReader(object):
return self.reader.get("components", component_class+".batch_options")
except:
return ""
\ No newline at end of file
def get_workflow_group(self, workflow_class):
try:
return self.reader.get("workflows", workflow_class+".group")
except:
return ""
\ No newline at end of file
......@@ -222,7 +222,12 @@ class JFlowServer (object):
@jsonify
def get_available_workflows(self, **kwargs):
workflows = []
wf_instances, wf_methodes = self.wfmanager.get_available_workflows()
filter_groups = None
select = False
if 'filter_groups' in kwargs : filter_groups = kwargs['filter_groups'].split(',')
if 'select' in kwargs : select = kwargs['select'] in ['True', 'true', '1', 1]
wf_instances, wf_methodes = self.wfmanager.get_available_workflows(filter_groups = filter_groups , select = select)
for instance in wf_instances:
parameters, parameters_per_groups, groups = [], {}, ["default"]
for param in instance.get_parameters():
......
......@@ -89,6 +89,7 @@ class Workflow(threading.Thread):
STDERR_FILE_NAME = "wf_stderr.txt"
WORKING = ".working"
OLD_EXTENSION = ".old"
DEFAULT_GROUP = "default"
STATUS_STARTED = "started"
STATUS_COMPLETED = "completed"
......@@ -139,6 +140,7 @@ class Workflow(threading.Thread):
self.id = id
self.name = self.get_name()
self.description = self.get_description()
self.__group = self.jflow_config_reader.get_workflow_group(self.name) or self.DEFAULT_GROUP
# define the parameters
self.params_order = []
......@@ -158,6 +160,8 @@ class Workflow(threading.Thread):
self.internal_components = self._import_internal_components()
self.external_components = self._import_external_components()
def get_workflow_group(self):
return self.__group
def add_input_directory(self, name, help, default=None, required=False, flag=None,
group="default", display_name=None, get_files_fn=None, add_to=None):
......
......@@ -63,12 +63,15 @@ class WorkflowsManager(object):
workflows_ids = [wf.id for wf in workflows]
concurrent.exec_on_shared( dump_func, self.dump_file, self.config_reader.get_tmp_directory(), 1, 200, {"action": "Add wf", "wf_id": workflows_ids} )
def get_available_workflows(self, function="process"):
def get_available_workflows(self, function="process", filter_groups = [], select = False ):
if function.__class__.__name__ == "str":
functions = [function]
else:
functions = set(function)
wf_instances, wf_methodes = [], []
if isinstance(filter_groups, str): filter_groups = [filter_groups]
# Load all modules within the workflow module
for importer, modname, ispkg in pkgutil.iter_modules(workflows.__path__, workflows.__name__ + "."):
__import__(modname)
......@@ -82,8 +85,14 @@ class WorkflowsManager(object):
if ifunction[0] == function:
# try to build the workflow
try:
wf_instances.append(obj(function=function))
wf_methodes.append(function)
select_workflow = True
inst = obj(function=function)
if filter_groups :
select_workflow = (inst.get_workflow_group() in filter_groups) == select
if select_workflow:
wf_instances.append(inst)
wf_methodes.append(function)
except: pass
return [wf_instances, wf_methodes]
......
......@@ -48,7 +48,7 @@
'</div></div> <div class="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join('\n');
$this.$element.html(waiting_animation);
$.ajax({
url: this.options.serverURL + '/get_available_workflows?callback=?',
url: this.options.serverURL + '/get_available_workflows?filter_groups=' + this.options.filter_groups.join(',') + '&select=' + this.options.select + '&callback=?',
dataType: "json",
timeout: 20000,
error: function (xhr, ajaxOptions, thrownError) {
......@@ -108,7 +108,9 @@
' {{/if}}',
'{{/each}}',
'</dl>'].join('\n'),
filters: []
filters: [],
filter_groups : [],
select : false
}
$.fn.availablewf.Constructor = AvailableWF
......
......@@ -182,7 +182,7 @@ function(){function a(a){this._value=a}function b(a,b,c,d){var e,f,g=Math.pow(10
//activewf
!function(t){"use strict";var e=function(e,a){this.$element=t(e),this.options=t.extend({},t.fn.activewf.defaults,a),""==this.options.serverURL&&(this.options.serverURL=t.fn.activewf.defaults.serverURL),this.reload()};e.prototype.reload=function(){var e=this,a=['<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><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="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join("\n"),s=this.options.serverURL+"/get_workflows_status?";this.options.metadataFilter.length>0&&(s+="metadata_filter="+this.options.metadataFilter.join(",")+"&"),s+="callback=?",e.$element.html(a),t.ajax({url:s,dataType:"json",timeout:2e4,error:function(){var t=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+e.options.serverURL+"</strong>","</div>"].join("\n");e.$element.html(t)},success:function(a){var s={},l=new Array,i=new Array;for(var o in a)s[a[o].id]=a[o],l.push(a[o].id);l.sort(function(t,e){return e-t});for(var o in l)i.push(s[l[o]]);e.$element.html(""),t.tmpl(e.options.template,{workflows:i}).appendTo(e.$element),t("[id^=activewf_btn_]").click(function(){var a=t(this).attr("id").split("activewf_btn_")[1];e.$element.trigger("select.activewf",s[a])}),t("[id^=activewf_refresh_]").click(function(){e.reload()}),t("[id^=activewf_delete_]").click(function(){var a=t(this).attr("id").split("activewf_delete_")[1];t.ajax({url:e.options.serverURL+"/delete_workflow?workflow_id="+a+"&callback=?",dataType:"json",timeout:2e4,error:function(){var t=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+e.options.serverURL+"</strong>","</div>"].join("\n");e.$element.html(t)},success:function(){e.reload()}})})}})};t.fn.activewf;t.fn.activewf=function(a){return this.each(function(){var s=t(this),l=s.data("activewf"),i=t.extend({},t.fn.activewf.defaults,"object"==typeof a&&a),o="string"==typeof a?a:null;l||s.data("activewf",l=new e(this,i)),o&&l[o]()})},t.fn.activewf.defaults={serverURL:"http://localhost:8080",template:['<table class="table table-striped table-striped">',"<thead>","<tr>","<th>ID<th>","<th>Name</th>","<th>Status</th>","<th>Start time</th>","<th>End time</th>","<th>Actions</th>","</tr>","</thead>","{{each(index, workflow) workflows}}","<tr>",'<td><a id="activewf_btn_${workflow.id}" href="#">${workflow.id}</a><td>',"<td>${workflow.name}</td>",'{{if workflow.status == "completed"}}','<td> <span class="label label-success">${workflow.status}</span></td>','{{else workflow.status == "failed"}}','<td> <span class="label label-danger">${workflow.status}</span></td>','{{else workflow.status == "aborted"}}','<td> <span class="label label-danger">${workflow.status}</span></td>','{{else workflow.status == "started"}}','<td> <span class="label label-info">${workflow.status}</span></td>','{{else workflow.status == "reseted"}}','<td> <span class="label label-default">${workflow.status}</span></td>',"{{else}}","<td>${workflow.status}</td>","{{/if}}","<td>${workflow.start_time}</td>","<td>${workflow.end_time}</td>","<td>",' <div class="btn-group">',' {{if workflow.status == "started"}}',' <button type="button" id="activewf_refresh_${workflow.id}" class="btn btn-default btn-xs" aria-label="Left Align">'," {{else}}",' <button type="button" id="activewf_refresh_${workflow.id}" disabled class="btn btn-default btn-xs" aria-label="Left Align">'," {{/if}}",' <span class="glyphicon glyphicon-refresh"></span>'," </button>",' {{if workflow.status == "started"}}',' <button type="button" id="activewf_delete_${workflow.id}" disabled class="btn btn-default btn-xs" aria-label="Left Align">'," {{else}}",' <button type="button" id="activewf_delete_${workflow.id}" class="btn btn-default btn-xs" aria-label="Left Align">'," {{/if}}",' <span class="glyphicon glyphicon-remove"></span>'," </button>"," </div>","</td>","</tr>","{{/each}}","</table>"].join("\n"),metadataFilter:[]},t.fn.activewf.Constructor=e}(window.jQuery);
//availablewf
!function(t){"use strict";var e=function(e,a){this.$element=t(e),this.options=t.extend({},t.fn.availablewf.defaults,a),""==this.options.serverURL&&(this.options.serverURL=t.fn.availablewf.defaults.serverURL),this.reload()};e.prototype.reload=function(){var e=this,a=['<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><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="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join("\n");e.$element.html(a),t.ajax({url:this.options.serverURL+"/get_available_workflows?callback=?",dataType:"json",timeout:2e4,error:function(){var t=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+e.options.serverURL+"</strong>","</div>"].join("\n");e.$element.html(t)},success:function(a){var l={};for(var i in a)l[a[i]["class"]]=a[i];e.$element.html(""),t.tmpl(e.options.template,{workflows:a,filters:e.options.filters}).appendTo(e.$element),t("[id^=availablewf_btn_]").click(function(){var a=t(this).attr("id").split("availablewf_btn_")[1];e.$element.trigger("select.availablewf",l[a])})}})};t.fn.availablewf;t.fn.availablewf=function(a){return this.each(function(){var l=t(this),i=l.data("availablewf"),s=t.extend({},t.fn.availablewf.defaults,"object"==typeof a&&a),o="string"==typeof a?a:null;i||l.data("availablewf",i=new e(this,s)),o&&i[o]()})},t.fn.availablewf.defaults={serverURL:"http://localhost:8080",template:['<table class="table table-striped table-striped">',"<thead>","<tr>","<th>Name</th>","<th>Description</th>","</tr>","</thead>","{{each(index, workflow) workflows}}"," {{if filters.indexOf(workflow.class) == -1 }}"," <tr>",' <td><a id="availablewf_btn_${workflow.class}" href="#">${workflow.name}</a></td>'," <td>${workflow.help}</td>"," </tr>"," {{/if}}","{{/each}}","</dl>"].join("\n"),filters:[]},t.fn.availablewf.Constructor=e}(window.jQuery);
!function(t){"use strict";var e=function(e,i){this.$element=t(e),this.options=t.extend({},t.fn.availablewf.defaults,i),""==this.options.serverURL&&(this.options.serverURL=t.fn.availablewf.defaults.serverURL),this.reload()};e.prototype.reload=function(){var e=this,i=['<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><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="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join("\n");e.$element.html(i),t.ajax({url:this.options.serverURL+"/get_available_workflows?filter_groups="+this.options.filter_groups.join(",")+"&select="+this.options.select+"&callback=?",dataType:"json",timeout:2e4,error:function(t,i,l){var a=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+e.options.serverURL+"</strong>","</div>"].join("\n");e.$element.html(a)},success:function(i){var l={};for(var a in i)l[i[a]["class"]]=i[a];e.$element.html(""),t.tmpl(e.options.template,{workflows:i,filters:e.options.filters}).appendTo(e.$element),t("[id^=availablewf_btn_]").click(function(){var i=t(this).attr("id").split("availablewf_btn_")[1];e.$element.trigger("select.availablewf",l[i])})}})};t.fn.availablewf;t.fn.availablewf=function(i){return this.each(function(){var l=t(this),a=l.data("availablewf"),s=t.extend({},t.fn.availablewf.defaults,"object"==typeof i&&i),o="string"==typeof i?i:null;a||l.data("availablewf",a=new e(this,s)),o&&a[o]()})},t.fn.availablewf.defaults={serverURL:"http://localhost:8080",template:['<table class="table table-striped table-striped">',"<thead>","<tr>","<th>Name</th>","<th>Description</th>","</tr>","</thead>","{{each(index, workflow) workflows}}"," {{if filters.indexOf(workflow.class) == -1 }}"," <tr>",' <td><a id="availablewf_btn_${workflow.class}" href="#">${workflow.name}</a></td>'," <td>${workflow.help}</td>"," </tr>"," {{/if}}","{{/each}}","</dl>"].join("\n"),filters:[],filter_groups:[],select:!1},t.fn.availablewf.Constructor=e}(window.jQuery);
//wfoutputs
!function(t){"use strict";var o=function(o,e){this.$element=t(o),this.options=t.extend({},t.fn.wfoutputs.defaults,e),""==this.options.serverURL&&(this.options.serverURL=t.fn.wfoutputs.defaults.serverURL)};o.prototype.reload=function(){var o=this,e="",l=['<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><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="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join("\n");o.$element.html(l),this.options.workflowID&&(e="workflow_id="+this.options.workflowID+"&"),t.ajax({url:this.options.serverURL+"/get_workflow_outputs?"+e+"callback=?",dataType:"json",timeout:2e4,error:function(){var t=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+o.options.serverURL+"</strong>","</div>"].join("\n");o.$element.html(t)},success:function(e){o.$element.html(""),t.tmpl(o.options.template,{data:e}).appendTo(o.$element);var l=new Array;t.each(e,function(e,s){t.each(s,function(e,s){-1==t.inArray(s.extension,l)&&-1==t.inArray(s.extension,o.options.logFile)&&l.push(s.extension)})}),t.each(l,function(o,e){t("#jflow_file_type").append(t("<option>",{text:e}))}),t(".output-file").each(function(){var e=t(this).find("A").text().substr(t(this).find("A").text().lastIndexOf("."));-1==t.inArray(e,o.options.logFile)?t(this).addClass("output"):(t(this).addClass("log"),t(this).hide())}),t("#jflow_log_on").click(function(){t(".log").each(function(){t(this).fadeIn(500)}),t("#jflow_log_on").hide(),t("#jflow_log_off").show()}),t("#jflow_log_off").click(function(){t(".log").each(function(){t(this).fadeOut(500)}),t("#jflow_log_off").hide(),t("#jflow_log_on").show()}),t("#jflow_file_type").on("change",function(){var o=t("#jflow_file_type option:selected").val(),e=new RegExp(o);t(".output").each(function(){"all"==o?t(this).fadeIn(500):e.test(t(this).text())?t(this).fadeIn(500):t(this).fadeOut(500)})})}})};t.fn.wfoutputs;t.fn.wfoutputs=function(e){return this.each(function(){var l=t(this),s=l.data("wfoutputs"),i=t.extend({},t.fn.wfoutputs.defaults,"object"==typeof e&&e),n="string"==typeof e?e:null;s?i.workflowID&&(s.options.workflowID=i.workflowID):l.data("wfoutputs",s=new o(this,i)),n?s[n]():s.reload()})},t.fn.wfoutputs.defaults={serverURL:"http://localhost:8080",template:['<div style="float:right;margin-bottom:14px">',' <button id="jflow_log_on" class="btn btn-default btn-xs" type="button"><span class="glyphicon glyphicon-eye-open"></span> View log files</button>',' <button id="jflow_log_off" style="display:none" class="btn btn-default btn-xs" type="button"><span class="glyphicon glyphicon-eye-close"></span> Mask log files</button>',' <span class="btn-xs">- View:</span>',' <select id="jflow_file_type" class="btn btn-default btn-xs" style="width:auto">'," view: <option>all</option>",' </select><span class="btn-xs"> files.</span>',"</div>",'<div style="clear:both;">',' <dl "style=margin-bottom:15px">'," {{each(component_name, files) data}}",' <div style="clear:both"></div>',' <dt style="margin-top:15px;background-color: #eee">',' <span class="glyphicon glyphicon-play" style="color:white;left:-3px"></span>'," ${component_name}"," </dt>"," {{each(file_name, href) files}}",' <dd class="output-file" style="float:left;margin-left:20px;width:265px;overflow:hidden;white-space: nowrap;text-overflow:ellipsis;">',' <span class="glyphicon glyphicon-file"></span>',' <a href="${href.url}" download>${file_name}</a>',' <span style="color:grey">| ${href.size}</span>'," </dd>"," {{/each}}"," {{/each}}</dl>","</div>"].join("\n"),logFile:[".stderr",".stdout",".log"],workflowID:null},t.fn.wfoutputs.Constructor=o}(window.jQuery);
//wfform
......
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