[ARVADOS] updated: a94ec93d3322320bbf075559c4693da816b815f4
git at public.curoverse.com
git at public.curoverse.com
Wed Jul 29 13:45:18 EDT 2015
Summary of changes:
apps/workbench/Gemfile.lock | 3 --
apps/workbench/app/controllers/users_controller.rb | 58 +++++++++++++++++++++-
apps/workbench/app/views/layouts/body.html.erb | 10 ++--
.../app/views/users/_manage_account.html.erb | 5 --
.../app/views/users/_manage_current_token.html.erb | 4 +-
.../app/views/users/_manage_repositories.html.erb | 4 +-
.../app/views/users/_manage_ssh_keys.html.erb | 2 +-
.../views/users/_manage_virtual_machines.html.erb | 4 +-
apps/workbench/config/routes.rb | 4 ++
.../test/integration/application_layout_test.rb | 4 +-
.../test/integration/user_manage_account_test.rb | 28 +++++------
.../test/integration/user_profile_test.rb | 8 +--
12 files changed, 93 insertions(+), 41 deletions(-)
via a94ec93d3322320bbf075559c4693da816b815f4 (commit)
from fc8a283968b08b152d57a24d2c5711c876a3b379 (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 a94ec93d3322320bbf075559c4693da816b815f4
Author: Manoj <jonam33 at gmail.com>
Date: Wed Jul 29 13:44:08 2015 -0400
6588: Changed links to use routes and changed tests to match the
routes.
diff --git a/apps/workbench/Gemfile.lock b/apps/workbench/Gemfile.lock
index bc7ddaf..20b8d61 100644
--- a/apps/workbench/Gemfile.lock
+++ b/apps/workbench/Gemfile.lock
@@ -294,6 +294,3 @@ DEPENDENCIES
therubyracer
uglifier (>= 1.0.3)
wiselinks
-
-BUNDLED WITH
- 1.10.5
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 84d6cfd..6cf15a8 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -255,6 +255,63 @@ class UsersController < ApplicationController
end
end
+ def manage_repositories
+ repo_links = Link.
+ filter([['head_uuid', 'is_a', 'arvados#repository'],
+ ['tail_uuid', '=', current_user.uuid],
+ ['link_class', '=', 'permission'],
+ ])
+
+ owned_repositories = Repository.where(owner_uuid: current_user.uuid)
+
+ @my_repositories = (Repository.where(uuid: repo_links.collect(&:head_uuid)) |
+ owned_repositories).
+ uniq { |repo| repo.uuid }
+
+
+ @repo_writable = {}
+ repo_links.each do |link|
+ if link.name.in? ['can_write', 'can_manage']
+ @repo_writable[link.head_uuid] = link.name
+ end
+ end
+
+ owned_repositories.each do |repo|
+ @repo_writable[repo.uuid] = 'can_manage'
+ end
+
+ respond_to do |f|
+ f.html { render template: 'users/manage_repositories' }
+ end
+ end
+
+ def manage_virtual_machines
+ @my_vm_logins = {}
+ Link.where(tail_uuid: current_user.uuid,
+ link_class: 'permission',
+ name: 'can_login').
+ each do |perm_link|
+ if perm_link.properties.andand[:username]
+ @my_vm_logins[perm_link.head_uuid] ||= []
+ @my_vm_logins[perm_link.head_uuid] << perm_link.properties[:username]
+ end
+ end
+ @my_virtual_machines = VirtualMachine.where(uuid: @my_vm_logins.keys)
+
+ respond_to do |f|
+ f.html { render template: 'users/manage_virtual_machines' }
+ end
+ end
+
+ def manage_ssh_keys
+ @my_ssh_keys = AuthorizedKey.where(key_type: 'SSH', owner_uuid: current_user.uuid)
+
+ @page = params["page"]
+ respond_to do |f|
+ f.html { render template: 'users/manage_ssh_keys' }
+ end
+ end
+
def manage_account
# repositories current user can read / write
repo_links = Link.
@@ -297,7 +354,6 @@ class UsersController < ApplicationController
# current user's ssh keys
@my_ssh_keys = AuthorizedKey.where(key_type: 'SSH', owner_uuid: current_user.uuid)
- @page = params["page"]
respond_to do |f|
f.html { render template: 'users/manage_account' }
end
diff --git a/apps/workbench/app/views/layouts/body.html.erb b/apps/workbench/app/views/layouts/body.html.erb
index 510aded..4a17abb 100644
--- a/apps/workbench/app/views/layouts/body.html.erb
+++ b/apps/workbench/app/views/layouts/body.html.erb
@@ -55,12 +55,12 @@
<%= current_user.email %>
</li>
<% if current_user.is_active %>
- <li role="menuitem"><a href="/projects/<%=current_user.uuid%>" role="menuitem"><i class="fa fa-lg fa-home fa-fw"></i> Home project </a></li>
+ <li role="menuitem"><a href="/projects/<%=current_user.uuid%>" role="menuitem"><i class="fa fa-lg fa-home fa-fw"></i> My home project </a></li>
- <li role="menuitem"><%= link_to raw('<i class="fa fa-lg fa-terminal fa-fw"></i> My Virtual Machines'), manage_account_path(page: "manage_virtual_machines") %></li>
- <li role="menuitem"><%= link_to raw('<i class="fa fa-lg fa-code-fork fa-fw"></i> My Repositories'), manage_account_path(page: "manage_repositories") %></li>
- <li role="menuitem"><%= link_to raw('<i class="fa fa-lg fa-ticket fa-fw"></i> My Current Token'), manage_account_path(page: "manage_current_token") %></li>
- <li role="menuitem"><%= link_to raw('<i class="fa fa-lg fa-key fa-fw"></i> My SSH Keys'), manage_account_path(page: "manage_ssh_keys") %></li>
+ <li role="menuitem"><a href="/manage_virtual_machines" role="menuitem"><i class="fa fa-lg fa-terminal fa-fw"></i> My virtual machines</a></li>
+ <li role="menuitem"><a href="/manage_repositories" role="menuitem"><i class="fa fa-lg fa-code-fork fa-fw"></i> My repositories</a></li>
+ <li role="menuitem"><a href="/manage_current_token" role="menuitem"><i class="fa fa-lg fa-ticket fa-fw"></i> My current token</a></li>
+ <li role="menuitem"><a href="/manage_ssh_keys" role="menuitem"><i class="fa fa-lg fa-key fa-fw"></i> My SSH keys</a></li>
<li role="menuitem"><a href="/manage_account" role="menuitem"><i class="fa fa-lg fa-key fa-fw"></i> Manage account</a></li>
diff --git a/apps/workbench/app/views/users/_manage_account.html.erb b/apps/workbench/app/views/users/_manage_account.html.erb
index 196e85e..4a362cd 100644
--- a/apps/workbench/app/views/users/_manage_account.html.erb
+++ b/apps/workbench/app/views/users/_manage_account.html.erb
@@ -1,7 +1,3 @@
-<% if @page %>
- <div>
- <%= render partial: @page %>
-<% else %>
<div class="col-sm-6">
<div class="panel-group" id="arv-adv-accordion">
<div class="panel panel-default">
@@ -21,7 +17,6 @@
<%= render partial: "manage_current_token" %>
</div>
</div>
-<% end %>
<div id="add-ssh-key-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
<%= render partial: "add_repository_modal" %>
</div>
diff --git a/apps/workbench/app/views/users/_manage_current_token.html.erb b/apps/workbench/app/views/users/_manage_current_token.html.erb
index b4ed2e3..de601cb 100644
--- a/apps/workbench/app/views/users/_manage_current_token.html.erb
+++ b/apps/workbench/app/views/users/_manage_current_token.html.erb
@@ -1,7 +1,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
- <a data-parent="#arv-adv-accordion" href="#manage_current_token">
+ <a data-parent="#arv-adv-accordion" href="/manage_current_token">
Current Token
</a>
</h4>
@@ -21,6 +21,6 @@ export ARVADOS_API_HOST_INSECURE=true
unset ARVADOS_API_HOST_INSECURE
<% end %>
</pre>
-<p>Arvados <%= link_to raw('virtual machines'), manage_account_path(page: "manage_virtual_machines") %> do this for you automatically. This setup is needed only when you use the API remotely (e.g., from your own workstation).</p>
+<p>Arvados <a href="/manage_virtual_machines"> virtual machines</a> do this for you automatically. This setup is needed only when you use the API remotely (e.g., from your own workstation).</p>
</div>
</div>
diff --git a/apps/workbench/app/views/users/_manage_repositories.html.erb b/apps/workbench/app/views/users/_manage_repositories.html.erb
index d1cfef5..b16e29d 100644
--- a/apps/workbench/app/views/users/_manage_repositories.html.erb
+++ b/apps/workbench/app/views/users/_manage_repositories.html.erb
@@ -6,7 +6,7 @@
'data-target' => '#add-repository-modal'} %>
</div>
<h4 class="panel-title">
- <a data-parent="#arv-adv-accordion" href="#manage_repositories">
+ <a data-parent="#arv-adv-accordion" href="/manage_repositories">
Repositories
</a>
</h4>
@@ -61,5 +61,5 @@
<% end %>
</div>
</div>
- <p>In order to clone git repositories using SSH, <%= link_to raw('add an SSH key to your account'), manage_account_path(page: "manage_ssh_keys") %> and clone the git@ URLs.</p>
<p>When you are using an Arvados virtual machine, you should clone the https:// URLs. This will authenticate automatically using your API token.</p>
+ <p>In order to clone git repositories using SSH, <a href="/manage_ssh_keys"> add an SSH key to your account</a> and clone the git@ URLs.</p>
diff --git a/apps/workbench/app/views/users/_manage_ssh_keys.html.erb b/apps/workbench/app/views/users/_manage_ssh_keys.html.erb
index 8a11d37..b3f9bdd 100644
--- a/apps/workbench/app/views/users/_manage_ssh_keys.html.erb
+++ b/apps/workbench/app/views/users/_manage_ssh_keys.html.erb
@@ -6,7 +6,7 @@
'data-target' => '#add-ssh-key-modal-window'} %>
</div>
<h4 class="panel-title">
- <a data-parent="#arv-adv-accordion" href="#manage_ssh_keys">
+ <a data-parent="#arv-adv-accordion" href="/manage_ssh_keys">
SSH Keys
</a>
</h4>
diff --git a/apps/workbench/app/views/users/_manage_virtual_machines.html.erb b/apps/workbench/app/views/users/_manage_virtual_machines.html.erb
index daa0fc9..65ecfff 100644
--- a/apps/workbench/app/views/users/_manage_virtual_machines.html.erb
+++ b/apps/workbench/app/views/users/_manage_virtual_machines.html.erb
@@ -1,7 +1,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
- <a data-parent="#arv-adv-accordion" href="#manage_virtual_machines">
+ <a data-parent="#arv-adv-accordion" href="/manage_virtual_machines">
Virtual Machines
</a>
</h4>
@@ -100,7 +100,7 @@
<% end %>
</div>
</div>
- <p>In order to access virtual machines using SSH, <%= link_to raw('add an SSH key to your account'), manage_account_path(page: "manage_ssh_keys") %> and add a section like this to your SSH configuration file ( <i>~/.ssh/config</i>):</p>
+ <p>In order to access virtual machines using SSH, <a href="/manage_ssh_keys"> add an SSH key to your account</a> and add a section like this to your SSH configuration file ( <i>~/.ssh/config</i>):</p>
<pre>Host *.arvados
TCPKeepAlive yes
ServerAliveInterval 60
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index f72278a..86140cf 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -47,6 +47,10 @@ ArvadosWorkbench::Application.routes.draw do
get 'profile', :on => :member
post 'request_shell_access', :on => :member
end
+ get '/manage_virtual_machines' => 'users#manage_virtual_machines'
+ get '/manage_repositories' => 'users#manage_repositories'
+ get '/manage_current_token' => 'users#manage_current_token'
+ get '/manage_ssh_keys' => 'users#manage_ssh_keys'
get '/manage_account' => 'users#manage_account'
get "/add_ssh_key_popup" => 'users#add_ssh_key_popup', :as => :add_ssh_key_popup
get "/add_ssh_key" => 'users#add_ssh_key', :as => :add_ssh_key
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index 31a297f..b145635 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -49,7 +49,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
assert page.has_no_link?('Not active'), 'Found link - Not active'
assert page.has_no_link?('Sign agreements'), 'Found link - Sign agreements'
- assert_selector "a[href=\"/projects/#{user['uuid']}\"]", text: 'Home project'
+ assert_selector "a[href=\"/projects/#{user['uuid']}\"]", text: 'My home project'
assert page.has_link?('Manage account'), 'No link - Manage account'
if profile_config
@@ -58,7 +58,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
assert page.has_no_link?('Manage profile'), 'Found link - Manage profile'
end
else
- assert_no_selector 'a', text: 'Home project'
+ assert_no_selector 'a', text: 'My home project'
assert page.has_no_link?('Manage account'), 'Found link - Manage account'
assert page.has_no_link?('Manage profile'), 'Found link - Manage profile'
end
diff --git a/apps/workbench/test/integration/user_manage_account_test.rb b/apps/workbench/test/integration/user_manage_account_test.rb
index 3f9a554..c86ba0c 100644
--- a/apps/workbench/test/integration/user_manage_account_test.rb
+++ b/apps/workbench/test/integration/user_manage_account_test.rb
@@ -11,11 +11,11 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
within('.navbar-fixed-top') do
page.find("#notifications-menu").click
within('.dropdown-menu') do
- assert_selector 'a', text: 'My Virtual Machines'
- assert_selector 'a', text: 'My Repositories'
- assert_selector 'a', text: 'My Current Token'
- assert_selector 'a', text: 'My SSH Keys'
- find('a', text: 'My SSH Keys').click
+ assert_selector 'a', text: 'My virtual machines'
+ assert_selector 'a', text: 'My repositories'
+ assert_selector 'a', text: 'My current token'
+ assert_selector 'a', text: 'My SSH keys'
+ find('a', text: 'My SSH keys').click
end
end
@@ -164,7 +164,7 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
within('.navbar-fixed-top') do
page.find("#notifications-menu").click
within('.dropdown-menu') do
- find('a', text: 'My Virtual Machines').click
+ find('a', text: 'My virtual machines').click
end
end
assert_text 'You do not have access to any virtual machines.'
@@ -185,10 +185,10 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
end
[
- ['My Virtual Machines', nil, 'Host name'],
- ['My Repositories', 'Add new repository', 'It may take a minute or two before you can clone your new repository.'],
- ['My Current Token', nil, 'HISTIGNORE=$HISTIGNORE'],
- ['My SSH Keys', 'Add new SSH key', 'Click here to learn about SSH keys in Arvados.'],
+ ['My virtual machines', nil, 'Host name'],
+ ['My repositories', 'Add new repository', 'It may take a minute or two before you can clone your new repository.'],
+ ['My current token', nil, 'HISTIGNORE=$HISTIGNORE'],
+ ['My SSH keys', 'Add new SSH key', 'Click here to learn about SSH keys in Arvados.'],
].each do |page_name, button_name, look_for|
test "test notification menu for page #{page_name}" do
visit page_with_token('admin')
@@ -210,10 +210,10 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
end
[
- ['My Virtual Machines', 'You do not have access to any virtual machines.'],
- ['My Repositories', 'You do not seem to have access to any repositories.'],
- ['My Current Token', 'HISTIGNORE=$HISTIGNORE'],
- ['My SSH Keys', 'You have not yet set up an SSH public key for use with Arvados.'],
+ ['My virtual machines', 'You do not have access to any virtual machines.'],
+ ['My repositories', 'You do not seem to have access to any repositories.'],
+ ['My current token', 'HISTIGNORE=$HISTIGNORE'],
+ ['My SSH keys', 'You have not yet set up an SSH public key for use with Arvados.'],
].each do |page_name, look_for|
test "test notification menu for page #{page_name} when page is empty" do
visit page_with_token('user1_with_load')
diff --git a/apps/workbench/test/integration/user_profile_test.rb b/apps/workbench/test/integration/user_profile_test.rb
index 9321396..05f3c65 100644
--- a/apps/workbench/test/integration/user_profile_test.rb
+++ b/apps/workbench/test/integration/user_profile_test.rb
@@ -54,10 +54,10 @@ class UserProfileTest < ActionDispatch::IntegrationTest
assert page.has_no_link?('Not active'), 'Found link - Not active'
assert page.has_no_link?('Sign agreements'), 'Found link - Sign agreements'
- assert page.has_link?('My Virtual Machines'), 'No link - My Virtual Machines'
- assert page.has_link?('My Repositories'), 'No link - My Repositories'
- assert page.has_link?('My Current Token'), 'No link - My Current Token'
- assert page.has_link?('My SSH Keys'), 'No link - My SSH Keys'
+ assert page.has_link?('My virtual machines'), 'No link - My Virtual Machines'
+ assert page.has_link?('My repositories'), 'No link - My Repositories'
+ assert page.has_link?('My current token'), 'No link - My Current Token'
+ assert page.has_link?('My SSH keys'), 'No link - My SSH Keys'
if profile_config
assert page.has_link?('Manage profile'), 'No link - Manage profile'
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list