1 <%# Copyright (C) The Arvados Authors. All rights reserved.
3 SPDX-License-Identifier: AGPL-3.0 %>
6 recent_procs = recent_processes(12)
8 # preload container_uuids of any container requests
9 recent_crs = recent_procs.map {|p| p if p.is_a?(ContainerRequest)}.compact.uniq
10 recent_cr_containers = recent_crs.map {|cr| cr.container_uuid}.compact.uniq
11 preload_objects_for_dataclass(Container, recent_cr_containers) if recent_cr_containers.andand.any?
13 # fetch children of all the active crs in one call, if there are any
14 active_crs = recent_crs.each {|cr| cr if (cr.priority.andand > 0 and cr.state != 'Final' and cr.container_uuid)}
15 active_cr_uuids = active_crs.map(&:uuid)
16 active_cr_containers = active_crs.map {|cr| cr.container_uuid}.compact.uniq
18 if active_cr_containers.any?
19 active_cr_containers.each { |c| cr_children[c] = []}
20 cols = ContainerRequest.columns.map(&:name) - %w(id updated_at mounts)
21 reqs = ContainerRequest.select(cols).where(requesting_container_uuid: active_cr_containers).results
22 reqs.each {|cr| cr_children[cr.requesting_container_uuid] << cr} if reqs
27 recent_procs.each do |p|
28 if p.uuid.in?(active_cr_uuids)
29 wu = p.work_unit(nil, child_objects=cr_children[p.container_uuid])
37 outputs = outputs.flatten.uniq
39 collection_pdhs = outputs.select {|x| !(m = CollectionsHelper.match(x)).nil?}.uniq.compact
40 collection_uuids = outputs - collection_pdhs
42 if Rails.configuration.show_recent_collections_on_dashboard
43 recent_cs = recent_collections(8)
44 collection_uuids = collection_uuids + recent_cs[:collections].collect {|c| c.uuid}
45 collection_uuids.flatten.uniq
48 preload_collections_for_objects collection_uuids if collection_uuids.any?
49 preload_for_pdhs collection_pdhs if collection_pdhs.any?
50 preload_links_for_objects(collection_pdhs + collection_uuids)
54 recent_procs_panel_width = 6
55 if !PipelineInstance.api_exists?(:index)
56 recent_procs_title = 'Recent processes'
57 run_proc_title = 'Choose a workflow to run:'
58 show_node_status = false
59 # Recent processes panel should take the entire width when is the only one
61 if !Rails.configuration.show_recent_collections_on_dashboard
62 recent_procs_panel_width = 12
65 recent_procs_title = 'Recent pipelines and processes'
66 run_proc_title = 'Choose a pipeline or workflow to run:'
67 show_node_status = true
72 <div class="col-md-<%= recent_procs_panel_width %>">
73 <div class="panel panel-default" style="min-height: 10.5em">
74 <div class="panel-heading">
75 <span class="panel-title"><%=recent_procs_title%></span>
76 <% if current_user.andand.is_active %>
77 <span class="pull-right recent-processes-actions">
80 choose_work_unit_templates_path(
81 title: run_proc_title,
82 action_name: 'Next: choose inputs <i class="fa fa-fw fa-arrow-circle-right"></i>',
83 action_href: work_units_path,
84 action_method: 'post',
85 action_data: {'selection_param' => 'work_unit[template_uuid]', 'work_unit[owner_uuid]' => current_user.uuid, 'success' => 'redirect-to-created-object'}.to_json),
86 { class: "btn btn-primary btn-xs", remote: true }) do %>
87 <i class="fa fa-fw fa-gear"></i> Run a process...
91 <%= link_to all_processes_path, class: 'btn btn-default btn-xs' do %>
92 All processes <i class="fa fa-fw fa-arrow-circle-right"></i>
99 <div class="panel-body recent-processes">
100 <% if recent_procs.empty? %>
101 No recent pipelines or processes.
103 <% wus.each do |p, wu| %>
104 <% if wu.is_finished? %>
105 <div class="dashboard-panel-info-row row-<%=wu.uuid%>">
107 <div class="col-md-6 text-overflow-ellipsis">
108 <%= link_to_if_arvados_object p, {friendly_name: true} %>
110 <div class="col-md-2">
111 <span class="label label-<%=wu.state_bootstrap_class%>"><%=wu.state_label%></span>
113 <div class="col-md-4">
114 <%= render_localized_date(wu.finished_at || wu.modified_at, "noseconds") %>
118 <div class="col-md-12">
119 <% if wu.started_at and wu.finished_at %>
120 <% wu_time = wu.finished_at - wu.started_at %>
121 Active for <%= render_runtime(wu_time, false) %>
124 <%= render partial: 'work_units/show_output', locals: {wu: wu, align: 'pull-right', include_icon: true} %>
130 <div class="dashboard-panel-info-row row-<%=wu.uuid%>">
132 <div class="col-md-6">
133 <%= link_to_if_arvados_object p, {friendly_name: true} %>
135 <% if wu.is_running? %>
136 <div class="col-md-6">
137 <div class="progress" style="margin-bottom: 0px">
142 <div class="col-md-2">
143 <span class="label label-<%=wu.state_bootstrap_class%>"><%=wu.state_label%></span>
149 children = wu.children
150 running = children.select { |c| c.state_label == "Running" }
151 queued = children.select { |c| c.state_label == "Queued" }
154 <div class="clearfix">
155 Started at <%= render_localized_date(wu.started_at || wu.created_at, "noseconds") %>.
156 <% wu_time = Time.now - (wu.started_at || wu.created_at) %>
157 Active for <%= render_runtime(wu_time, false) %>.
159 <div class="pull-right">
160 <% running.each do |r| %>
161 <span class="label label-<%= r.state_bootstrap_class %>"> <%= r.label || r.state_label || 'Not ready' %> </span>
163 <% queued.each do |q| %>
164 <span class="label label-<%= q.state_bootstrap_class %>"> <%= q.label || r.state_label || 'Not ready' %> </span>
176 <div class="col-md-6">
177 <% if show_node_status %>
178 <% nodes = Node.filter([["last_ping_at", ">", Time.now - 3600]]).results %>
179 <div class="panel panel-default" style="min-height: 10.5em">
180 <div class="panel-heading"><span class="panel-title">Compute node status</span>
181 <span class="pull-right compute-node-actions">
182 <% if current_user.andand.is_admin %>
184 <%= link_to nodes_path, class: 'btn btn-default btn-xs' do %>
185 All nodes <i class="fa fa-fw fa-arrow-circle-right"></i>
191 <div class="panel-body compute-node-summary-pane">
193 <%= render partial: 'compute_node_summary', locals: {nodes: nodes} %>
194 <% active_nodes = [] %>
195 <% nodes.sort_by { |n| n.hostname || "" }.each do |n| %>
196 <% if n.crunch_worker_state.in? ["busy", "idle"] %>
197 <% active_nodes << n %>
200 <% if active_nodes.any? %>
201 <div style="text-align: center">
202 <a data-toggle="collapse" href="#compute_node_status">Details <span class="caret"></span></a>
206 <div id="compute_node_status" class="collapse">
207 <%= render partial: 'compute_node_status', locals: {nodes: active_nodes} %>
212 <% if Rails.configuration.show_recent_collections_on_dashboard %>
213 <div class="panel panel-default">
214 <div class="panel-heading"><span class="panel-title">Recent collections</span>
215 <span class="pull-right">
216 <%= link_to collections_path, class: 'btn btn-default btn-xs' do %>
217 All collections <i class="fa fa-fw fa-arrow-circle-right"></i>
221 <div class="panel-body">
222 <% recent_cs[:collections].each do |p| %>
223 <div class="dashboard-panel-info-row">
225 <% if recent_cs[:owners][p[:owner_uuid]].is_a?(Group) %>
226 <i class="fa fa-fw fa-folder-o"></i><%= link_to_if_arvados_object recent_cs[:owners][p[:owner_uuid]], friendly_name: true %>/
228 <span class="pull-right"><%= render_localized_date(p[:modified_at], "noseconds") %></span>
230 <div class="text-overflow-ellipsis" style="margin-left: 1em; width: 100%"><%= link_to_if_arvados_object p, {friendly_name: true, no_tags: true} %>