7753: Add a Log link to pipeline_instance component panel
[arvados.git] / apps / workbench / app / views / pipeline_instances / _show_log.html.erb
index 2fdb45bdb681eacfe41e53d79de5e04857929435..3a4ec4ead092a68bcd4e1031287019730f55b030 100644 (file)
@@ -1,6 +1,45 @@
-<% log_history = stderr_log_history([@object.uuid] + pipeline_jobs(@object).collect{|x|x[:job].andand[:uuid]}.compact) %>
-<div class="arv-log-event-listener arv-log-event-handler-append-logs arv-job-log-window" id="pipeline_event_log_div" data-object-uuids="<%= @object.uuid %>" data-object-uuids-live="#Components tr[data-object-uuid]">
-  <% log_history.each do |entry| %>
-    <%=entry%><br/>
-  <% end %>
-</div>
+<% log_ids = @object.job_log_ids
+   job_ids = @object.job_ids
+   still_logging, done_logging = log_ids.keys.partition { |k| log_ids[k].nil? }
+%>
+
+<% unless done_logging.empty? %>
+  <table class="topalign table table-condensed table-fixedlayout">
+    <colgroup>
+      <col width="40%" />
+      <col width="60%" />
+    </colgroup>
+    <thead>
+      <tr>
+        <th>finished component</th>
+        <th>job log</th>
+      </tr>
+    </thead>
+    <tbody>
+      <% done_logging.each do |cname| %>
+      <tr>
+        <td><%= cname %></td>
+        <td><%= link_to("Log for #{cname}",
+                job_path(job_ids[cname], anchor: "Log"))
+                %></td>
+      </tr>
+      <% end %>
+    </tbody>
+  </table>
+<% end %>
+
+<% unless still_logging.empty? %>
+  <h4>Logs in progress</h4>
+
+  <div id="event_log_div"
+       class="arv-log-event-listener arv-log-event-handler-append-logs arv-log-event-subscribe-to-pipeline-job-uuids arv-job-log-window"
+       data-object-uuids="<%= @object.stderr_log_object_uuids.join(' ') %>"
+       ><%= @object.stderr_log_lines.join("\n") %></div>
+
+  <%# Applying a long throttle suppresses the auto-refresh of this
+      partial that would normally be triggered by arv-log-event. %>
+  <div class="arv-log-refresh-control"
+       data-load-throttle="86486400000" <%# 1001 nights %>
+       ></div>
+<% end %>
+