14965: Mocks FreshBase _poll_time to avoid comparing mock and int
[arvados.git] / apps / workbench / app / views / workflows / _show_definition.html.erb
index f36264783f2580adeefddd786264fc947699b116..f0e01a12ade39e76369edfad83816c0668d77dd3 100644 (file)
@@ -1,3 +1,7 @@
+<%# Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: AGPL-3.0 %>
+
 <%
   wf_def = ActiveSupport::HashWithIndifferentAccess.new YAML::load(@object.definition) if @object.definition
   wf_def = wf_def[:"$graph"].andand[0] || wf_def if wf_def
 
   outputs = wf_def.andand["outputs"]
   items['outputs'] = outputs if outputs
+
+  # preload the collections
+  collections_pdhs = []
+  items.each do |k, v|
+    v.to_s.scan(/([0-9a-f]{32}\+\d+)/).each {|l| collections_pdhs += l}
+  end
+  collections_pdhs.compact.uniq
+  preload_for_pdhs collections_pdhs if collections_pdhs.any?
+  preload_links_for_objects collections_pdhs if collections_pdhs.any?
 %>
 
   <div class="col-md-12">
-    <table style="width:100%;">
+    <table class="table table-condensed" style="table-layout:fixed;">
       <col width="15%" />
       <col width="85%" />
 
       <% items.each do |k, v| %>
-        <% if ['baseCommand', 'arguments'].include? k %>
-          <tr>
-            <td valign="top">
-              <%= k %>:
-            </td>
-            <td>
-              <div style="max-height:200px; overflow-y:auto;">
-                <%=v%>
-              </div>
-            </td>
-          </tr>
-        <% end %>
-
-        <% if ['inputs', 'outputs'].include? k %>
-          <tr>
-            <td valign="top">
-              <%= k %>:
-            </td>
-            <td>
-              <% val = JSON.pretty_generate(v) %>
-              <div style="max-height:300px; overflow:auto;">
-                <% val.each_line do |l| %>
-                  <% text_part = l %>
-                  <% match = l.match /\"keep:.*?\"/ %>
-                  <% if match %>
-                    <% text_part = l[0..l.index("\"keep:")-1] %>
-                    <% loc_part = match[0][6..-2] %>
-                  <% end %>
-                  <span style="white-space: pre-wrap; margin: none;"><%= text_part %><%= if loc_part then link_to_arvados_object_if_readable(loc_part, loc_part, friendly_name: true) end %> <% if loc_part then %> <br/> <% end %></span>
-                <% end %>
-              </div>
-            </td>
-          </tr>
-        <% end %>
-
-        <% if k == 'hints' %>
           <tr>
             <td valign="top">
               <%= k %>:
             </td>
             <td>
               <% val = JSON.pretty_generate(v) %>
-              <div style="max-height:300px; overflow:auto;">
-                <% val.each_line do |l| %>
-                  <% text_part = l %>
-                  <% match = l.match /\"keep:.*?\"/ %>
-                  <% if match %>
-                    <% text_part = l[0..l.index("\"keep:")-1] %>
-                    <% loc_part = match[0][6..-2] %>
-                  <% end %>
-                  <span style="white-space: pre-wrap; margin: none;"><%= text_part %><%= if loc_part then link_to_arvados_object_if_readable(loc_part, loc_part, friendly_name: true) end %> <% if loc_part then %> <br/> <% end %></span>
-                <% end %>
-              </div>
+              <%= render partial: 'show_text_with_locators', locals: {data_height: 300, text_data: val} %>
             </td>
           </tr>
-        <% end %>
       <% end %>
     </table>
   </div>