[ARVADOS] updated: 4a6b74c22201ceac36797b7722d52407eec63536

Git user git at public.curoverse.com
Tue Jun 14 18:12:21 EDT 2016


Summary of changes:
 apps/workbench/app/models/container.rb             |  4 ++++
 apps/workbench/app/models/container_request.rb     |  8 ++++++++
 apps/workbench/app/models/container_work_unit.rb   |  6 ++++++
 apps/workbench/app/models/job_work_unit.rb         |  5 +++++
 .../app/models/pipeline_instance_work_unit.rb      |  5 +++++
 apps/workbench/app/models/proxy_work_unit.rb       |  5 -----
 .../test/integration/application_layout_test.rb    | 23 ++++++++++++++++++++++
 services/api/app/models/container_request.rb       | 10 +++++-----
 services/api/test/unit/container_request_test.rb   |  2 +-
 9 files changed, 57 insertions(+), 11 deletions(-)

       via  4a6b74c22201ceac36797b7722d52407eec63536 (commit)
      from  2d5ef50536851f8d190675a3bd74ee7567713ee0 (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 4a6b74c22201ceac36797b7722d52407eec63536
Author: radhika <radhika at curoverse.com>
Date:   Tue Jun 14 18:11:29 2016 -0400

    9372: name and description can be edited on containers and container_requests despite the state.

diff --git a/apps/workbench/app/models/container.rb b/apps/workbench/app/models/container.rb
index b523132..0a7c288 100644
--- a/apps/workbench/app/models/container.rb
+++ b/apps/workbench/app/models/container.rb
@@ -1,4 +1,8 @@
 class Container < ArvadosBase
+  def self.creatable?
+    false
+  end
+
   def work_unit(label=nil)
     ContainerWorkUnit.new(self, label)
   end
diff --git a/apps/workbench/app/models/container_request.rb b/apps/workbench/app/models/container_request.rb
index 765300b..62d8bff 100644
--- a/apps/workbench/app/models/container_request.rb
+++ b/apps/workbench/app/models/container_request.rb
@@ -1,4 +1,12 @@
 class ContainerRequest < ArvadosBase
+  def self.creatable?
+    false
+  end
+
+  def textile_attributes
+    [ 'description' ]
+  end
+
   def work_unit(label=nil)
     ContainerWorkUnit.new(self, label)
   end
diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index 2fe1ff0..d902995 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -44,6 +44,12 @@ class ContainerWorkUnit < ProxyWorkUnit
     "container"
   end
 
+  def uri
+    uuid = get(:uuid)
+    "/#{@proxied.class.table_name}/#{uuid}" rescue nil
+  end
+
+
   def can_cancel?
     @proxied.is_a?(ContainerRequest) && state_label.in?(["Queued", "Locked", "Running"]) && priority > 0
   end
diff --git a/apps/workbench/app/models/job_work_unit.rb b/apps/workbench/app/models/job_work_unit.rb
index 42a39fc..a3f13f3 100644
--- a/apps/workbench/app/models/job_work_unit.rb
+++ b/apps/workbench/app/models/job_work_unit.rb
@@ -81,6 +81,11 @@ class JobWorkUnit < ProxyWorkUnit
     state_label.in? ["Queued", "Running"]
   end
 
+  def uri
+    uuid = get(:uuid)
+    "/jobs/#{uuid}"
+  end
+
   def title
     "job"
   end
diff --git a/apps/workbench/app/models/pipeline_instance_work_unit.rb b/apps/workbench/app/models/pipeline_instance_work_unit.rb
index 7c62393..889fa1a 100644
--- a/apps/workbench/app/models/pipeline_instance_work_unit.rb
+++ b/apps/workbench/app/models/pipeline_instance_work_unit.rb
@@ -43,6 +43,11 @@ class PipelineInstanceWorkUnit < ProxyWorkUnit
     items
   end
 
+  def uri
+    uuid = get(:uuid)
+    "/pipeline_instances/#{uuid}"
+  end
+
   def title
     "pipeline"
   end
diff --git a/apps/workbench/app/models/proxy_work_unit.rb b/apps/workbench/app/models/proxy_work_unit.rb
index 9167337..f672c8c 100644
--- a/apps/workbench/app/models/proxy_work_unit.rb
+++ b/apps/workbench/app/models/proxy_work_unit.rb
@@ -322,11 +322,6 @@ class ProxyWorkUnit < WorkUnit
     resp
   end
 
-  def uri
-    uuid = get(:uuid)
-    "/#{@proxied.class.table_name}/#{uuid}"
-  end
-
   protected
 
   def get key, obj=@proxied
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index 02dc06c..8e81c7c 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -303,4 +303,27 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
       end
     end
   end
+
+  [
+    ['jobs', 'running_job_with_components'],
+    ['pipeline_instances', 'has_component_with_completed_jobs'],
+    ['container_requests', 'running'],
+    ['container_requests', 'completed'],
+  ].each do |type, fixture|
+    test "edit description for #{type}/#{fixture}" do
+      obj = api_fixture(type)[fixture]
+      visit page_with_token "active", "/#{type}/#{obj['uuid']}"
+
+      within('.arv-description-as-subtitle') do
+        find('.fa-pencil').click
+        find('.editable-input textarea').set('*Textile description for object*')
+        find('.editable-submit').click
+      end
+      wait_for_ajax
+
+      # verify description
+      assert page.has_no_text? '*Textile description for object*'
+      assert page.has_text? 'Textile description for object'
+    end
+  end
 end
diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index 83ca334..496a6b1 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -129,8 +129,8 @@ class ContainerRequest < ArvadosModel
         errors.add :priority, "cannot be nil"
       end
 
-      # Can update priority, container count.
-      permitted.push :priority, :container_count_max, :container_uuid
+      # Can update priority, container count, name and description
+      permitted.push :priority, :container_count_max, :container_uuid, :name, :description
 
       if self.state_changed?
         # Allow create-and-commit in a single operation.
@@ -141,12 +141,12 @@ class ContainerRequest < ArvadosModel
       end
 
     when Final
-      if not current_user.andand.is_admin
+      if not current_user.andand.is_admin and not (self.name_changed? || self.description_changed?)
         errors.add :state, "of container request can only be set to Final by system."
       end
 
-      if self.state_changed?
-          permitted.push :state
+      if self.state_changed? || self.name_changed? || self.description_changed?
+          permitted.push :state, :name, :description
       else
         errors.add :state, "does not allow updates"
       end
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index 2c7eb76..df89b93 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -369,7 +369,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   [
-    ['active', 'zzzzz-dz642-requestercntnr1'],
+    ['active', 'zzzzz-dz642-runningcontainr'],
     ['active_no_prefs', nil],
   ].each do |token, expected|
     test "create as #{token} and expect requesting_container_uuid to be #{expected}" do

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list