[ARVADOS] updated: e6cd7c31ee28851d3ead992437fc93f2fc73ef92

Git user git at public.curoverse.com
Tue Jul 19 16:03:40 EDT 2016


Summary of changes:
 .../app/assets/javascripts/infinite_scroll.js      |  1 +
 .../app/controllers/application_controller.rb      | 22 +++++++
 .../app/controllers/projects_controller.rb         | 16 +----
 .../app/controllers/work_units_controller.rb       | 37 ++++++++++++
 apps/workbench/app/models/pipeline_instance.rb     |  2 +-
 apps/workbench/app/models/proxy_work_unit.rb       |  6 ++
 apps/workbench/app/models/work_unit.rb             |  4 ++
 .../application/_delete_object_button.html.erb     |  2 +-
 .../views/container_requests/_show_log.html.erb    |  2 +-
 .../views/container_requests/_show_status.html.erb |  2 +-
 .../app/views/containers/_show_log.html.erb        |  2 +-
 .../app/views/containers/_show_status.html.erb     |  2 +-
 .../workbench/app/views/jobs/_show_status.html.erb |  2 +-
 .../pipeline_instances/_show_components.html.erb   |  2 +-
 .../app/views/projects/_show_dashboard.html.erb    | 20 +------
 .../app/views/work_unit/_show_status.html.erb      |  6 --
 .../_component_detail.html.erb                     |  2 +-
 .../{work_unit => work_units}/_progress.html.erb   |  0
 .../views/work_units/_show_all_processes.html.erb  | 51 ++++++++++++++++
 .../work_units/_show_all_processes_rows.html.erb   | 23 ++++++++
 .../{work_unit => work_units}/_show_child.html.erb |  6 +-
 .../_show_component.html.erb                       |  6 +-
 .../{work_unit => work_units}/_show_log.html.erb   |  0
 .../app/views/work_units/_show_output.html.erb     | 13 +++++
 .../_show_outputs.html.erb                         |  0
 .../app/views/work_units/_show_status.html.erb     |  6 ++
 apps/workbench/app/views/work_units/index.html.erb |  1 +
 .../workbench}/config/initializers/time_format.rb  |  0
 apps/workbench/config/routes.rb                    |  1 +
 .../test/controllers/projects_controller_test.rb   | 28 ++++++---
 .../test/controllers/work_units_controller_test.rb | 68 ++++++++++++++++++++++
 .../test/integration/application_layout_test.rb    |  3 +-
 apps/workbench/test/integration/work_units_test.rb | 58 ++++++++++++++++++
 33 files changed, 331 insertions(+), 63 deletions(-)
 create mode 100644 apps/workbench/app/controllers/work_units_controller.rb
 delete mode 100644 apps/workbench/app/views/work_unit/_show_status.html.erb
 rename apps/workbench/app/views/{work_unit => work_units}/_component_detail.html.erb (97%)
 rename apps/workbench/app/views/{work_unit => work_units}/_progress.html.erb (100%)
 create mode 100644 apps/workbench/app/views/work_units/_show_all_processes.html.erb
 create mode 100644 apps/workbench/app/views/work_units/_show_all_processes_rows.html.erb
 rename apps/workbench/app/views/{work_unit => work_units}/_show_child.html.erb (89%)
 rename apps/workbench/app/views/{work_unit => work_units}/_show_component.html.erb (89%)
 rename apps/workbench/app/views/{work_unit => work_units}/_show_log.html.erb (100%)
 create mode 100644 apps/workbench/app/views/work_units/_show_output.html.erb
 rename apps/workbench/app/views/{work_unit => work_units}/_show_outputs.html.erb (100%)
 create mode 100644 apps/workbench/app/views/work_units/_show_status.html.erb
 create mode 100644 apps/workbench/app/views/work_units/index.html.erb
 copy {services/api => apps/workbench}/config/initializers/time_format.rb (100%)
 create mode 100644 apps/workbench/test/controllers/work_units_controller_test.rb
 create mode 100644 apps/workbench/test/integration/work_units_test.rb

       via  e6cd7c31ee28851d3ead992437fc93f2fc73ef92 (commit)
       via  4ed794e2803ef9812dbc7ae938a8e17b3b9714c1 (commit)
      from  5b1176df5257cd16350fb4da5a6d6157c58a0a0f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit e6cd7c31ee28851d3ead992437fc93f2fc73ef92
Merge: 5b1176d 4ed794e
Author: radhika <radhika at curoverse.com>
Date:   Tue Jul 19 16:03:23 2016 -0400

    closes #9319
    Merge branch '9319-all-processes-index'


commit 4ed794e2803ef9812dbc7ae938a8e17b3b9714c1
Author: radhika <radhika at curoverse.com>
Date:   Tue Jul 5 19:13:13 2016 -0400

    9319: /all_processes index page.

diff --git a/apps/workbench/app/assets/javascripts/infinite_scroll.js b/apps/workbench/app/assets/javascripts/infinite_scroll.js
index a0c9efc..b89ac81 100644
--- a/apps/workbench/app/assets/javascripts/infinite_scroll.js
+++ b/apps/workbench/app/assets/javascripts/infinite_scroll.js
@@ -130,6 +130,7 @@ function maybe_load_more_content(event) {
                 $container.find(".spinner").detach();
                 $container.append(data.content);
                 $container.attr('data-infinite-content-href', data.next_page_href);
+                ping_all_scrollers();
             });
      }
 }
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 648cae8..10c33c3 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -241,6 +241,28 @@ class ApplicationController < ActionController::Base
     end
   end
 
+  helper_method :next_page_filters
+  def next_page_filters nextpage_operator
+    next_page_filters = @filters.reject do |attr, op, val|
+      (attr == 'created_at' and op == nextpage_operator) or
+      (attr == 'uuid' and op == 'not in')
+    end
+
+    if @objects.any?
+      last_created_at = @objects.last.created_at
+
+      last_uuids = []
+      @objects.each do |obj|
+        last_uuids << obj.uuid if obj.created_at.eql?(last_created_at)
+      end
+
+      next_page_filters += [['created_at', nextpage_operator, last_created_at]]
+      next_page_filters += [['uuid', 'not in', last_uuids]]
+    end
+
+    next_page_filters
+  end
+
   def show
     if !@object
       return render_not_found("object not found")
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index 3674e31..8ec8d5e 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -230,23 +230,9 @@ class ProjectsController < ApplicationController
       @objects = @objects.to_a.sort_by(&:created_at)
       @objects.reverse! if nextpage_operator == '<='
       @objects = @objects[0.. at limit-1]
-      @next_page_filters = @filters.reject do |attr,op,val|
-        (attr == 'created_at' and op == nextpage_operator) or
-          (attr == 'uuid' and op == 'not in')
-      end
 
       if @objects.any?
-        last_created_at = @objects.last.created_at
-
-        last_uuids = []
-        @objects.each do |obj|
-          last_uuids << obj.uuid if obj.created_at.eql?(last_created_at)
-        end
-
-        @next_page_filters += [['created_at',
-                                nextpage_operator,
-                                last_created_at]]
-        @next_page_filters += [['uuid', 'not in', last_uuids]]
+        @next_page_filters = next_page_filters(nextpage_operator)
         @next_page_href = url_for(partial: :contents_rows,
                                   limit: @limit,
                                   filters: @next_page_filters.to_json)
diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb
new file mode 100644
index 0000000..ff69d89
--- /dev/null
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -0,0 +1,37 @@
+class WorkUnitsController < ApplicationController
+  def find_objects_for_index
+    # If it's not the index rows partial display, just return
+    # The /index request will again be invoked to display the
+    # partial at which time, we will be using the objects found.
+    return if !params[:partial]
+
+    @limit = 20
+    @filters = @filters || []
+
+    # get next page of pipeline_instances
+    filters = @filters + [["uuid", "is_a", ["arvados#pipelineInstance"]]]
+    pipelines = PipelineInstance.limit(@limit).order(["created_at desc"]).filter(filters)
+
+    # get next page of jobs
+    filters = @filters + [["uuid", "is_a", ["arvados#job"]]]
+    jobs = Job.limit(@limit).order(["created_at desc"]).filter(filters)
+
+    # get next page of container_requests
+    filters = @filters + [["uuid", "is_a", ["arvados#containerRequest"]]]
+    crs = ContainerRequest.limit(@limit).order(["created_at desc"]).filter(filters)
+    @objects = (jobs.to_a + pipelines.to_a + crs.to_a).sort_by(&:created_at).reverse.first(@limit)
+
+    if @objects.any?
+      @next_page_filters = next_page_filters('<=')
+      @next_page_href = url_for(partial: :all_processes_rows,
+                                filters: @next_page_filters.to_json)
+      preload_links_for_objects(@objects.to_a)
+    else
+      @next_page_href = nil
+    end
+  end
+
+  def next_page_href with_params={}
+    @next_page_href
+  end
+end
diff --git a/apps/workbench/app/models/pipeline_instance.rb b/apps/workbench/app/models/pipeline_instance.rb
index b51f07c..0541ce5 100644
--- a/apps/workbench/app/models/pipeline_instance.rb
+++ b/apps/workbench/app/models/pipeline_instance.rb
@@ -13,7 +13,7 @@ class PipelineInstance < ArvadosBase
       template = if lookup and lookup[self.pipeline_template_uuid]
                    lookup[self.pipeline_template_uuid]
                  else
-                   PipelineTemplate.where(uuid: self.pipeline_template_uuid).first
+                   PipelineTemplate.find(self.pipeline_template_uuid) if self.pipeline_template_uuid
                  end
       if template
         template.name
diff --git a/apps/workbench/app/models/proxy_work_unit.rb b/apps/workbench/app/models/proxy_work_unit.rb
index f672c8c..53b4908 100644
--- a/apps/workbench/app/models/proxy_work_unit.rb
+++ b/apps/workbench/app/models/proxy_work_unit.rb
@@ -23,6 +23,10 @@ class ProxyWorkUnit < WorkUnit
     get(:modified_by_user_uuid)
   end
 
+  def owner_uuid
+    get(:owner_uuid)
+  end
+
   def created_at
     t = get(:created_at)
     t = Time.parse(t) if (t.is_a? String)
@@ -51,6 +55,8 @@ class ProxyWorkUnit < WorkUnit
     state = get(:state)
     if ["Running", "RunningOnServer", "RunningOnClient"].include? state
       "Running"
+    elsif state == 'New'
+      "Not started"
     else
       state
     end
diff --git a/apps/workbench/app/models/work_unit.rb b/apps/workbench/app/models/work_unit.rb
index dee6a60..7b52365 100644
--- a/apps/workbench/app/models/work_unit.rb
+++ b/apps/workbench/app/models/work_unit.rb
@@ -17,6 +17,10 @@ class WorkUnit
     # returns uuid of the user who modified this work unit most recently
   end
 
+  def owner_uuid
+    # returns uuid of the owner of this work unit
+  end
+
   def created_at
     # returns created_at timestamp
   end
diff --git a/apps/workbench/app/views/application/_delete_object_button.html.erb b/apps/workbench/app/views/application/_delete_object_button.html.erb
index 6ece860..744839c 100644
--- a/apps/workbench/app/views/application/_delete_object_button.html.erb
+++ b/apps/workbench/app/views/application/_delete_object_button.html.erb
@@ -1,5 +1,5 @@
 <% if object.deletable? %>
-  <%= link_to({action: 'destroy', id: object.uuid}, method: :delete, remote: true, data: {confirm: "Really delete #{object.class_for_display.downcase} '#{object.friendly_link_name}'?"}) do %>
+  <%= link_to({controller: object.class.table_name, action: 'destroy', id: object.uuid}, method: :delete, remote: true, data: {confirm: "Really delete #{object.class_for_display.downcase} '#{object.friendly_link_name}'?"}) do %>
     <i class="glyphicon glyphicon-trash"></i>
   <% end %>
 <% end %>
diff --git a/apps/workbench/app/views/container_requests/_show_log.html.erb b/apps/workbench/app/views/container_requests/_show_log.html.erb
index 4126f12..f623fd6 100644
--- a/apps/workbench/app/views/container_requests/_show_log.html.erb
+++ b/apps/workbench/app/views/container_requests/_show_log.html.erb
@@ -1 +1 @@
-<%= render(partial: 'work_unit/show_log', locals: {obj: @object, name: @object[:name] || 'this container'}) %>
+<%= render(partial: 'work_units/show_log', locals: {obj: @object, name: @object[:name] || 'this container'}) %>
diff --git a/apps/workbench/app/views/container_requests/_show_status.html.erb b/apps/workbench/app/views/container_requests/_show_status.html.erb
index d6d8c67..fc3f7be 100644
--- a/apps/workbench/app/views/container_requests/_show_status.html.erb
+++ b/apps/workbench/app/views/container_requests/_show_status.html.erb
@@ -1 +1 @@
-<%= render(partial: 'work_unit/show_status', locals: {current_obj: @object, name: @object[:name] || 'this container'}) %>
+<%= render(partial: 'work_units/show_status', locals: {current_obj: @object, name: @object[:name] || 'this container'}) %>
diff --git a/apps/workbench/app/views/containers/_show_log.html.erb b/apps/workbench/app/views/containers/_show_log.html.erb
index 4126f12..f623fd6 100644
--- a/apps/workbench/app/views/containers/_show_log.html.erb
+++ b/apps/workbench/app/views/containers/_show_log.html.erb
@@ -1 +1 @@
-<%= render(partial: 'work_unit/show_log', locals: {obj: @object, name: @object[:name] || 'this container'}) %>
+<%= render(partial: 'work_units/show_log', locals: {obj: @object, name: @object[:name] || 'this container'}) %>
diff --git a/apps/workbench/app/views/containers/_show_status.html.erb b/apps/workbench/app/views/containers/_show_status.html.erb
index 00a5592..b6a2371 100644
--- a/apps/workbench/app/views/containers/_show_status.html.erb
+++ b/apps/workbench/app/views/containers/_show_status.html.erb
@@ -1,4 +1,4 @@
-<%= render(partial: 'work_unit/show_status', locals: {current_obj: @object, name: @object[:name] || 'this container'}) %>
+<%= render(partial: 'work_units/show_status', locals: {current_obj: @object, name: @object[:name] || 'this container'}) %>
 
 <div class="panel panel-default">
   <div class="panel-heading">
diff --git a/apps/workbench/app/views/jobs/_show_status.html.erb b/apps/workbench/app/views/jobs/_show_status.html.erb
index 6b1ea03..bb5444f 100644
--- a/apps/workbench/app/views/jobs/_show_status.html.erb
+++ b/apps/workbench/app/views/jobs/_show_status.html.erb
@@ -1,4 +1,4 @@
-<%= render(partial: 'work_unit/show_status', locals: {current_obj: @object, name: @object[:name] || 'this job'}) %>
+<%= render(partial: 'work_units/show_status', locals: {current_obj: @object, name: @object[:name] || 'this job'}) %>
 
 <div class="panel panel-default">
   <div class="panel-heading">
diff --git a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
index 4196558..b79759f 100644
--- a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
@@ -9,7 +9,7 @@
        data-object-uuids="<%= @object.uuid %> <%= job_uuids.join(' ') %>"
        ></div>
 
-  <%= render partial: 'work_unit/show_component', locals: {wu: @object.work_unit(@object.name)} %>
+  <%= render partial: 'work_units/show_component', locals: {wu: @object.work_unit(@object.name)} %>
 
 <% else %>
   <%# state is either New or Ready %>
diff --git a/apps/workbench/app/views/projects/_show_dashboard.html.erb b/apps/workbench/app/views/projects/_show_dashboard.html.erb
index 6dfa1bc..afca246 100644
--- a/apps/workbench/app/views/projects/_show_dashboard.html.erb
+++ b/apps/workbench/app/views/projects/_show_dashboard.html.erb
@@ -18,8 +18,8 @@
                 <% end %>
               </span>
               <span>
-                  <%= link_to pipeline_instances_path, class: 'btn btn-default btn-xs' do %>
-                    All pipelines <i class="fa fa-fw fa-arrow-circle-right"></i>
+                  <%= link_to all_processes_path, class: 'btn btn-default btn-xs' do %>
+                    All processes <i class="fa fa-fw fa-arrow-circle-right"></i>
                   <% end %>
               </span>
             </span>
@@ -53,16 +53,7 @@
                     Active for <%= render_runtime(wu_time, false) %>
                   <% end %>
 
-                  <span class="pull-right text-overflow-ellipsis" style="max-width: 100%">
-                    <% outputs = wu.outputs %>
-                    <% if outputs.size == 0 %>
-                      No output.
-                    <% elsif outputs.size == 1 %>
-                      <i class="fa fa-fw fa-archive"></i> <%= link_to_if_arvados_object outputs[0], friendly_name: true %>
-                    <% else %>
-                      <%= render partial: 'work_unit/show_outputs', locals: {id: wu.uuid, outputs: outputs, align:"pull-right"} %>
-                    <% end %>
-                  </span>
+                  <%= render partial: 'work_units/show_output', locals: {wu: wu, align: 'pull-right', include_icon: true} %>
                 </div>
               </div>
 
@@ -118,11 +109,6 @@
                 <% end %>
               </span>
             <% end %>
-            <span>
-              <%= link_to jobs_path, class: 'btn btn-default btn-xs' do %>
-                All jobs <i class="fa fa-fw fa-arrow-circle-right"></i>
-              <% end %>
-            </span>
           </span>
         </div>
         <div class="panel-body compute-node-summary-pane">
diff --git a/apps/workbench/app/views/work_unit/_show_status.html.erb b/apps/workbench/app/views/work_unit/_show_status.html.erb
deleted file mode 100644
index 0c1e80e..0000000
--- a/apps/workbench/app/views/work_unit/_show_status.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<div class="arv-log-refresh-control"
-     data-load-throttle="15000"
-     ></div>
-<%=
-   render(partial: 'work_unit/show_component', locals: {wu: current_obj.work_unit(name)})
-%>
diff --git a/apps/workbench/app/views/work_unit/_component_detail.html.erb b/apps/workbench/app/views/work_units/_component_detail.html.erb
similarity index 97%
rename from apps/workbench/app/views/work_unit/_component_detail.html.erb
rename to apps/workbench/app/views/work_units/_component_detail.html.erb
index ba9d3ce..e15cc44 100644
--- a/apps/workbench/app/views/work_unit/_component_detail.html.erb
+++ b/apps/workbench/app/views/work_units/_component_detail.html.erb
@@ -27,7 +27,7 @@
                       <% if val.size == 1 %>
                         <%= link_to_arvados_object_if_readable(val[0], 'Output data not available', friendly_name: true) %>
                       <% else %>
-                        <%= render partial: 'work_unit/show_outputs', locals: {id: current_obj.uuid, outputs: val, align:""} %>
+                        <%= render partial: 'work_units/show_outputs', locals: {id: current_obj.uuid, outputs: val, align:""} %>
                       <% end %>
                     <% else %>
                       <%= val %>
diff --git a/apps/workbench/app/views/work_unit/_progress.html.erb b/apps/workbench/app/views/work_units/_progress.html.erb
similarity index 100%
rename from apps/workbench/app/views/work_unit/_progress.html.erb
rename to apps/workbench/app/views/work_units/_progress.html.erb
diff --git a/apps/workbench/app/views/work_units/_show_all_processes.html.erb b/apps/workbench/app/views/work_units/_show_all_processes.html.erb
new file mode 100644
index 0000000..ea17843
--- /dev/null
+++ b/apps/workbench/app/views/work_units/_show_all_processes.html.erb
@@ -0,0 +1,51 @@
+<div class="container">
+  <div class="row">
+    <div class="pull-right">
+      <input type="text" class="form-control filterable-control recent-all-processes-filterable-control"
+             placeholder="Search all processes"
+             data-filterable-target="#all-processes-scroll"
+             value="<%= params[:search] %>">
+      </input>
+    </div>
+  </div>
+  <div>
+    <div>
+      <table class="table table-condensed table-fixedlayout arv-recent-all-processes">
+        <colgroup>
+          <col width="25%" />
+          <col width="10%" />
+          <col width="20%" />
+          <col width="20%" />
+          <col width="20%" />
+          <col width="5%" />
+        </colgroup>
+
+        <thead>
+          <tr class="contain-align-left">
+            <th>
+              Process
+            </th>
+            <th>
+              Status
+            </th>
+            <th>
+              Owner
+            </th>
+            <th>
+              Created at
+            </th>
+            <th>
+              Output
+            </th>
+            <th>
+            </th>
+          </tr>
+        </thead>
+
+        <tbody data-infinite-scroller="#all-processes-scroll" id="all-processes-scroll"
+               data-infinite-content-href="<%= url_for partial: :all_processes_rows %>" >
+        </tbody>
+      </table>
+    </div>
+  </div>
+</div>
diff --git a/apps/workbench/app/views/work_units/_show_all_processes_rows.html.erb b/apps/workbench/app/views/work_units/_show_all_processes_rows.html.erb
new file mode 100644
index 0000000..0652a9d
--- /dev/null
+++ b/apps/workbench/app/views/work_units/_show_all_processes_rows.html.erb
@@ -0,0 +1,23 @@
+<% @objects.each do |obj| %>
+  <% wu = obj.work_unit %>
+  <tr data-object-uuid="<%= wu.uuid %>" >
+    <td>
+      <%= link_to_if_arvados_object obj, friendly_name: true %>
+    </td>
+    <td>
+      <span class="label label-<%= wu.state_bootstrap_class %>"><%= wu.state_label %></span>
+    </td>
+    <td>
+      <%= link_to_if_arvados_object wu.owner_uuid, friendly_name: true %>
+    </td>
+    <td>
+      <%= render_localized_date(wu.created_at) %>
+    </td>
+    <td>
+      <%= render partial: 'work_units/show_output', locals: {wu: wu, align: ''} %>
+    </td>
+    <td>
+      <%= render partial: 'delete_object_button', locals: {object:obj} %>
+    </td>
+  </tr>
+<% end %>
diff --git a/apps/workbench/app/views/work_unit/_show_child.html.erb b/apps/workbench/app/views/work_units/_show_child.html.erb
similarity index 89%
rename from apps/workbench/app/views/work_unit/_show_child.html.erb
rename to apps/workbench/app/views/work_units/_show_child.html.erb
index a9c8d2f..1d5ae63 100644
--- a/apps/workbench/app/views/work_unit/_show_child.html.erb
+++ b/apps/workbench/app/views/work_units/_show_child.html.erb
@@ -11,7 +11,7 @@
         </div>
 
         <div class="col-md-2 pipeline-instance-spacing">
-          <%= render partial: 'work_unit/progress', locals: {wu: current_obj} %>
+          <%= render partial: 'work_units/progress', locals: {wu: current_obj} %>
         </div>
 
         <% if not current_obj %>
@@ -48,7 +48,7 @@
                 <% 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_unit/show_outputs', locals: {id: current_obj.uuid, outputs: outputs, align:"pull-right"} %>
+                  <%= render partial: 'work_units/show_outputs', locals: {id: current_obj.uuid, outputs: outputs, align:"pull-right"} %>
                 <% end %>
               <% else %>
                 No output.
@@ -71,7 +71,7 @@
 
   <div id="collapse<%= i %>" class="panel-collapse collapse <%= if expanded then 'in' end %>">
     <div class="panel-body">
-      <%= render partial: 'work_unit/show_component', locals: {wu: current_obj} %>
+      <%= render partial: 'work_units/show_component', locals: {wu: current_obj} %>
     </div>
   </div>
 </div>
diff --git a/apps/workbench/app/views/work_unit/_show_component.html.erb b/apps/workbench/app/views/work_units/_show_component.html.erb
similarity index 89%
rename from apps/workbench/app/views/work_unit/_show_component.html.erb
rename to apps/workbench/app/views/work_units/_show_component.html.erb
index da3e5a7..43f5692 100644
--- a/apps/workbench/app/views/work_unit/_show_component.html.erb
+++ b/apps/workbench/app/views/work_units/_show_component.html.erb
@@ -14,7 +14,7 @@
             <% end %>
             </div>
             <div class="col-md-3">
-              <%= render partial: 'work_unit/progress', locals: {wu: wu} %>
+              <%= render partial: 'work_units/progress', locals: {wu: wu} %>
             </div>
             <div class="col-md-1">
               <% if wu.can_cancel? and @object.editable? %>
@@ -43,7 +43,7 @@
   </div>
 
 <p>
-  <%= render(partial: 'work_unit/component_detail', locals: {current_obj: wu}) %>
+  <%= render(partial: 'work_units/component_detail', locals: {current_obj: wu}) %>
 </p>
 
 <%# Work unit children %>
@@ -71,6 +71,6 @@
   <% @descendent_count = 0 if !@descendent_count %>
   <% wu.children.each do |c| %>
     <% @descendent_count += 1 %>
-    <%= render(partial: 'work_unit/show_child', locals: {current_obj: c, i: @descendent_count, expanded: false}) %>
+    <%= render(partial: 'work_units/show_child', locals: {current_obj: c, i: @descendent_count, expanded: false}) %>
   <% end %>
 <% end %>
diff --git a/apps/workbench/app/views/work_unit/_show_log.html.erb b/apps/workbench/app/views/work_units/_show_log.html.erb
similarity index 100%
rename from apps/workbench/app/views/work_unit/_show_log.html.erb
rename to apps/workbench/app/views/work_units/_show_log.html.erb
diff --git a/apps/workbench/app/views/work_units/_show_output.html.erb b/apps/workbench/app/views/work_units/_show_output.html.erb
new file mode 100644
index 0000000..83dabd1
--- /dev/null
+++ b/apps/workbench/app/views/work_units/_show_output.html.erb
@@ -0,0 +1,13 @@
+<span class="<%=align%> text-overflow-ellipsis" style="max-width: 100%">
+  <% outputs = wu.outputs %>
+  <% if outputs.size == 0 %>
+    No output
+  <% elsif outputs.size == 1 %>
+    <% if defined?(include_icon) && include_icon %>
+      <i class="fa fa-fw fa-archive"></i>
+    <% end %>
+    <%= link_to_if_arvados_object outputs[0], friendly_name: true %>
+  <% else %>
+    <%= render partial: 'work_units/show_outputs', locals: {id: wu.uuid, outputs: outputs, align:align} %>
+  <% end %>
+</span>
diff --git a/apps/workbench/app/views/work_unit/_show_outputs.html.erb b/apps/workbench/app/views/work_units/_show_outputs.html.erb
similarity index 100%
rename from apps/workbench/app/views/work_unit/_show_outputs.html.erb
rename to apps/workbench/app/views/work_units/_show_outputs.html.erb
diff --git a/apps/workbench/app/views/work_units/_show_status.html.erb b/apps/workbench/app/views/work_units/_show_status.html.erb
new file mode 100644
index 0000000..4b629c8
--- /dev/null
+++ b/apps/workbench/app/views/work_units/_show_status.html.erb
@@ -0,0 +1,6 @@
+<div class="arv-log-refresh-control"
+     data-load-throttle="15000"
+     ></div>
+<%=
+   render(partial: 'work_units/show_component', locals: {wu: current_obj.work_unit(name)})
+%>
diff --git a/apps/workbench/app/views/work_units/index.html.erb b/apps/workbench/app/views/work_units/index.html.erb
new file mode 100644
index 0000000..b6e978d
--- /dev/null
+++ b/apps/workbench/app/views/work_units/index.html.erb
@@ -0,0 +1 @@
+<%= render partial: 'work_units/show_all_processes' %>
diff --git a/apps/workbench/config/initializers/time_format.rb b/apps/workbench/config/initializers/time_format.rb
new file mode 100644
index 0000000..d476781
--- /dev/null
+++ b/apps/workbench/config/initializers/time_format.rb
@@ -0,0 +1,5 @@
+class ActiveSupport::TimeWithZone
+  def as_json *args
+    strftime "%Y-%m-%dT%H:%M:%S.%NZ"
+  end
+end
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 4161484..3a756e9 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -13,6 +13,7 @@ ArvadosWorkbench::Application.routes.draw do
   get "report_issue_popup" => 'actions#report_issue_popup', :as => :report_issue_popup
   post "report_issue" => 'actions#report_issue', :as => :report_issue
   get "star" => 'actions#star', :as => :star
+  get "all_processes" => 'work_units#index', :as => :all_processes
   resources :nodes
   resources :humans
   resources :traits
diff --git a/apps/workbench/test/controllers/projects_controller_test.rb b/apps/workbench/test/controllers/projects_controller_test.rb
index c0519bc..fa87e84 100644
--- a/apps/workbench/test/controllers/projects_controller_test.rb
+++ b/apps/workbench/test/controllers/projects_controller_test.rb
@@ -387,14 +387,26 @@ class ProjectsControllerTest < ActionController::TestCase
   end
 
   [
-    ["jobs", "/jobs"],
-    ["pipelines", "/pipeline_instances"],
-    ["collections", "/collections"],
-  ].each do |target,path|
-    test "test dashboard button all #{target}" do
-      get :index, {}, session_for(:active)
-      assert_includes @response.body, "href=\"#{path}\""
-      assert_includes @response.body, "All #{target}"
+    [:admin, true],
+    [:active, false],
+  ].each do |user, expect_all_nodes|
+    test "in dashboard other index page links as #{user}" do
+      get :index, {}, session_for(user)
+
+      [["processes", "/all_processes"],
+       ["collections", "/collections"],
+      ].each do |target, path|
+        assert_includes @response.body, "href=\"#{path}\""
+        assert_includes @response.body, "All #{target}"
+      end
+
+      if expect_all_nodes
+        assert_includes @response.body, "href=\"/nodes\""
+        assert_includes @response.body, "All nodes"
+      else
+        assert_not_includes @response.body, "href=\"/nodes\""
+        assert_not_includes @response.body, "All nodes"
+      end
     end
   end
 
diff --git a/apps/workbench/test/controllers/work_units_controller_test.rb b/apps/workbench/test/controllers/work_units_controller_test.rb
new file mode 100644
index 0000000..12e0271
--- /dev/null
+++ b/apps/workbench/test/controllers/work_units_controller_test.rb
@@ -0,0 +1,68 @@
+require 'test_helper'
+
+class WorkUnitsControllerTest < ActionController::TestCase
+  # These tests don't do state-changing API calls.
+  # Save some time by skipping the database reset.
+  reset_api_fixtures :after_each_test, false
+  reset_api_fixtures :after_suite, true
+
+  [
+    ['foo', 10, 25,
+      ['/pipeline_instances/zzzzz-d1hrv-1xfj6xkicf2muk2',
+       '/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
+       '/jobs/zzzzz-8i9sb-grx15v5mjnsyxk7'],
+      ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3',
+       '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf',
+       '/container_requests/zzzzz-xvhdp-cr4completedcr2']],
+    ['pipeline_with_tagged_collection_input', 1, 1,
+      ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3'],
+      ['/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
+       '/jobs/zzzzz-8i9sb-pshmckwoma9plh7',
+       '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf',
+       '/container_requests/zzzzz-xvhdp-cr4completedcr2']],
+    ['no_such_match', 0, 0,
+      [],
+      ['/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
+       '/jobs/zzzzz-8i9sb-pshmckwoma9plh7',
+       '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf',
+       '/container_requests/zzzzz-xvhdp-cr4completedcr2']],
+  ].each do |search_filter, expected_min, expected_max, expected, not_expected|
+    test "all_processes page for search filter '#{search_filter}'" do
+      work_units_index(filters: [['any','@@', search_filter]])
+      assert_response :success
+
+      # Verify that expected number of processes are found
+      found_count = json_response['content'].scan('<tr').count
+      if expected_min == expected_max
+        assert_equal(true, found_count == expected_min,
+          "Not found expected number of items. Expected #{expected_min} and found #{found_count}")
+      else
+        assert_equal(true, found_count>=expected_min,
+          "Found too few items. Expected at least #{expected_min} and found #{found_count}")
+        assert_equal(true, found_count<=expected_max,
+          "Found too many items. Expected at most #{expected_max} and found #{found_count}")
+      end
+
+      # verify that all expected uuid links are found
+      expected.each do |link|
+        assert_match /href="#{link}"/, json_response['content']
+      end
+
+      # verify that none of the not_expected uuid links are found
+      not_expected.each do |link|
+        assert_no_match /href="#{link}"/, json_response['content']
+      end
+    end
+  end
+
+  def work_units_index params
+    params = {
+      partial: :all_processes_rows,
+      format: :json,
+    }.merge(params)
+    encoded_params = Hash[params.map { |k,v|
+                            [k, (v.is_a?(Array) || v.is_a?(Hash)) ? v.to_json : v]
+                          }]
+    get :index, encoded_params, session_for(:active)
+  end
+end
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index 61905f3..40ec31d 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -252,7 +252,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
       assert_text 'Recent pipelines and processes' # seeing dashboard now
       within('.recent-processes-actions') do
         assert page.has_link?('Run a pipeline')
-        assert page.has_link?('All pipelines')
+        assert page.has_link?('All processes')
       end
 
       within('.recent-processes') do
@@ -278,7 +278,6 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
         else
           assert page.has_no_link?('All nodes')
         end
-        assert page.has_link? 'All jobs'
       end
 
       within('.compute-node-summary-pane') do
diff --git a/apps/workbench/test/integration/work_units_test.rb b/apps/workbench/test/integration/work_units_test.rb
new file mode 100644
index 0000000..63ba275
--- /dev/null
+++ b/apps/workbench/test/integration/work_units_test.rb
@@ -0,0 +1,58 @@
+require 'integration_helper'
+
+class WorkUnitsTest < ActionDispatch::IntegrationTest
+  setup do
+    need_javascript
+  end
+
+  test "scroll all_processes page" do
+      expected_min, expected_max, expected, not_expected = [
+        25, 100,
+        ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3',
+         '/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
+         '/jobs/zzzzz-8i9sb-grx15v5mjnsyxk7',
+         '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf',
+         '/container_requests/zzzzz-xvhdp-cr4completedcr2',
+         '/container_requests/zzzzz-xvhdp-cr4requestercn2'],
+        ['/pipeline_instances/zzzzz-d1hrv-scarxiyajtshq3l',
+         '/container_requests/zzzzz-xvhdp-oneof60crs00001']
+      ]
+
+      visit page_with_token('active', "/all_processes")
+
+      page_scrolls = expected_max/20 + 2
+      within('.arv-recent-all-processes') do
+        (0..page_scrolls).each do |i|
+          page.driver.scroll_to 0, 999000
+          begin
+            wait_for_ajax
+          rescue
+          end
+        end
+      end
+
+      # Verify that expected number of processes are found
+      found_items = page.all('tr[data-object-uuid]')
+      found_count = found_items.count
+      if expected_min == expected_max
+        assert_equal(true, found_count == expected_min,
+          "Not found expected number of items. Expected #{expected_min} and found #{found_count}")
+        assert page.has_no_text? 'request failed'
+      else
+        assert_equal(true, found_count>=expected_min,
+          "Found too few items. Expected at least #{expected_min} and found #{found_count}")
+        assert_equal(true, found_count<=expected_max,
+          "Found too many items. Expected at most #{expected_max} and found #{found_count}")
+      end
+
+      # verify that all expected uuid links are found
+      expected.each do |link|
+        assert_selector "a[href=\"#{link}\"]"
+      end
+
+      # verify that none of the not_expected uuid links are found
+      not_expected.each do |link|
+        assert_no_selector "a[href=\"#{link}\"]"
+      end
+  end
+end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list