4266: Merge branch 'master' into 4266-log-performance
[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: 10.5em">
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         <% _running_pipelines = running_pipelines %>
21         <% _finished_pipelines = finished_pipelines(8) %>
22         <% lookup = preload_objects_for_dataclass PipelineTemplate, (_running_pipelines.map(&:pipeline_template_uuid) + _finished_pipelines.map(&:pipeline_template_uuid)) %>
23
24         <div class="panel-body">
25           <% if _running_pipelines.empty? %>
26             No pipelines are currently running.
27           <% else %>
28           <% _running_pipelines.each do |p| %>
29             <div class="dashboard-panel-info-row">
30               <div class="clearfix">
31                 <%= link_to_if_arvados_object p, {friendly_name: true, lookup: lookup} %>
32
33                 <div class="pull-right" style="width: 40%">
34                   <div class="progress" style="margin-bottom: 0px">
35                     <% p.components.each do |k, v| %>
36                       <% if v.is_a? Hash and v[:job] %>
37                         <%= render partial: 'job_progress', locals: {:j => v[:job], :scaleby => (1.0/p.components.size)} %>
38                       <% end %>
39                     <% end %>
40                   </div>
41                 </div>
42               </div>
43
44               <%
45                 running = p.components.select { |k, c| c.is_a? Hash and c[:job].andand[:state] == "Running" }
46                 queued = p.components.select { |k, c| c.is_a? Hash and c[:job].andand[:state] == "Queued" }
47                 %>
48
49               <div class="clearfix">
50                 Started at <%= render_localized_date(p[:started_at] || p[:created_at], "noseconds") %>.
51                 <% pipeline_time = Time.now - (p[:started_at] || p[:created_at]) %>
52                 Active for <%= render_runtime(pipeline_time, false) %>.
53
54                 <div class="pull-right">
55                   <% running.each do |k,v| %>
56                     <%= render partial: 'job_progress', locals: {:j => v[:job], :show_progress_bar => false, :title => k} %>
57                   <% end %>
58                   <% queued.each do |k,v| %>
59                     <%= render partial: 'job_progress', locals: {:j => v[:job], :show_progress_bar => false, :title => k} %>
60                   <% end %>
61                 </div>
62               </div>
63             </div>
64           <% end %>
65           <% end %>
66           </div>
67       </div>
68
69       <div class="panel panel-default">
70         <div class="panel-heading"><span class="panel-title">Recently finished pipelines</span>
71           <span class="pull-right">
72             <%= link_to pipeline_instances_path, class: 'btn btn-default btn-xs' do %>
73               All pipelines <i class="fa fa-fw fa-arrow-circle-right"></i>
74             <% end %>
75           </span>
76         </div>
77         <div class="panel-body">
78           <% _finished_pipelines.each do |p| %>
79             <div class="dashboard-panel-info-row">
80               <div class="row">
81                 <div class="col-md-6 text-overflow-ellipsis">
82                   <%= link_to_if_arvados_object p, {friendly_name: true, lookup: lookup} %>
83                 </div>
84                 <div class="col-md-2">
85                   <%= render partial: "pipeline_status_label", locals: {p: p}%>
86                 </div>
87                 <div class="col-md-4">
88                   <%= render_localized_date(p[:finished_at] || p[:modified_at], "noseconds") %>
89                 </div>
90               </div>
91               <div class="row">
92                 <div class="col-md-12">
93                   <% if p[:started_at] and p[:finished_at] %>
94                     <% pipeline_time = p[:finished_at] - p[:started_at] %>
95                     Active for <%= render_runtime(pipeline_time, false) %>
96                   <% end %>
97
98                   <span class="pull-right text-overflow-ellipsis" style="max-width: 100%">
99                     <% outputs = [] %>
100                     <% p.components.each do |k, c| %>
101                       <% outputs << c[:output_uuid] if c[:output_uuid] %>
102                     <% end %>
103                     <% if outputs.size == 0 %>
104                       No output.
105                     <% elsif outputs.size == 1 %>
106                       <i class="fa fa-fw fa-archive"></i> <%= link_to_if_arvados_object outputs[0], friendly_name: true %>
107                     <% else %>
108                       <a href="#<%= p[:uuid] %>-outputs" data-toggle="collapse">Outputs <span class="caret"></span></a>
109                     <% end %>
110                   </span>
111                 </div>
112               </div>
113
114               <div class="row collapse" id="<%= p[:uuid] %>-outputs" >
115                 <div class="col-md-12">
116                   <div class="pull-right" style="max-width: 100%">
117                     <% outputs.each do |out| %>
118                       <div class="text-overflow-ellipsis">
119                         <i class="fa fa-fw fa-archive"></i> <%= link_to_if_arvados_object out, friendly_name: true %>
120                       </div>
121                     <% end %>
122                   </div>
123                 </div>
124               </div>
125             </div>
126           <% end %>
127         </div>
128       </div>
129     </div>
130
131     <div class="col-md-6">
132       <% nodes = Node.all %>
133       <div class="panel panel-default" style="min-height: 10.5em">
134         <div class="panel-heading"><span class="panel-title">Compute and job status</span>
135           <span class="pull-right">
136             <%= link_to jobs_path, class: 'btn btn-default btn-xs' do %>
137               All jobs <i class="fa fa-fw fa-arrow-circle-right"></i>
138             <% end %>
139           </span>
140         </div>
141         <div class="panel-body">
142           <div>
143             <%= render partial: 'compute_node_summary', locals: {nodes: nodes} %>
144             <div style="text-align: center">
145               <a data-toggle="collapse" href="#compute_node_status">Details <span class="caret"></span></a>
146             </div>
147           </div>
148           <div id="compute_node_status" class="collapse">
149             <%= render partial: 'compute_node_status', locals: {nodes: nodes} %>
150           </div>
151         </div>
152       </div>
153       <div class="panel panel-default">
154         <div class="panel-heading"><span class="panel-title">Recent collections</span>
155           <span class="pull-right">
156             <%= link_to collections_path, class: 'btn btn-default btn-xs' do %>
157               All collections <i class="fa fa-fw fa-arrow-circle-right"></i>
158             <% end %>
159           </span>
160         </div>
161         <div class="panel-body">
162           <% r = recent_collections(8) %>
163           <% r[:collections].each do |p| %>
164             <div class="dashboard-panel-info-row">
165             <div>
166               <i class="fa fa-fw fa-folder-o"></i><%= link_to_if_arvados_object r[:owners][p[:owner_uuid]], friendly_name: true %>/
167               <span class="pull-right"><%= render_localized_date(p[:modified_at], "noseconds") %></span>
168             </div>
169             <div class="text-overflow-ellipsis" style="margin-left: 1em; width: 100%"><%= link_to_if_arvados_object p, {friendly_name: true, no_tags: true} %>
170             </div>
171             </div>
172           <% end %>
173         </div>
174       </div>
175     </div>
176   </div>
177
178 </div>