Merge branch '13023-wb-log-newlines'
[arvados.git] / apps / workbench / app / views / work_units / _show_log.html.erb
index 6a0916fe9853b2ecd6ca10bbc3fa4d94923ebbb8..1f643acdc9ff6a1dc042a3de86f6ab9a78357481 100644 (file)
@@ -1,3 +1,7 @@
+<%# Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: AGPL-3.0 %>
+
 <% wu = obj.work_unit(name) %>
 
 <% render_log = wu.render_log %>
   </div>
 <% end %>
 
-<%# Show log in terminal window %>
+<% live_log_lines = wu.live_log_lines(Rails.configuration.running_job_log_records_to_fetch).join("\n") %>
+<% if !render_log or (live_log_lines.size > 0) %>
+<%# Still running, or recently finished and logs are still available from logs table %>
+<%# Show recent logs in terminal window %>
 <h4>Recent logs</h4>
-<div id="event_log_div"
+<pre id="event_log_div"
      class="arv-log-event-listener arv-log-event-handler-append-logs arv-job-log-window"
      data-object-uuids="<%= wu.log_object_uuids.join(' ') %>"
-  ><%= wu.live_log_lines(Rails.configuration.running_job_log_records_to_fetch).join("\n") %>
-</div>
+  ><%= live_log_lines %>
+</pre>
 
 <%# 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 %>