[ARVADOS] updated: 4d27755da78787d662259f8e63892b6c9591b971

Git user git at public.curoverse.com
Tue Aug 30 11:36:58 EDT 2016


Summary of changes:
 apps/workbench/app/models/container_work_unit.rb           | 12 ++++++------
 .../app/views/work_units/_show_component.html.erb          | 10 +++++-----
 apps/workbench/test/integration/application_layout_test.rb |  6 ++----
 apps/workbench/test/test_helper.rb                         |  6 ++++--
 apps/workbench/test/unit/work_unit_test.rb                 | 14 ++++++++++++++
 .../arvados/v1/container_requests_controller.rb            |  1 +
 6 files changed, 32 insertions(+), 17 deletions(-)

       via  4d27755da78787d662259f8e63892b6c9591b971 (commit)
       via  2c54a701af3a696fb063f0e663dec1e66a14141a (commit)
      from  35145ba13db4a7db0e4ed9c37ef4cc41569b8821 (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 4d27755da78787d662259f8e63892b6c9591b971
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Aug 30 11:36:28 2016 -0400

    9799: Fix show/hide "cancel container req" button: check ArvadosBase#editable?, and use CR priority instead of container priority.

diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index 1ed182c..a9fd416 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -46,13 +46,17 @@ class ContainerWorkUnit < ProxyWorkUnit
   end
 
   def can_cancel?
-    @proxied.is_a?(ContainerRequest) && state_label.in?(["Queued", "Locked", "Running"]) && priority > 0
+    @proxied.is_a?(ContainerRequest) && @proxied.state == "Committed" && @proxied.priority > 0 && @proxied.editable?
   end
 
   def container_uuid
     get(:container_uuid)
   end
 
+  def priority
+    @proxied.priority
+  end
+
   # For the following properties, use value from the @container if exists
   # This applies to a ContainerRequest with container_uuid
 
@@ -86,10 +90,6 @@ class ContainerWorkUnit < ProxyWorkUnit
     get_combined(:runtime_constraints)
   end
 
-  def priority
-    get_combined(:priority)
-  end
-
   def log_collection
     get_combined(:log)
   end
@@ -149,7 +149,7 @@ class ContainerWorkUnit < ProxyWorkUnit
     end
   end
 
-  # End combined propeties
+  # End combined properties
 
   protected
   def get_combined key
diff --git a/apps/workbench/app/views/work_units/_show_component.html.erb b/apps/workbench/app/views/work_units/_show_component.html.erb
index 43f5692..64b901c 100644
--- a/apps/workbench/app/views/work_units/_show_component.html.erb
+++ b/apps/workbench/app/views/work_units/_show_component.html.erb
@@ -1,6 +1,6 @@
 <%# Work unit status %>
 
-<div class="container-fluid>
+<div class="container-fluid">
   <div class="row-fluid">
     <%# Need additional handling for main object display  %>
     <% if @object.uuid == wu.uuid %>
@@ -18,10 +18,10 @@
             </div>
             <div class="col-md-1">
               <% if wu.can_cancel? and @object.editable? %>
-                  <%= form_tag "#{wu.uri}/cancel", remote: true, style: "display:inline; padding-left: 1em" do |f| %>
-                    <%= hidden_field_tag :return_to, url_for(@object) %>
-                    <%= button_tag "Cancel", {class: 'btn btn-xs btn-danger', id: "cancel-obj-button"} %>
-                  <% end %>
+                <%= form_tag "#{wu.uri}/cancel", remote: true, style: "display:inline; padding-left: 1em" do |f| %>
+                  <%= hidden_field_tag :return_to, url_for(@object) %>
+                  <%= button_tag "Cancel", {class: 'btn btn-xs btn-danger', id: "cancel-obj-button"} %>
+                <% end %>
               <% end %>
             </div>
           </div>
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index 3edd660..e8bdbea 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -303,13 +303,11 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
 
       assert_text 'created_at'
       if cancelable
-        assert page.has_button?('Cancel'), 'No Cancel button'
+        assert_selector 'button', text: 'Cancel'
         click_button 'Cancel'
         wait_for_ajax
-        assert page.has_no_button?('Cancel'), 'Cancel button not expected after clicking'
-      else
-        assert page.has_no_button?('Cancel'), 'Cancel button not expected'
       end
+      assert_no_selector 'button', text: 'Cancel'
     end
   end
 
diff --git a/apps/workbench/test/test_helper.rb b/apps/workbench/test/test_helper.rb
index 78ef2d2..73bfda6 100644
--- a/apps/workbench/test/test_helper.rb
+++ b/apps/workbench/test/test_helper.rb
@@ -32,14 +32,16 @@ class ActiveSupport::TestCase
   # in integration tests -- they do not yet inherit this setting
   fixtures :all
   def use_token token_name
-    was = Thread.current[:arvados_api_token]
+    user_was = Thread.current[:user]
+    token_was = Thread.current[:arvados_api_token]
     auth = api_fixture('api_client_authorizations')[token_name.to_s]
     Thread.current[:arvados_api_token] = auth['api_token']
     if block_given?
       begin
         yield
       ensure
-        Thread.current[:arvados_api_token] = was
+        Thread.current[:user] = user_was
+        Thread.current[:arvados_api_token] = token_was
       end
     end
   end
diff --git a/apps/workbench/test/unit/work_unit_test.rb b/apps/workbench/test/unit/work_unit_test.rb
index c737982..2b1cac9 100644
--- a/apps/workbench/test/unit/work_unit_test.rb
+++ b/apps/workbench/test/unit/work_unit_test.rb
@@ -91,4 +91,18 @@ class WorkUnitTest < ActiveSupport::TestCase
       end
     end
   end
+
+  test 'can_cancel?' do
+    use_token 'active' do
+      assert find_fixture(Job, 'running').work_unit.can_cancel?
+      refute find_fixture(Container, 'running').work_unit.can_cancel?
+      assert find_fixture(ContainerRequest, 'running').work_unit.can_cancel?
+    end
+    use_token 'spectator' do
+      refute find_fixture(ContainerRequest, 'running_anonymous_accessible').work_unit.can_cancel?
+    end
+    use_token 'admin' do
+      assert find_fixture(ContainerRequest, 'running_anonymous_accessible').work_unit.can_cancel?
+    end
+  end
 end

commit 2c54a701af3a696fb063f0e663dec1e66a14141a
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Aug 30 11:14:55 2016 -0400

    9799: Add forgotten serialized column.

diff --git a/services/api/app/controllers/arvados/v1/container_requests_controller.rb b/services/api/app/controllers/arvados/v1/container_requests_controller.rb
index fe4696e..6e2848c 100644
--- a/services/api/app/controllers/arvados/v1/container_requests_controller.rb
+++ b/services/api/app/controllers/arvados/v1/container_requests_controller.rb
@@ -3,4 +3,5 @@ class Arvados::V1::ContainerRequestsController < ApplicationController
   accept_attribute_as_json :mounts, Hash
   accept_attribute_as_json :runtime_constraints, Hash
   accept_attribute_as_json :command, Array
+  accept_attribute_as_json :filters, Array
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list