[ARVADOS] updated: 3a789117c2816a6c288f17ab3fb22cc163e879b4

git at public.curoverse.com git at public.curoverse.com
Fri Dec 12 16:22:03 EST 2014


Summary of changes:
 apps/workbench/app/controllers/application_controller.rb   | 14 +-------------
 .../app/views/application/_projects_tree_menu.html.erb     |  2 +-
 apps/workbench/test/integration/projects_test.rb           |  3 ++-
 3 files changed, 4 insertions(+), 15 deletions(-)

       via  3a789117c2816a6c288f17ab3fb22cc163e879b4 (commit)
      from  d62ad17b3eca4b107a7602045980a118a09115e7 (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 3a789117c2816a6c288f17ab3fb22cc163e879b4
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Fri Dec 12 16:20:44 2014 -0500

    4414: use ensure_unique_name option to instruct api server to create unique name for new project.

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 18ad704..c757517 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -323,19 +323,7 @@ class ApplicationController < ActionController::Base
     @new_resource_attrs.reject! { |k,v| k.to_s == 'uuid' }
     @object ||= model_class.new @new_resource_attrs, params["options"]
 
-    begin
-      object_saved = @object.save
-    rescue ArvadosApiClient::ApiErrorResponseException => e
-      if e.message.include? 'groups_owner_uuid_name_unique'
-        rename_to = @object.name + ' created at ' + Time.now.to_s
-        @object.name = rename_to
-        object_saved = @object.save
-      else
-        raise
-      end
-    end
-
-    if object_saved
+    if @object.save
       show
     else
       render_error status: 422
diff --git a/apps/workbench/app/views/application/_projects_tree_menu.html.erb b/apps/workbench/app/views/application/_projects_tree_menu.html.erb
index 5ba2073..4a49184 100644
--- a/apps/workbench/app/views/application/_projects_tree_menu.html.erb
+++ b/apps/workbench/app/views/application/_projects_tree_menu.html.erb
@@ -1,5 +1,5 @@
               <li>
-                <%= link_to projects_path, method: :post, class: 'btn btn-xs btn-default pull-right' do %>
+                <%= link_to projects_path(options: {ensure_unique_name: true}), method: :post, class: 'btn btn-xs btn-default pull-right' do %>
                   <i class="fa fa-plus"></i> Add a new project
                 <% end %>
               </li>
diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb
index 340d9ba..97e1a54 100644
--- a/apps/workbench/test/integration/projects_test.rb
+++ b/apps/workbench/test/integration/projects_test.rb
@@ -740,7 +740,8 @@ class ProjectsTest < ActionDispatch::IntegrationTest
     # Add one more new project
     find("#projects-menu").click
     click_link 'Add a new project'
-    assert_text 'New project created at'
+    match = /New project \(\d\)/.match page.text
+    assert match, 'Expected project name not found'
     assert_text 'No description provided'
   end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list