10079: Move Log and Output links into child details. This will make it possible
authorradhika <radhika@curoverse.com>
Thu, 13 Oct 2016 21:21:04 +0000 (17:21 -0400)
committerradhika <radhika@curoverse.com>
Tue, 25 Oct 2016 22:25:40 +0000 (18:25 -0400)
to not need tt preload the jobs and outputs during the pipeline display. Instead,
they can be fetched when the child panel is expanded by the user.

apps/workbench/app/views/work_units/_component_detail.html.erb
apps/workbench/app/views/work_units/_show_child.html.erb
apps/workbench/app/views/work_units/_show_component.html.erb

index 7d588bace69d05651ca675a4069fa4ecafcd27be..00856118e39109ccbbe0f6327d82db7816d02aaf 100644 (file)
@@ -1,3 +1,15 @@
+<%
+  collections = current_obj.outputs.flatten.uniq
+  collections << current_obj.docker_image
+  collections = collections.compact.uniq
+  collections_pdhs = collections.select {|x| !(m = CollectionsHelper.match(x)).nil?}.uniq.compact
+  collections_uuids = collections - collections_pdhs
+  preload_collections_for_objects collections_uuids if collections_uuids.any?
+  preload_for_pdhs collections_pdhs if collections_pdhs.any?
+
+  preload_objects_for_dataclass(Repository, [current_obj.repository], :name) if current_obj.repository
+%>
+
       <div class="container">
         <div class="row">
           <div class="col-md-5">
@@ -6,7 +18,8 @@
             <% else %>
             <table>
               <% keys = [:uuid, :modified_by_user_uuid, :created_at, :started_at, :finished_at, :container_uuid, :priority] %>
-              <% keys << :outputs if @object.uuid == current_obj.uuid %>
+              <% keys << :log_collection if @object.uuid != current_obj.uuid %>
+              <% keys << :outputs %>
               <% keys.each do |k| %>
                 <% val = current_obj.send(k) if current_obj.respond_to?(k) %>
                 <% has_val = val %>
@@ -29,6 +42,8 @@
                       <% else %>
                         <%= render partial: 'work_units/show_outputs', locals: {id: current_obj.uuid, outputs: val, align:""} %>
                       <% end %>
+                    <% elsif k == :log_collection %>
+                      <%= render partial: 'work_units/show_log_link', locals: {wu: current_obj} %>
                     <% else %>
                       <%= val %>
                     <% end %>
index 2693334bc21404b0631e313d08a73311cd369f91..0e918be9d9bb01ef6c6c3fd4babcefa17f97bcef 100644 (file)
@@ -1,7 +1,7 @@
 <div class="panel panel-default">
   <div class="panel-heading">
       <div class="row">
-        <div class="col-md-2" style="word-break:break-all;">
+        <div class="col-md-3" style="word-break:break-all;">
           <h4 class="panel-title">
             <a data-toggle="collapse" href="#collapse<%= i %>">
               <%= current_obj.label %> <span class="caret"></span>
         </div>
 
         <% if not current_obj %>
-          <div class="col-md-8"></div>
+          <div class="col-md-7"></div>
         <% else %>
-          <div class="col-md-1">
-            <%= render partial: 'work_units/show_log_link', locals: {wu: current_obj} %>
-          </div>
-
           <% walltime = current_obj.walltime %>
           <% cputime = current_obj.cputime %>
           <div class="col-md-3">
                 <%= current_obj.child_summary_str %>
               </span>
             </div>
-          <% elsif current_obj.is_finished? %>
-            <div class="col-md-3 text-overflow-ellipsis">
-              <% outputs = current_obj.outputs %>
-              <% if outputs.any? %>
-                <% if outputs.size == 1 %>
-                  <%= link_to_arvados_object_if_readable(outputs[0], 'Output data not available', link_text: "Output of #{current_obj.label}") %>
-                <% else %>
-                  <%= render partial: 'work_units/show_outputs', locals: {id: current_obj.uuid, outputs: outputs, align:"pull-right"} %>
-                <% end %>
-              <% else %>
-                No output.
-              <% end %>
-            </div>
           <% end %>
 
           <div class="col-md-1 pipeline-instance-spacing">
index 4feb292209689f069de1e4c6911257730b5f31c9..4c0f66095a88251932b6e22febddd64275886256 100644 (file)
 </p>
 
 <%# Work unit children %>
-
-<%
-  uuids = wu.children.collect {|c| c.uuid}.compact
-  if uuids.any?
-    resource_class = resource_class_for_uuid(uuids.first, friendly_name: true)
-
-    start = 0; inc = 200
-    while start < uuids.length
-      preload_objects_for_dataclass resource_class, uuids[start, inc]
-      start += inc
-    end
-  end
-
-  collections = wu.outputs.flatten.uniq
-  collections << wu.log_collection if wu.log_collection
-  collections << wu.docker_image if wu.docker_image
-  collections = wu.children.collect {|j| j.outputs}.compact
-  collections = collections.flatten.uniq
-  collections.concat wu.children.collect {|j| j.docker_image}.uniq.compact
-  collections.concat wu.children.collect {|j| j.log_collection}.uniq.compact
-  collections_pdhs = collections.select {|x| !(m = CollectionsHelper.match(x)).nil?}.uniq.compact
-  collections_uuids = collections - collections_pdhs
-
-  if collections_uuids.any?
-    start = 0; inc = 200
-    while start < collections_uuids.length
-      preload_collections_for_objects collections_uuids[start, inc]
-      start += inc
-    end
-  end
-
-  if collections_pdhs.any?
-    start = 0; inc = 200
-    while start < collections_pdhs.length
-      preload_for_pdhs collections_pdhs[start, inc]
-      start += inc
-    end
-  end
-
-  repos = wu.children.collect {|c| c.repository}.uniq.compact
-  preload_objects_for_dataclass(Repository, repos, :name) if repos.any?
-%>
-
 <% if wu.has_unreadable_children %>
   <%= render(partial: "pipeline_instances/show_components_json",
              locals: {error_name: "Unreadable components", backtrace: nil, wu: wu}) %>