1 <%# Copyright (C) The Arvados Authors. All rights reserved.
3 SPDX-License-Identifier: AGPL-3.0 %>
5 <% if (j.andand[:state] == "Running" or defined? scaleby) and (not defined? show_progress_bar or show_progress_bar) %>
7 failed = j[:tasks_summary][:failed] || 0 rescue 0
8 done = j[:tasks_summary][:done] || 0 rescue 0
9 running = j[:tasks_summary][:running] || 0 rescue 0
10 todo = j[:tasks_summary][:todo] || 0 rescue 0
12 if done + running + failed + todo == 0
13 # No tasks were ever created for this job;
14 # render an empty progress bar.
17 percent_total_tasks = 100.0 / (done + running + failed + todo)
19 percent_total_tasks *= scaleby
21 done_percent = (done+failed) * percent_total_tasks
25 <% if not defined? scaleby %>
26 <div class="progress" style="margin-bottom: 0px">
29 <span class="progress-bar <%= if failed == 0 then 'progress-bar-success' else 'progress-bar-warning' end %>" style="width: <%= done_percent %>%;">
32 <% if not defined? scaleby %>
39 "Cancelled" => "danger",
40 "Complete" => "success",
43 "Queued" => "default",
47 <span class="label label-<%= to_label[j.andand[:state]] %>">
51 if j.andand[:state] then j[:state].downcase else "Not ready" end