1 <% if (j.andand[:state] == "Running" or defined? scaleby) and (not defined? show_progress_bar or show_progress_bar) %>
3 failed = j[:tasks_summary][:failed] || 0 rescue 0
4 done = j[:tasks_summary][:done] || 0 rescue 0
5 running = j[:tasks_summary][:running] || 0 rescue 0
6 todo = j[:tasks_summary][:todo] || 0 rescue 0
8 if done + running + failed + todo == 0
9 # No tasks were ever created for this job;
10 # render an empty progress bar.
13 percent_total_tasks = 100.0 / (done + running + failed + todo)
15 percent_total_tasks *= scaleby
17 done_percent = (done+failed) * percent_total_tasks
21 <% if not defined? scaleby %>
22 <div class="progress" style="margin-bottom: 0px">
25 <span class="progress-bar <%= if failed == 0 then 'progress-bar-success' else 'progress-bar-warning' end %>" style="width: <%= done_percent %>%;">
28 <% if not defined? scaleby %>
35 "Cancelled" => "danger",
36 "Complete" => "success",
39 "Queued" => "default",
43 <span class="label label-<%= to_label[j.andand[:state]] %>">
47 if j.andand[:state] then j[:state].downcase else "Not ready" end