[ARVADOS] created: 9b349fcac93e57aff3adad8cb9960382f622777c

Git user git at public.curoverse.com
Tue Jul 5 19:13:35 EDT 2016


        at  9b349fcac93e57aff3adad8cb9960382f622777c (commit)


commit 9b349fcac93e57aff3adad8cb9960382f622777c
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/controllers/all_processes_controller.rb b/apps/workbench/app/controllers/all_processes_controller.rb
new file mode 100644
index 0000000..fd4a603
--- /dev/null
+++ b/apps/workbench/app/controllers/all_processes_controller.rb
@@ -0,0 +1,65 @@
+class AllProcessesController < ApplicationController
+  def render_index
+    respond_to do |f|
+      f.json {
+        if params[:partial]
+          @next_page_href = next_page_href(partial: params[:partial], filters: @filters.to_json)
+          render json: {
+            content: render_to_string(partial: "work_unit/show_#{params[:partial]}",
+                                      formats: [:html]),
+            next_page_href: @next_page_href
+          }
+        else
+          render json: @objects
+        end
+      }
+      f.html {
+        render
+      }
+      f.js {
+        render
+      }
+    end
+  end
+
+  def find_objects_for_index
+    @filters = @next_page_filters || @filters || []
+
+    filters = @filters + [%w(uuid is_a) + [%w(arvados#pipelineInstance)]]
+    pipelines = PipelineInstance.order(["created_at desc"]).filter(filters)
+
+    filters = @filters + [%w(uuid is_a) + [%w(arvados#containerRequest)]] + [['requesting_container_uuid', '=', nil]]
+    crs = ContainerRequest.order(["created_at desc"]).filter(filters)
+    
+    procs = {}
+    pipelines.results.each { |pi| procs[pi] = pi.created_at }
+    crs.results.each { |c| procs[c] = c.created_at }
+
+    @objects = Hash[procs.sort_by {|key, value| value}].keys.reverse.first(@limit)
+
+    @next_page_filters = @filters.reject do |attr,op,val|
+      (attr == 'created_at') 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', '<=', last_created_at]]
+      @next_page_filters += [['uuid', 'not in', last_uuids]]
+      @next_page_href = url_for(partial: :all_processes_rows,
+                                limit: @limit,
+                                filters: @next_page_filters.to_json)
+    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/proxy_work_unit.rb b/apps/workbench/app/models/proxy_work_unit.rb
index f672c8c..7439d6e 100644
--- a/apps/workbench/app/models/proxy_work_unit.rb
+++ b/apps/workbench/app/models/proxy_work_unit.rb
@@ -51,6 +51,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/views/all_processes/index.html.erb b/apps/workbench/app/views/all_processes/index.html.erb
new file mode 100644
index 0000000..c29002a
--- /dev/null
+++ b/apps/workbench/app/views/all_processes/index.html.erb
@@ -0,0 +1 @@
+<%= render partial: 'work_unit/show_all_processes' %>
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/work_unit/_show_all_processes.html.erb b/apps/workbench/app/views/work_unit/_show_all_processes.html.erb
new file mode 100644
index 0000000..4049115
--- /dev/null
+++ b/apps/workbench/app/views/work_unit/_show_all_processes.html.erb
@@ -0,0 +1,47 @@
+<div class="container">
+  <div class="row">
+    <div class="input-group pull-right">
+      <input type="text" class="form-control filterable-control 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-all-processes">
+        <colgroup>
+          <col width="30%" />
+          <col width="10%" />
+          <col width="25%" />
+          <col width="25%" />
+          <col width="10%" />
+        </colgroup>
+
+        <thead>
+          <tr class="contain-align-left">
+            <th>
+            	Process
+            </th>
+            <th>
+	            Status
+            </th>
+            <th>
+	            Owner
+            </th>
+            <th>
+        	    Created at
+            </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_unit/_show_all_processes_rows.html.erb b/apps/workbench/app/views/work_unit/_show_all_processes_rows.html.erb
new file mode 100644
index 0000000..4bd0fdf
--- /dev/null
+++ b/apps/workbench/app/views/work_unit/_show_all_processes_rows.html.erb
@@ -0,0 +1,20 @@
+<% @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 obj.owner_uuid, friendly_name: true %>
+    </td>
+    <td>
+      <%= wu.created_at %>
+    </td>
+    <td>
+      <%= render partial: 'delete_object_button', locals: {object:obj} %>
+    </td>
+  </tr>
+<% end %>
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 4161484..d12c922 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" => 'all_processes#index', :as => :all_processes
   resources :nodes
   resources :humans
   resources :traits

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list