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?
15 recent_procs.each do |p|
21 outputs = outputs.flatten.uniq
23 collection_pdhs = outputs.select {|x| !(m = CollectionsHelper.match(x)).nil?}.uniq.compact
24 collection_uuids = outputs - collection_pdhs
26 if Rails.configuration.Workbench.ShowRecentCollectionsOnDashboard
27 recent_cs = recent_collections(8)
28 collection_uuids = collection_uuids + recent_cs[:collections].collect {|c| c.uuid}
29 collection_uuids.flatten.uniq
32 preload_collections_for_objects collection_uuids if collection_uuids.any?
33 preload_for_pdhs collection_pdhs if collection_pdhs.any?
34 preload_links_for_objects(collection_pdhs + collection_uuids)
38 recent_procs_panel_width = 6
39 if !PipelineInstance.api_exists?(:create)
40 recent_procs_title = 'Recent processes'
41 run_proc_title = 'Choose a workflow to run:'
42 show_node_status = false
43 # Recent processes panel should take the entire width when is the only one
45 if !Rails.configuration.Workbench.ShowRecentCollectionsOnDashboard
46 recent_procs_panel_width = 12
49 recent_procs_title = 'Recent pipelines and processes'
50 run_proc_title = 'Choose a pipeline or workflow to run:'
51 show_node_status = true
56 <div class="col-md-<%= recent_procs_panel_width %>">
57 <div class="panel panel-default" style="min-height: 10.5em">
58 <div class="panel-heading">
59 <span class="panel-title"><%=recent_procs_title%></span>
60 <% if current_user.andand.is_active %>
61 <span class="pull-right recent-processes-actions">
64 choose_work_unit_templates_path(
65 title: run_proc_title,
66 action_name: 'Next: choose inputs <i class="fa fa-fw fa-arrow-circle-right"></i>',
67 action_href: work_units_path,
68 action_method: 'post',
69 action_data: {'selection_param' => 'work_unit[template_uuid]', 'work_unit[owner_uuid]' => current_user.uuid, 'success' => 'redirect-to-created-object'}.to_json),
70 { class: "btn btn-primary btn-xs", remote: true }) do %>
71 <i class="fa fa-fw fa-gear"></i> Run a process...
75 <%= link_to all_processes_path, class: 'btn btn-default btn-xs' do %>
76 All processes <i class="fa fa-fw fa-arrow-circle-right"></i>
83 <div class="panel-body recent-processes">
84 <% if recent_procs.empty? %>
85 No recent pipelines or processes.
87 <% wus.each do |p, wu| %>
89 # Set up tooltip containing useful runtime information
90 runtime_status_tooltip = nil
92 if wu.runtime_status[:error]
93 runtime_status_tooltip = "Error: #{wu.runtime_status[:error]}"
94 elsif wu.runtime_status[:warning]
95 runtime_status_tooltip = "Warning: #{wu.runtime_status[:warning]}"
99 <% if wu.is_finished? %>
100 <div class="dashboard-panel-info-row row-<%=wu.uuid%>" title="<%=sanitize(runtime_status_tooltip)%>">
102 <div class="col-md-6 text-overflow-ellipsis">
103 <%= link_to_if_arvados_object p, {friendly_name: true} %>
105 <div class="col-md-2">
106 <span class="label label-<%=wu.state_bootstrap_class%>"><%=wu.state_label%></span>
108 <div class="col-md-4">
109 <%= render_localized_date(wu.finished_at || wu.modified_at, "noseconds") %>
113 <div class="col-md-12">
114 <% if wu.started_at and wu.finished_at %>
115 <% wu_time = wu.finished_at - wu.started_at %>
116 Active for <%= render_runtime(wu_time, false) %>
119 <%= render partial: 'work_units/show_output', locals: {wu: wu, align: 'pull-right', include_icon: true} %>
125 <div class="dashboard-panel-info-row row-<%=wu.uuid%>" title="<%=sanitize(runtime_status_tooltip)%>">
127 <div class="col-md-6 text-overflow-ellipsis">
128 <%= link_to_if_arvados_object p, {friendly_name: true} %>
130 <div class="col-md-2">
131 <span class="label label-<%=wu.state_bootstrap_class%>"><%=wu.state_label%></span>
135 <div class="clearfix">
136 <% if wu.started_at %>
137 Started at <%= render_localized_date(wu.started_at, "noseconds") %>
138 Active for <%= render_runtime(Time.now - wu.started_at, false) %>.
140 Created at <%= render_localized_date(wu.created_at, "noseconds") %>.
141 <% if wu.state_label == 'Queued' %>
142 Queued for <%= render_runtime(Time.now - wu.created_at, false) %>.
154 <div class="col-md-6">
155 <% if show_node_status %>
156 <% nodes = Node.filter([["last_ping_at", ">", Time.now - 3600]]).results %>
157 <div class="panel panel-default" style="min-height: 10.5em">
158 <div class="panel-heading"><span class="panel-title">Compute node status</span>
159 <span class="pull-right compute-node-actions">
160 <% if current_user.andand.is_admin %>
162 <%= link_to nodes_path, class: 'btn btn-default btn-xs' do %>
163 All nodes <i class="fa fa-fw fa-arrow-circle-right"></i>
169 <div class="panel-body compute-node-summary-pane">
171 <%= render partial: 'compute_node_summary', locals: {nodes: nodes} %>
172 <% active_nodes = [] %>
173 <% nodes.sort_by { |n| n.hostname || "" }.each do |n| %>
174 <% if n.crunch_worker_state.in? ["busy", "idle"] %>
175 <% active_nodes << n %>
178 <% if active_nodes.any? %>
179 <div style="text-align: center">
180 <a data-toggle="collapse" href="#compute_node_status">Details <span class="caret"></span></a>
184 <div id="compute_node_status" class="collapse">
185 <%= render partial: 'compute_node_status', locals: {nodes: active_nodes} %>
190 <% if Container.api_exists?(:index) %>
191 <div class="panel panel-default" style="min-height: 10.5em">
192 <div class="panel-heading"><span class="panel-title">Container status</span></div>
193 <div class="panel-body containers-summary-pane">
195 <%= render partial: 'container_summary' %>
200 <% if Rails.configuration.Workbench.ShowRecentCollectionsOnDashboard %>
201 <div class="panel panel-default">
202 <div class="panel-heading"><span class="panel-title">Recent collections</span>
203 <span class="pull-right">
204 <%= link_to collections_path, class: 'btn btn-default btn-xs' do %>
205 All collections <i class="fa fa-fw fa-arrow-circle-right"></i>
209 <div class="panel-body">
210 <% recent_cs[:collections].each do |p| %>
211 <div class="dashboard-panel-info-row">
213 <% if recent_cs[:owners][p[:owner_uuid]].is_a?(Group) %>
214 <i class="fa fa-fw fa-folder-o"></i><%= link_to_if_arvados_object recent_cs[:owners][p[:owner_uuid]], friendly_name: true %>/
216 <span class="pull-right"><%= render_localized_date(p[:modified_at], "noseconds") %></span>
218 <div class="text-overflow-ellipsis" style="margin-left: 1em; width: 100%"><%= link_to_if_arvados_object p, {friendly_name: true, no_tags: true} %>