Merge branch 'master' into 3836-remove-collection-from-project-bug
[arvados.git] / apps / workbench / app / views / projects / _show_dashboard.html.erb
1
2   <div class="row">
3     <div class="col-md-6">
4       <div class="panel panel-default" style="min-height: 10em">
5         <div class="panel-heading"><span class="panel-title">Active pipelines</span>
6           <span class="pull-right">
7     <%= link_to(
8           choose_pipeline_templates_path(
9             title: 'Choose a pipeline to run:',
10             action_name: 'Next: choose inputs <i class="fa fa-fw fa-arrow-circle-right"></i>',
11             action_href: pipeline_instances_path,
12             action_method: 'post',
13             action_data: {'selection_param' => 'pipeline_instance[pipeline_template_uuid]', 'pipeline_instance[owner_uuid]' => current_user.uuid, 'success' => 'redirect-to-created-object'}.to_json),
14           { class: "btn btn-primary btn-xs", remote: true, method: 'get' }) do %>
15       <i class="fa fa-fw fa-gear"></i> Run a pipeline...
16     <% end %>
17     </span>
18         </div>
19
20         <div class="panel-body">
21           <% if running_pipelines.empty? %>
22             No pipelines are currently running.
23           <% end %>
24           <% running_pipelines.each do |p| %>
25             <div class="dashboard-panel-info-row">
26               <div class="clearfix">
27                 <%= link_to_if_arvados_object p, friendly_name: true %>
28
29                 <div class="pull-right" style="width: 40%">
30                   <div class="progress" style="margin-bottom: 0px">
31                     <% running = [] %>
32                     <% failed = [] %>
33                     <% completed = [] %>
34                     <% queued = [] %>
35                     <% p.components.each do |k, v| %>
36                       <% if v.is_a? Hash and v[:job] %>
37                         <% if v[:job][:state] == "Running" %>
38                           <% running << k %>
39                         <% elsif v[:job][:state] == "Failed" or v[:job][:state] == "Cancelled" %>
40                           <% failed << k %>
41                         <% elsif v[:job][:state] == "Complete" %>
42                           <% completed << k %>
43                         <% elsif v[:job][:state] == "Queued" %>
44                           <% queued << k %>
45                         <% end %>
46                       <% end %>
47                     <% end %>
48                     <% completed_pct = (completed.size * 100) / p.components.size %>
49                     <% failed_pct = (failed.size * 100) / p.components.size %>
50                     <% running_pct = (running.size * 100) / p.components.size %>
51                     <% queued_pct = (queued.size * 100) / p.components.size %>
52
53                     <div class="progress-bar progress-bar-success" style="width: <%= completed_pct %>%">
54                       <span class="sr-only"></span>
55                     </div>
56                     <div class="progress-bar progress-bar-danger" style="width: <%= failed_pct %>%">
57                       <span class="sr-only"></span>
58                     </div>
59                     <div class="progress-bar progress-bar-primary" style="width: <%= running_pct %>%">
60                       <span class="sr-only"></span>
61                     </div>
62                     <div class="progress-bar progress-bar-default" style="width: <%= queued_pct %>%">
63                       <span class="sr-only"></span>
64                     </div>
65                   </div>
66                 </div>
67               </div>
68
69               <div class="clearfix">
70                 Started at <%= render_localized_date(p[:started_at] || p[:created_at], "noseconds") %>.
71                 <% pipeline_time = Time.now - (p[:started_at] || p[:created_at]) %>
72                 Active for <%= render_runtime(pipeline_time, false) %>.
73
74                 <div class="pull-right">
75                   <% running.each do |k| %>
76                     <span class="label label-primary"><%= k %></span>
77                   <% end %>
78                   <% queued.each do |k| %>
79                     <span class="label label-default"><%= k %></span>
80                   <% end %>
81                 </div>
82               </div>
83             </div>
84           <% end %>
85           </div>
86       </div>
87
88       <div class="panel panel-default">
89         <div class="panel-heading"><span class="panel-title">Recently finished pipelines</span></div>
90         <div class="panel-body">
91           <% finished_pipelines(8).each do |p| %>
92             <div class="dashboard-panel-info-row">
93               <div class="row">
94                 <div class="col-md-6 text-overflow-ellipsis">
95                   <%= link_to_if_arvados_object p, friendly_name: true %>
96                 </div>
97                 <div class="col-md-2">
98                   <%= render partial: "pipeline_status_label", locals: {p: p}%>
99                 </div>
100                 <div class="col-md-4">
101                   <%= render_localized_date(p[:finished_at] || p[:modified_at], "noseconds") %>
102                 </div>
103               </div>
104               <div class="row">
105                 <div class="col-md-12">
106                   <% if p[:started_at] and p[:finished_at] %>
107                     <% pipeline_time = p[:finished_at] - p[:started_at] %>
108                     Active for <%= render_runtime(pipeline_time, false) %>
109                   <% end %>
110
111                   <span class="pull-right text-overflow-ellipsis" style="max-width: 100%">
112                     <% outputs = [] %>
113                     <% p.components.each do |k, c| %>
114                       <% outputs << c[:output_uuid] if c[:output_uuid] %>
115                     <% end %>
116                     <% if outputs.size == 0 %>
117                       No output.
118                     <% elsif outputs.size == 1 %>
119                       <i class="fa fa-fw fa-archive"></i> <%= link_to_if_arvados_object outputs[0], friendly_name: true %>
120                     <% else %>
121                       <a href="#<%= p[:uuid] %>-outputs" data-toggle="collapse">Outputs <span class="caret"></span></a>
122                     <% end %>
123                   </span>
124                 </div>
125               </div>
126
127               <div class="row collapse" id="<%= p[:uuid] %>-outputs" >
128                 <div class="col-md-12">
129                   <div class="pull-right" style="max-width: 100%">
130                     <% outputs.each do |out| %>
131                       <div class="text-overflow-ellipsis">
132                         <i class="fa fa-fw fa-archive"></i> <%= link_to_if_arvados_object out, friendly_name: true %>
133                       </div>
134                     <% end %>
135                   </div>
136                 </div>
137               </div>              
138             </div>
139           <% end %>
140         </div>
141       </div>
142     </div>
143
144     <div class="col-md-6">
145       <% nodes = Node.all %>
146       <div class="panel panel-default" style="min-height: 10em">
147         <div class="panel-heading"><span class="panel-title">Compute status</span></div>
148         <div class="panel-body">
149           <div>
150             <%= render partial: 'compute_node_summary', locals: {nodes: nodes} %>
151             <div style="text-align: center">
152               <a data-toggle="collapse" href="#compute_node_status">Details <span class="caret"></span></a>
153             </div>
154           </div>
155           <div id="compute_node_status" class="collapse">
156             <%= render partial: 'compute_node_status', locals: {nodes: nodes} %>
157           </div>
158         </div>
159       </div>
160       <div class="panel panel-default">
161         <div class="panel-heading"><span class="panel-title">Recent collections</span></div>
162         <div class="panel-body">
163           <% r = recent_collections(8) %>
164           <% r[:collections].each do |p| %>
165             <div class="dashboard-panel-info-row">
166             <div>
167               <i class="fa fa-fw fa-folder-o"></i><%= link_to_if_arvados_object r[:owners][p[:owner_uuid]], friendly_name: true %>/
168               <span class="pull-right"><%= render_localized_date(p[:modified_at], "noseconds") %></span>
169             </div>
170             <div class="text-overflow-ellipsis" style="margin-left: 1em; width: 100%"><%= link_to_if_arvados_object p, friendly_name: true %>
171             </div>
172             </div>
173           <% end %>
174         </div>
175       </div>
176     </div>
177   </div>
178
179 </div>