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)}
18 recent_procs.each do |p|
24 outputs = outputs.flatten.uniq
26 collection_pdhs = outputs.select {|x| !(m = CollectionsHelper.match(x)).nil?}.uniq.compact
27 collection_uuids = outputs - collection_pdhs
29 if Rails.configuration.show_recent_collections_on_dashboard
30 recent_cs = recent_collections(8)
31 collection_uuids = collection_uuids + recent_cs[:collections].collect {|c| c.uuid}
32 collection_uuids.flatten.uniq
35 preload_collections_for_objects collection_uuids if collection_uuids.any?
36 preload_for_pdhs collection_pdhs if collection_pdhs.any?
37 preload_links_for_objects(collection_pdhs + collection_uuids)
41 recent_procs_panel_width = 6
42 if !PipelineInstance.api_exists?(:index)
43 recent_procs_title = 'Recent processes'
44 run_proc_title = 'Choose a workflow to run:'
45 show_node_status = false
46 # Recent processes panel should take the entire width when is the only one
48 if !Rails.configuration.show_recent_collections_on_dashboard
49 recent_procs_panel_width = 12
52 recent_procs_title = 'Recent pipelines and processes'
53 run_proc_title = 'Choose a pipeline or workflow to run:'
54 show_node_status = true
59 <div class="col-md-<%= recent_procs_panel_width %>">
60 <div class="panel panel-default" style="min-height: 10.5em">
61 <div class="panel-heading">
62 <span class="panel-title"><%=recent_procs_title%></span>
63 <% if current_user.andand.is_active %>
64 <span class="pull-right recent-processes-actions">
67 choose_work_unit_templates_path(
68 title: run_proc_title,
69 action_name: 'Next: choose inputs <i class="fa fa-fw fa-arrow-circle-right"></i>',
70 action_href: work_units_path,
71 action_method: 'post',
72 action_data: {'selection_param' => 'work_unit[template_uuid]', 'work_unit[owner_uuid]' => current_user.uuid, 'success' => 'redirect-to-created-object'}.to_json),
73 { class: "btn btn-primary btn-xs", remote: true }) do %>
74 <i class="fa fa-fw fa-gear"></i> Run a process...
78 <%= link_to all_processes_path, class: 'btn btn-default btn-xs' do %>
79 All processes <i class="fa fa-fw fa-arrow-circle-right"></i>
86 <div class="panel-body recent-processes">
87 <% if recent_procs.empty? %>
88 No recent pipelines or processes.
90 <% wus.each do |p, wu| %>
91 <% if wu.is_finished? %>
92 <div class="dashboard-panel-info-row row-<%=wu.uuid%>">
94 <div class="col-md-6 text-overflow-ellipsis">
95 <%= link_to_if_arvados_object p, {friendly_name: true} %>
97 <div class="col-md-2">
98 <span class="label label-<%=wu.state_bootstrap_class%>"><%=wu.state_label%></span>
100 <div class="col-md-4">
101 <%= render_localized_date(wu.finished_at || wu.modified_at, "noseconds") %>
105 <div class="col-md-12">
106 <% if wu.started_at and wu.finished_at %>
107 <% wu_time = wu.finished_at - wu.started_at %>
108 Active for <%= render_runtime(wu_time, false) %>
111 <%= render partial: 'work_units/show_output', locals: {wu: wu, align: 'pull-right', include_icon: true} %>
117 <div class="dashboard-panel-info-row row-<%=wu.uuid%>">
119 <div class="col-md-6 text-overflow-ellipsis">
120 <%= link_to_if_arvados_object p, {friendly_name: true} %>
122 <div class="col-md-2">
123 <span class="label label-<%=wu.state_bootstrap_class%>"><%=wu.state_label%></span>
127 <div class="clearfix">
128 <% if wu.started_at %>
129 Started at <%= render_localized_date(wu.started_at, "noseconds") %>
130 Active for <%= render_runtime(Time.now - wu.started_at, false) %>.
132 Created at <%= render_localized_date(wu.created_at, "noseconds") %>.
133 <% if wu.state_label == 'Queued' %>
134 Queued for <%= render_runtime(Time.now - wu.created_at, false) %>.
146 <div class="col-md-6">
147 <% if show_node_status %>
148 <% nodes = Node.filter([["last_ping_at", ">", Time.now - 3600]]).results %>
149 <div class="panel panel-default" style="min-height: 10.5em">
150 <div class="panel-heading"><span class="panel-title">Compute node status</span>
151 <span class="pull-right compute-node-actions">
152 <% if current_user.andand.is_admin %>
154 <%= link_to nodes_path, class: 'btn btn-default btn-xs' do %>
155 All nodes <i class="fa fa-fw fa-arrow-circle-right"></i>
161 <div class="panel-body compute-node-summary-pane">
163 <%= render partial: 'compute_node_summary', locals: {nodes: nodes} %>
164 <% active_nodes = [] %>
165 <% nodes.sort_by { |n| n.hostname || "" }.each do |n| %>
166 <% if n.crunch_worker_state.in? ["busy", "idle"] %>
167 <% active_nodes << n %>
170 <% if active_nodes.any? %>
171 <div style="text-align: center">
172 <a data-toggle="collapse" href="#compute_node_status">Details <span class="caret"></span></a>
176 <div id="compute_node_status" class="collapse">
177 <%= render partial: 'compute_node_status', locals: {nodes: active_nodes} %>
182 <% if Rails.configuration.show_recent_collections_on_dashboard %>
183 <div class="panel panel-default">
184 <div class="panel-heading"><span class="panel-title">Recent collections</span>
185 <span class="pull-right">
186 <%= link_to collections_path, class: 'btn btn-default btn-xs' do %>
187 All collections <i class="fa fa-fw fa-arrow-circle-right"></i>
191 <div class="panel-body">
192 <% recent_cs[:collections].each do |p| %>
193 <div class="dashboard-panel-info-row">
195 <% if recent_cs[:owners][p[:owner_uuid]].is_a?(Group) %>
196 <i class="fa fa-fw fa-folder-o"></i><%= link_to_if_arvados_object recent_cs[:owners][p[:owner_uuid]], friendly_name: true %>/
198 <span class="pull-right"><%= render_localized_date(p[:modified_at], "noseconds") %></span>
200 <div class="text-overflow-ellipsis" style="margin-left: 1em; width: 100%"><%= link_to_if_arvados_object p, {friendly_name: true, no_tags: true} %>