X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/5ee5b90b5d7554d049c9071ed7bb812d1b7ca74a..257d60253246952b435cea23b1912af80ea2c6d6:/apps/workbench/app/views/application/_job_progress.html.erb diff --git a/apps/workbench/app/views/application/_job_progress.html.erb b/apps/workbench/app/views/application/_job_progress.html.erb index f942c44c2c..efe1819ebd 100644 --- a/apps/workbench/app/views/application/_job_progress.html.erb +++ b/apps/workbench/app/views/application/_job_progress.html.erb @@ -1,58 +1,51 @@ -<% - failed = j[:tasks_summary][:failed] || 0 rescue 0 - done = j[:tasks_summary][:done] || 0 rescue 0 - running = j[:tasks_summary][:running] || 0 rescue 0 - todo = j[:tasks_summary][:todo] || 0 rescue 0 - - if j[:success] == false and done + running + failed == 0 - # The job failed but no tasks were ever started (i.e. crunch-dispatch - # was unable to start the job). Display a full 100% failed progress bar. - failed_percent = 100 - success_percent = 0 - running_percent = 0 - elsif done + running + failed + todo == 0 - # No tasks were ever created for this job; - # render an empty progress bar. - failed_percent = 0 - success_percent = 0 - running_percent = 0 - else - percent_total_tasks = 100.0 / (done + running + failed + todo) - if defined? scaleby - percent_total_tasks *= scaleby - end - failed_percent = (failed * percent_total_tasks).ceil - success_percent = (done * percent_total_tasks).ceil - running_percent = (running * percent_total_tasks).ceil - - # We used ceil instead of round to compute percents to handle the situation - # where one of them is much larger than the other(s). However, this may - # have resulted in total percent > 100, hence we need to account for that. - if (failed_percent + success_percent + running_percent) > 100 - overflow = failed_percent + success_percent + running_percent - 100 - # decrease the biggest by the overlow amount - if (failed_percent > success_percent) && (failed_percent > running_percent) - failed_percent -= overflow - elsif (success_percent > failed_percent) && (success_percent > running_percent) - success_percent -= overflow - else - running_percent -= overflow - end - end - end -%> +<% if (j.andand[:state] == "Running" or defined? scaleby) and (not defined? show_progress_bar or show_progress_bar) %> + <% + failed = j[:tasks_summary][:failed] || 0 rescue 0 + done = j[:tasks_summary][:done] || 0 rescue 0 + running = j[:tasks_summary][:running] || 0 rescue 0 + todo = j[:tasks_summary][:todo] || 0 rescue 0 -<% if not defined? scaleby %> -
-<% end %> + if done + running + failed + todo == 0 + # No tasks were ever created for this job; + # render an empty progress bar. + done_percent = 0 + else + percent_total_tasks = 100.0 / (done + running + failed + todo) + if defined? scaleby + percent_total_tasks *= scaleby + end + done_percent = (done+failed) * percent_total_tasks + end + %> + + <% if not defined? scaleby %> +
+ <% end %> + + + - - - - - - + <% if not defined? scaleby %> +
+ <% end %> + +<% else %> + +<% to_label = { + "Cancelled" => "danger", + "Complete" => "success", + "Running" => "info", + "Failed" => "danger", + "Queued" => "default", + nil => "default" + } %> + + + <%= if defined? title + title + else + if j.andand[:state] then j[:state].downcase else "Not ready" end + end + %> -<% if not defined? scaleby %> -
<% end %>