5493: getting_started modal is served from layout html
[arvados.git] / apps / workbench / app / views / application / _job_progress.html.erb
1 <% if (j.andand[:state] == "Running" or defined? scaleby) and (not defined? show_progress_bar or show_progress_bar) %>
2   <%
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
7
8     if done + running + failed + todo == 0
9       # No tasks were ever created for this job;
10       # render an empty progress bar.
11       done_percent = 0
12     else
13       percent_total_tasks = 100.0 / (done + running + failed + todo)
14       if defined? scaleby
15         percent_total_tasks *= scaleby
16       end
17       done_percent = (done+failed) * percent_total_tasks
18     end
19     %>
20
21   <% if not defined? scaleby %>
22     <div class="progress" style="margin-bottom: 0px">
23   <% end %>
24
25   <span class="progress-bar <%= if failed == 0 then 'progress-bar-success' else 'progress-bar-warning' end %>" style="width: <%= done_percent %>%;">
26   </span>
27
28   <% if not defined? scaleby %>
29   </div>
30   <% end %>
31
32 <% else %>
33
34 <% to_label = {
35      "Cancelled" => "danger",
36      "Complete" => "success",
37      "Running" => "info",
38      "Failed" => "danger",
39      "Queued" => "default",
40      nil => "default"
41    } %>
42
43   <span class="label label-<%= to_label[j.andand[:state]] %>">
44     <%= if defined? title
45           title
46         else
47           if j.andand[:state] then j[:state].downcase else "Not ready" end
48         end
49         %></span>
50
51 <% end %>