[ARVADOS] updated: 6e5079ff9a0349c57ab2cf06398413018a921cc0

Git user git at public.curoverse.com
Wed May 17 14:28:59 EDT 2017


Summary of changes:
 .../workbench/app/assets/javascripts/filterable.js |  2 +-
 .../app/controllers/application_controller.rb      |  7 +++++
 .../controllers/container_requests_controller.rb   |  6 ++++
 apps/workbench/app/models/container_work_unit.rb   |  2 +-
 .../_show_recent.html.erb                          | 22 ++++++-------
 .../container_requests/_show_recent_rows.html.erb  | 36 ++++++++++++++++++++++
 .../app/views/container_requests/index.html.erb    | 11 +++++++
 .../test/integration/container_requests_test.rb    | 28 +++++++++++++++++
 8 files changed, 101 insertions(+), 13 deletions(-)
 copy apps/workbench/app/views/{pipeline_instances => container_requests}/_show_recent.html.erb (60%)
 create mode 100644 apps/workbench/app/views/container_requests/_show_recent_rows.html.erb
 create mode 100644 apps/workbench/app/views/container_requests/index.html.erb

       via  6e5079ff9a0349c57ab2cf06398413018a921cc0 (commit)
       via  e9481fd0320a8f0dbecaa93eadbe3143c98bac53 (commit)
       via  80407a6b686d5038bf89bbe12978ceb633e27332 (commit)
      from  867c69d1443b44311ab35f58304b304750c38066 (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 6e5079ff9a0349c57ab2cf06398413018a921cc0
Merge: 867c69d e9481fd
Author: radhika <radhika at curoverse.com>
Date:   Wed May 17 14:28:43 2017 -0400

    closes #11580
    Merge branch '11580-container-requests'


commit e9481fd0320a8f0dbecaa93eadbe3143c98bac53
Author: radhika <radhika at curoverse.com>
Date:   Tue May 16 15:33:31 2017 -0400

    11580: preload containers

diff --git a/apps/workbench/app/assets/javascripts/filterable.js b/apps/workbench/app/assets/javascripts/filterable.js
index 27473ad..5f6370c 100644
--- a/apps/workbench/app/assets/javascripts/filterable.js
+++ b/apps/workbench/app/assets/javascripts/filterable.js
@@ -55,7 +55,7 @@ function updateFilterableQueryNow($target) {
     if (newquery == null || newquery == '') {
       params.filters = [];
     } else {
-      params.filters = [['any', '@@', newquery.concat(':*')]];
+      params.filters = [['any', '@@', newquery.trim().concat(':*')]];
     }
     $target.data('infinite-content-params-filterable', params);
     $target.data('filterable-query', newquery);
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index a63fe6e..0a40f58 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -1234,8 +1234,15 @@ class ApplicationController < ActionController::Base
         @objects_for[obj.name] = obj
       end
     else
+      key_prefix = "request_#{Thread.current.object_id}_#{dataclass.to_s}_"
       dataclass.where(uuid: uuids).each do |obj|
         @objects_for[obj.uuid] = obj
+        if dataclass == Collection
+          # The collecions#index defaults to "all attributes except manifest_text"
+          # Hence, this object is not suitable for preloading the find() cache.
+        else
+          Rails.cache.write(key_prefix + obj.uuid, obj.as_json)
+        end
       end
     end
     @objects_for
diff --git a/apps/workbench/app/controllers/container_requests_controller.rb b/apps/workbench/app/controllers/container_requests_controller.rb
index 6eaed2d..a507139 100644
--- a/apps/workbench/app/controllers/container_requests_controller.rb
+++ b/apps/workbench/app/controllers/container_requests_controller.rb
@@ -165,4 +165,10 @@ class ContainerRequestsController < ApplicationController
 
     super
   end
+
+  def index
+    @limit = 20
+    super
+  end
+
 end
diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index 84fc1f8..afdc91e 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -6,7 +6,7 @@ class ContainerWorkUnit < ProxyWorkUnit
     if @proxied.is_a?(ContainerRequest)
       container_uuid = get(:container_uuid)
       if container_uuid
-        @container = Container.where(uuid: container_uuid).first
+        @container = Container.find(container_uuid)
       end
     end
   end
diff --git a/apps/workbench/app/views/container_requests/_show_recent.html.erb b/apps/workbench/app/views/container_requests/_show_recent.html.erb
index 546b076..6a4c8b1 100644
--- a/apps/workbench/app/views/container_requests/_show_recent.html.erb
+++ b/apps/workbench/app/views/container_requests/_show_recent.html.erb
@@ -15,7 +15,7 @@
       <th>
         Status
       </th><th>
-        ContainerRequest
+        Container request
       </th><th>
         Description
       </th><th>
diff --git a/apps/workbench/test/integration/container_requests_test.rb b/apps/workbench/test/integration/container_requests_test.rb
index 51b6b24..6ac667e 100644
--- a/apps/workbench/test/integration/container_requests_test.rb
+++ b/apps/workbench/test/integration/container_requests_test.rb
@@ -122,40 +122,31 @@ class ContainerRequestsTest < ActionDispatch::IntegrationTest
     page.assert_selector 'g.node>title', text: cr['uuid'], visible: false
   end
 
-  [
-    'active',
-    'admin',
-  ].each do |token|
-    test "index page as #{token} user" do
-      visit page_with_token(token, "/container_requests")
-
-      running_owner_active = api_fixture("container_requests", "requester_for_running")
-      anon_accessible_cr = api_fixture("container_requests", "running_anonymous_accessible")
-
-      # both of these CRs should be accessible to the user
-      assert_selector "a[href=\"/container_requests/#{running_owner_active['uuid']}\"]", text: running_owner_active[:name]
-      assert_selector "a[href=\"/container_requests/#{anon_accessible_cr['uuid']}\"]", text: anon_accessible_cr[:name]
-
-      # both the active user (owner) and admin can delete the "running" container_request
-      within(".cr-#{running_owner_active['uuid']}") do
-        assert_not_nil first('.glyphicon-trash')
-      end
+  test "index page" do
+    visit page_with_token("active", "/container_requests")
 
-      # only admin user can delete the anonymously accessible container_request
-      within(".cr-#{anon_accessible_cr['uuid']}") do
-        if token == 'admin'
-          assert_not_nil first('.glyphicon-trash')
-        else
-          assert_nil first('.glyphicon-trash')
-        end
-      end
+    running_owner_active = api_fixture("container_requests", "requester_for_running")
+    anon_accessible_cr = api_fixture("container_requests", "running_anonymous_accessible")
 
-      # verify the search box in the page
-      find('.recent-container-requests-filterable-control').set("anonymous")
-      sleep 0.350 # Wait for 250ms debounce timer (see filterable.js)
-      wait_for_ajax
-      assert_no_selector "a[href=\"/container_requests/#{running_owner_active['uuid']}\"]", text: running_owner_active[:name]
-      assert_selector "a[href=\"/container_requests/#{anon_accessible_cr['uuid']}\"]", text: anon_accessible_cr[:name]
+    # both of these CRs should be accessible to the user
+    assert_selector "a[href=\"/container_requests/#{running_owner_active['uuid']}\"]", text: running_owner_active[:name]
+    assert_selector "a[href=\"/container_requests/#{anon_accessible_cr['uuid']}\"]", text: anon_accessible_cr[:name]
+
+    # user can delete the "running" container_request
+    within(".cr-#{running_owner_active['uuid']}") do
+      assert_not_nil first('.glyphicon-trash')
+    end
+
+    # user can not delete the anonymously accessible container_request
+    within(".cr-#{anon_accessible_cr['uuid']}") do
+      assert_nil first('.glyphicon-trash')
     end
+
+    # verify the search box in the page
+    find('.recent-container-requests-filterable-control').set("anonymous")
+    sleep 0.350 # Wait for 250ms debounce timer (see filterable.js)
+    wait_for_ajax
+    assert_no_selector "a[href=\"/container_requests/#{running_owner_active['uuid']}\"]", text: running_owner_active[:name]
+    assert_selector "a[href=\"/container_requests/#{anon_accessible_cr['uuid']}\"]", text: anon_accessible_cr[:name]
   end
 end

commit 80407a6b686d5038bf89bbe12978ceb633e27332
Author: radhika <radhika at curoverse.com>
Date:   Mon May 15 20:09:25 2017 -0400

    11580: add container_requests index page

diff --git a/apps/workbench/app/views/container_requests/_show_recent.html.erb b/apps/workbench/app/views/container_requests/_show_recent.html.erb
new file mode 100644
index 0000000..546b076
--- /dev/null
+++ b/apps/workbench/app/views/container_requests/_show_recent.html.erb
@@ -0,0 +1,37 @@
+<%= form_tag({}, {id: "containerRequests"}) do |f| %>
+
+<table class="table table-condensed table-fixedlayout arv-recent-container-requests">
+  <colgroup>
+    <col width="10%" />
+    <col width="15%" />
+    <col width="25%" />
+    <col width="15%" />
+    <col width="15%" />
+    <col width="15%" />
+    <col width="5%" />
+  </colgroup>
+  <thead>
+    <tr class="contain-align-left">
+      <th>
+        Status
+      </th><th>
+        ContainerRequest
+      </th><th>
+        Description
+      </th><th>
+        Workflow
+      </th><th>
+        Owner
+      </th><th>
+        Created at
+      </th><th>
+      </th>
+    </tr>
+  </thead>
+
+  <tbody data-infinite-scroller="#recent-container-requests" id="recent-container-requests"
+         data-infinite-content-href="<%= url_for partial: :recent_rows %>" >
+  </tbody>
+</table>
+
+<% end %>
diff --git a/apps/workbench/app/views/container_requests/_show_recent_rows.html.erb b/apps/workbench/app/views/container_requests/_show_recent_rows.html.erb
new file mode 100644
index 0000000..d11bf35
--- /dev/null
+++ b/apps/workbench/app/views/container_requests/_show_recent_rows.html.erb
@@ -0,0 +1,36 @@
+<%
+  containers = @objects.map(&:container_uuid).compact.uniq
+  preload_objects_for_dataclass(Container, containers) if containers.any?
+
+  workflows = @objects.collect {|o| o.properties[:template_uuid]}.compact.uniq
+  preload_objects_for_dataclass(Workflow, workflows) if workflows.any?
+
+  owner_uuids = @objects.map(&:owner_uuid).compact.uniq
+  preload_objects_for_dataclass(User, owner_uuids) if owner_uuids.any?
+  preload_objects_for_dataclass(Group, owner_uuids) if owner_uuids.any?
+
+  objs = containers + workflows + owner_uuids
+  preload_links_for_objects objs if objs.any?
+%>
+
+<% @objects.sort_by { |obj| obj.created_at }.reverse.each do |obj| %>
+  <% wu = obj.work_unit obj.name %>
+
+  <tr data-object-uuid="<%= wu.uuid %>" class="cr-<%= wu.uuid %>">
+    <td>
+      <span class="label label-<%= wu.state_bootstrap_class %>"><%= wu.state_label %></span>
+    </td><td>
+      <%= link_to_if_arvados_object obj, friendly_name: true %>
+    </td><td>
+      <%= obj.description || '' %>
+    </td><td>
+      <%= link_to_if_arvados_object wu.template_uuid, friendly_name: true %>
+    </td><td>
+      <%= link_to_if_arvados_object wu.owner_uuid, friendly_name: true %>
+    </td><td>
+      <%= wu.created_at.to_s %>
+    </td><td>
+      <%= render partial: 'delete_object_button', locals: {object:obj} %>
+    </td>
+  </tr>
+<% end %>
diff --git a/apps/workbench/app/views/container_requests/index.html.erb b/apps/workbench/app/views/container_requests/index.html.erb
new file mode 100644
index 0000000..f0a8959
--- /dev/null
+++ b/apps/workbench/app/views/container_requests/index.html.erb
@@ -0,0 +1,11 @@
+<% content_for :tab_line_buttons do %>
+  <div class="input-group">
+    <input type="text" class="form-control filterable-control recent-container-requests-filterable-control"
+           placeholder="Search container requests"
+           data-filterable-target="#recent-container-requests"
+           value="<%= params[:search] %>"
+           />
+  </div>
+<% end %>
+
+<%= render file: 'application/index.html.erb', locals: local_assigns %>
diff --git a/apps/workbench/test/integration/container_requests_test.rb b/apps/workbench/test/integration/container_requests_test.rb
index 46f7e17..51b6b24 100644
--- a/apps/workbench/test/integration/container_requests_test.rb
+++ b/apps/workbench/test/integration/container_requests_test.rb
@@ -121,4 +121,41 @@ class ContainerRequestsTest < ActionDispatch::IntegrationTest
     page.assert_selector 'ellipse+text', text: cr['name'], visible: false
     page.assert_selector 'g.node>title', text: cr['uuid'], visible: false
   end
+
+  [
+    'active',
+    'admin',
+  ].each do |token|
+    test "index page as #{token} user" do
+      visit page_with_token(token, "/container_requests")
+
+      running_owner_active = api_fixture("container_requests", "requester_for_running")
+      anon_accessible_cr = api_fixture("container_requests", "running_anonymous_accessible")
+
+      # both of these CRs should be accessible to the user
+      assert_selector "a[href=\"/container_requests/#{running_owner_active['uuid']}\"]", text: running_owner_active[:name]
+      assert_selector "a[href=\"/container_requests/#{anon_accessible_cr['uuid']}\"]", text: anon_accessible_cr[:name]
+
+      # both the active user (owner) and admin can delete the "running" container_request
+      within(".cr-#{running_owner_active['uuid']}") do
+        assert_not_nil first('.glyphicon-trash')
+      end
+
+      # only admin user can delete the anonymously accessible container_request
+      within(".cr-#{anon_accessible_cr['uuid']}") do
+        if token == 'admin'
+          assert_not_nil first('.glyphicon-trash')
+        else
+          assert_nil first('.glyphicon-trash')
+        end
+      end
+
+      # verify the search box in the page
+      find('.recent-container-requests-filterable-control').set("anonymous")
+      sleep 0.350 # Wait for 250ms debounce timer (see filterable.js)
+      wait_for_ajax
+      assert_no_selector "a[href=\"/container_requests/#{running_owner_active['uuid']}\"]", text: running_owner_active[:name]
+      assert_selector "a[href=\"/container_requests/#{anon_accessible_cr['uuid']}\"]", text: anon_accessible_cr[:name]
+    end
+  end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list