Commit add617d8 authored by Penom Nom's avatar Penom Nom
Browse files

wfstatus on single run view

parent 5b38e7a3
......@@ -27,6 +27,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<input type="hidden" id="user_login" value="{$user_login}" />
<input type="hidden" id="server_url" value="{$server_url}" />
{* Find out if the current user is super user of a run *}
{assign var="is_at_least_admin_of_1_run" value=false}
{foreach from=$runs key=run_id item=run_values}
{if $run_values.is_admin && !$is_at_least_admin_of_1_run}
{assign var="is_at_least_admin_of_1_run" value=true}
{elseif !$is_at_least_admin_of_1_run}
{assign var="is_at_least_admin_of_1_run" value=false}
{/if}
{/foreach}
{* If no runs can be displayed *}
{if $runs|@count == 0 || ($runs|@count == 1 && $runs[key($runs)].hidden == 1 && !$runs[key($runs)].is_admin) }
<div class="sub-content">
......@@ -48,6 +58,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<p class="bullet"><strong>Date: </strong> {$runs[key($runs)].date|date_format:"%d/%m/%y"}</p>
<p class="bullet"><strong>Species: </strong> {$runs[key($runs)].species}</p>
<p class="bullet"><strong>Type: </strong> {$runs[key($runs)].type}</p>
{if $is_at_least_admin_of_1_run && $login_user}
<p class="bullet"><strong>Status: </strong> <span id="wfstatus_run_id_{$run_ids}">{$run_ids}</span></p>
{/if}
</div>
<div style="float:left">
<p class="bullet"><strong>Data nature: </strong> {$runs[key($runs)].data_nature}</p>
......@@ -125,15 +138,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{* If multiple runs have to be displayed *}
{else}
{* Find out if the current user is super user of a run *}
{assign var="is_at_least_admin_of_1_run" value=false}
{foreach from=$runs key=run_id item=run_values}
{if $run_values.is_admin && !$is_at_least_admin_of_1_run}
{assign var="is_at_least_admin_of_1_run" value=true}
{elseif !$is_at_least_admin_of_1_run}
{assign var="is_at_least_admin_of_1_run" value=false}
{/if}
{/foreach}
{* Then display the table *}
<div class="sub-content sc-top">
<div class="ng6-content-header-left run">
......
......@@ -186,6 +186,7 @@ $(function () {
});
addWorkflowsStatusOnRun();
addWorkflowsStatusOnSingleRun();
// Init tables
var projectTable = initProjectTable(),
......@@ -1164,7 +1165,7 @@ function addWorkflowsStatusOnRun() {
} else if (data[i]["status"] == "started"){
class_label = 'btn-info';
}
var $html = $('<button class="workflow-btn btn btn-default btn-sm '+class_label+'" style="padding: 2px;"><i class="glyphicon glyphicon-cog"></i></span></button>'),
var $html = $('<button class="workflow-btn btn btn-default btn-sm '+class_label+'" style="padding: 2px;"><i class="glyphicon glyphicon-cog"></i></button>'),
run_id = "",
workflow = {};
for (var j in data[i]["metadata"]) {
......@@ -1207,6 +1208,70 @@ function addWorkflowsStatusOnRun() {
}
}
function addWorkflowsStatusOnSingleRun(){
var run_id = $("[id^=wfstatus_run_id_]").first().attr("id").split("_")[3];
if (run_id){
var serverURL = "http://localhost:8080";
if ($("#server_url").val()){ serverURL = $("#server_url").val(); }
$.ajax({
url: serverURL +'/get_workflows_status?metadata_filter=run_id='+run_id+'&callback=?',
dataType: "json",
success: function(data) {
var class_label = "";
for (var i in data) {
var myrun = data[i];
if (myrun["status"] == "completed"){
class_label = 'btn-success';
} else if (myrun["status"] == "failed"){
class_label = 'btn-danger';
} else if (myrun["status"] == "aborted"){
class_label = 'btn-danger';
} else if (myrun["status"] == "started"){
class_label = 'btn-info';
}
var $html = $('<button class="workflow-btn btn btn-default btn-sm '+class_label+'" style="padding: 2px;"><i class="glyphicon glyphicon-cog"></i></button>'),
myrun_id = "";
for (var j in myrun["metadata"]) {
if (myrun["metadata"][j].indexOf("run_id=") == 0) {
myrun_id = myrun["metadata"][j].split("=")[1];
$html.data('workflow', myrun);
if(myrun_id == run_id) {
$("#wfstatus_run_id_"+run_id).html($html);
}
}
}
}
$(".workflow-btn").on("click", function(event){
$('#setAndRunModalLabel').html($(this).data('workflow')["name"] + " <small>" + $(this).data('workflow')["id"] + "</small>");
$('#setAndRunModalBody').wfstatus({
workflowID: $(this).data('workflow').id,
forceUsingWorkflow: $(this).data('workflow'),
serverURL: $("#server_url").val()
});
$('#setAndRunModalFooter').html([
' <div class="btn-group">',
' <button id="refresh_workflow" class="btn btn-default"><i class="glyphicon glyphicon-refresh"></i> Refresh</button>',
' <button id="rerun_workflow" class="btn btn-primary"><i class="glyphicon glyphicon-cog"></i> Rerun</button>',
' </div>',
].join(''));
$("#reset_workflow, #run_workflow").hide();
unbindAll();
$("#refresh_workflow").click(function(){
$('#setAndRunModalBody').wfstatus('reload');
});
$("#rerun_workflow").bind('click', {'selector' : '#setAndRunModalBody' }, rerunWFHandler);
$('#setAndRunModal').modal();
});
}
});
}
}
function updateProjectButtonStatus() {
$('.multiplep-selection-btn').each(function(){
if ($(":checked[id^=chk_project_]").size() == 0) {
......
......@@ -224,7 +224,8 @@ $(function () {
$('#wfform').on('run.wfform', function(event, running_wf) {
$("#reset_workflow, #run_workflow").hide();
$("#close").show();
$("#myModalBody").html("<div class='alert alert-info'>The dowload is in process, you can now close this window and wait for the validation mail.</div>");
$("#myModalBody").html("<div class='alert alert-info'>The dowload is in progress, it may take a while depending on the server availability."+
" You can close this window and wait for the validation mail.</div>");
});
$("#reset_workflow").click(function(){
......
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