[ARVADOS] created: b20cc78fe133ad073edaa1f07effa90297015e99
git at public.curoverse.com
git at public.curoverse.com
Wed Aug 6 19:07:38 EDT 2014
at b20cc78fe133ad073edaa1f07effa90297015e99 (commit)
commit b20cc78fe133ad073edaa1f07effa90297015e99
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Aug 6 19:07:30 2014 -0400
3499: Show home project at /projects/{user_uuid}. closes #3515
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index df95335..18397e1 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -12,6 +12,7 @@ class ApplicationController < ActionController::Base
# Methods that don't require login should
# skip_around_filter :require_thread_api_token
around_filter :require_thread_api_token, except: ERROR_ACTIONS
+ before_filter :accept_uuid_as_id_param, except: ERROR_ACTIONS
before_filter :check_user_agreements, except: ERROR_ACTIONS
before_filter :check_user_notifications, except: ERROR_ACTIONS
before_filter :load_filters_and_paging_params, except: ERROR_ACTIONS
@@ -349,10 +350,14 @@ class ApplicationController < ActionController::Base
end
end
- def find_object_by_uuid
+
+ def accept_uuid_as_id_param
if params[:id] and params[:id].match /\D/
params[:uuid] = params.delete :id
end
+ end
+
+ def find_object_by_uuid
begin
if not model_class
@object = nil
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index 2b605d3..bf1bc93 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -3,6 +3,31 @@ class ProjectsController < ApplicationController
Group
end
+ def find_object_by_uuid
+ if current_user and params[:uuid] == current_user.uuid
+ @object = current_user.dup
+ @object.uuid = current_user.uuid
+ class << @object
+ def name
+ 'Home'
+ end
+ def description
+ ''
+ end
+ def attribute_editable? attr, *args
+ case attr
+ when 'description', 'name'
+ false
+ else
+ super
+ end
+ end
+ end
+ else
+ super
+ end
+ end
+
def index_pane_list
%w(Projects)
end
diff --git a/apps/workbench/app/models/user.rb b/apps/workbench/app/models/user.rb
index 9c91477..af1922a 100644
--- a/apps/workbench/app/models/user.rb
+++ b/apps/workbench/app/models/user.rb
@@ -27,11 +27,15 @@ class User < ArvadosBase
{}))
end
+ def contents params={}
+ Group.contents params.merge(uuid: self.uuid)
+ end
+
def attributes_for_display
super.reject { |k,v| %w(owner_uuid default_owner_uuid identity_url prefs).index k }
end
- def attribute_editable? attr, *args
+ def attribute_editable? attr, *args
(not (self.uuid.andand.match(/000000000000000$/) and self.is_admin)) and super
end
diff --git a/apps/workbench/app/views/projects/_show_data_collections.html.erb b/apps/workbench/app/views/projects/_show_data_collections.html.erb
index c44db5f..3c8607e 100644
--- a/apps/workbench/app/views/projects/_show_data_collections.html.erb
+++ b/apps/workbench/app/views/projects/_show_data_collections.html.erb
@@ -1,3 +1,4 @@
+<% if @object.uuid != current_user.uuid # Not the "Home" project %>
<% content_for :content_top do %>
<h2>
@@ -9,6 +10,7 @@
</div>
<% end %>
+<% end %>
<% content_for :tab_line_buttons do %>
<% if @object.editable? %>
commit e940b6f9ddaaabb5c21f1d0b10754231e74df67f
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Aug 6 18:41:43 2014 -0400
3499: Update breadcrumbs. closes #3513
diff --git a/apps/workbench/app/views/layouts/body.html.erb b/apps/workbench/app/views/layouts/body.html.erb
index 55c9d81..ef9ed08 100644
--- a/apps/workbench/app/views/layouts/body.html.erb
+++ b/apps/workbench/app/views/layouts/body.html.erb
@@ -141,13 +141,10 @@
<ul class="nav navbar-nav navbar-left">
<li>
<a href="/">
- <i class="fa fa-lg fa-fw fa-home"></i>
- Home
+ <i class="fa fa-lg fa-fw fa-dashboard"></i>
+ Dashboard
</a>
</li>
- <li class="nav-separator">
- <i class="fa fa-lg fa-angle-double-right"></i>
- </li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" id="projects-menu">
Projects
@@ -169,6 +166,14 @@
<% } %>
</ul>
</li>
+ <li class="nav-separator">
+ <i class="fa fa-lg fa-angle-double-right"></i>
+ </li>
+ <li>
+ <%= link_to project_path(current_user.uuid) do %>
+ Home
+ <% end %>
+ </li>
<% project_breadcrumbs.each do |p| %>
<li class="nav-separator">
<i class="fa fa-lg fa-angle-double-right"></i>
commit 5f24e9f419222574f16640448be2de731de584b8
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Aug 6 18:36:06 2014 -0400
3499: groups/{user_uuid}/contents returns home project contents. closes #3514
diff --git a/services/api/app/controllers/arvados/v1/groups_controller.rb b/services/api/app/controllers/arvados/v1/groups_controller.rb
index f51f37a..17be40a 100644
--- a/services/api/app/controllers/arvados/v1/groups_controller.rb
+++ b/services/api/app/controllers/arvados/v1/groups_controller.rb
@@ -13,9 +13,20 @@ class Arvados::V1::GroupsController < ApplicationController
end
def render_404_if_no_object
- if params[:action] == 'contents' and !params[:uuid]
- # OK!
- @object = nil
+ if params[:action] == 'contents'
+ if !params[:uuid]
+ # OK!
+ @object = nil
+ true
+ elsif @object
+ # Project group
+ true
+ elsif (@object = User.where(uuid: params[:uuid]).first)
+ # "Home" pseudo-project
+ true
+ else
+ super
+ end
else
super
end
diff --git a/services/api/test/fixtures/links.yml b/services/api/test/fixtures/links.yml
index ba0b1a6..7842392 100644
--- a/services/api/test/fixtures/links.yml
+++ b/services/api/test/fixtures/links.yml
@@ -679,3 +679,17 @@ baz_collection_name_in_asubproject:
# Collection is added to a Project.
name: "ea10d51bcf88862dbcc36eb292017dfd+45 added sometime"
properties: {}
+
+empty_collection_name_in_active_user_home_project:
+ uuid: zzzzz-o0j2j-i3n6m552x6tmoi4
+ owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ created_at: 2014-08-06 22:11:51.242392533 Z
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ modified_at: 2014-08-06 22:11:51.242150425 Z
+ tail_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ link_class: name
+ name: Empty collection
+ head_uuid: d41d8cd98f00b204e9800998ecf8427e+0
+ properties: {}
+ updated_at: 2014-08-06 22:11:51.242010312 Z
diff --git a/services/api/test/functional/arvados/v1/groups_controller_test.rb b/services/api/test/functional/arvados/v1/groups_controller_test.rb
index c02da12..217809a 100644
--- a/services/api/test/functional/arvados/v1/groups_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/groups_controller_test.rb
@@ -112,6 +112,24 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
end
end
+ [false, true].each do |include_linked|
+ test "list objects in home project, include_linked=#{include_linked}" do
+ authorize_with :active
+ get :contents, {
+ format: :json,
+ id: users(:active).uuid,
+ include_linked: include_linked,
+ }
+ assert_response :success
+ found_uuids = json_response['items'].collect { |i| i['uuid'] }
+ if include_linked
+ assert_includes found_uuids, collections(:empty).uuid, "empty collection did not appear in home project"
+ end
+ assert_includes found_uuids, specimens(:owned_by_active_user).uuid, "specimen did not appear in home project"
+ refute_includes found_uuids, specimens(:in_asubproject).uuid, "specimen appeared unexpectedly in home project"
+ end
+ end
+
test "user with project read permission can see project collections" do
authorize_with :project_viewer
get :contents, {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list