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