[ARVADOS] updated: a1deb1992d8a3b83ef7806ac9b193a56282032c6

git at public.curoverse.com git at public.curoverse.com
Wed Jul 23 17:19:49 EDT 2014


Summary of changes:
 .../app/controllers/manage_account_controller.rb   | 43 +++++++++++++++++
 .../workbench/app/views/application/index.html.erb |  2 +
 .../app/views/layouts/application.html.erb         |  3 +-
 .../manage_account/_show_manage_account.html.erb   | 51 ++++++++++++++++++++
 .../_show_manage_current_token.html.erb            | 11 +++++
 .../_show_manage_repositories.html.erb             | 36 ++++++++++++++
 .../manage_account/_show_manage_ssh_keys.html.erb  | 55 ++++++++++++++++++++++
 .../_show_manage_virtual_machines.html.erb         | 35 ++++++++++++++
 apps/workbench/config/routes.rb                    |  1 +
 9 files changed, 235 insertions(+), 2 deletions(-)
 create mode 100644 apps/workbench/app/controllers/manage_account_controller.rb
 create mode 100644 apps/workbench/app/views/manage_account/_show_manage_account.html.erb
 create mode 100644 apps/workbench/app/views/manage_account/_show_manage_current_token.html.erb
 create mode 100644 apps/workbench/app/views/manage_account/_show_manage_repositories.html.erb
 create mode 100644 apps/workbench/app/views/manage_account/_show_manage_ssh_keys.html.erb
 create mode 100644 apps/workbench/app/views/manage_account/_show_manage_virtual_machines.html.erb

       via  a1deb1992d8a3b83ef7806ac9b193a56282032c6 (commit)
      from  f0abaec0c637772b781993a63b98aab85072eb97 (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 a1deb1992d8a3b83ef7806ac9b193a56282032c6
Author: radhika <radhika at curoverse.com>
Date:   Wed Jul 23 17:19:03 2014 -0400

    3193: add manage account page to topnav.

diff --git a/apps/workbench/app/controllers/manage_account_controller.rb b/apps/workbench/app/controllers/manage_account_controller.rb
new file mode 100644
index 0000000..679db1c
--- /dev/null
+++ b/apps/workbench/app/controllers/manage_account_controller.rb
@@ -0,0 +1,43 @@
+class ManageAccountController < ApplicationController
+
+  def model_class
+    AuthorizedKey
+  end
+
+  def index_pane_list
+    %w(Manage_account)
+  end
+
+  def index    
+    # repositories current user can read / write
+    @repo_links = []
+    Link.where(tail_uuid: current_user.uuid,
+               link_class: 'permission',
+               name: ['can_write', 'can_read']).
+          each do |perm_link|
+            @repo_links << perm_link[:head_uuid]
+          end
+    @repositories = Repository.where(uuid: @repo_links)
+
+    # virtual machines the current user can login into
+    @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]
+              @vm_logins[perm_link.head_uuid] ||= []
+              @vm_logins[perm_link.head_uuid] << perm_link.properties[:username]
+            end
+          end
+    @virtual_machines = VirtualMachine.where(uuid: @vm_logins.keys)
+
+    # current user's ssh keys
+    filters=[["owner_uuid", "=", current_user.uuid]]
+    @ssh_keys = AuthorizedKey.where(key_type: 'SSH', filters: filters)
+    @objects = @ssh_keys
+
+    render_index
+  end
+
+end
diff --git a/apps/workbench/app/views/application/index.html.erb b/apps/workbench/app/views/application/index.html.erb
index 0e72f7a..3e2a608 100644
--- a/apps/workbench/app/views/application/index.html.erb
+++ b/apps/workbench/app/views/application/index.html.erb
@@ -13,6 +13,8 @@
         <i class="fa fa-fw fa-plus"></i> Add a new user
       <% end %>
       <div id="user-setup-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
+    <% elsif controller.controller_name == 'manage_account' %>
+      <%# No add button is needed %>
     <% else %>
       <%= button_to({action: 'create'}, {class: 'btn btn-sm btn-primary'}) do %>
         <i class="fa fa-fw fa-plus"></i>
diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb
index ec2c98b..5725f40 100644
--- a/apps/workbench/app/views/layouts/application.html.erb
+++ b/apps/workbench/app/views/layouts/application.html.erb
@@ -81,8 +81,7 @@
             </a>
             <ul class="dropdown-menu" role="menu">
               <% if current_user.is_active %>
-              <li role="presentation"><a href="/authorized_keys" role="menuitem"><i class="fa fa-key fa-fw"></i> Manage ssh keys</a></li>
-              <li role="presentation"><a href="/api_client_authorizations" role="menuitem"><i class="fa fa-ticket fa-fw"></i> Manage API tokens</a></li>
+              <li role="presentation"><a href="/manage_account" role="menuitem"><i class="fa fa-key fa-fw"></i> Manage account</a></li>
               <li role="presentation" class="divider"></li>
               <% end %>
               <li role="presentation"><a href="<%= logout_path %>" role="menuitem"><i class="fa fa-sign-out fa-fw"></i> Log out</a></li>
diff --git a/apps/workbench/app/views/manage_account/_show_manage_account.html.erb b/apps/workbench/app/views/manage_account/_show_manage_account.html.erb
new file mode 100644
index 0000000..06a3d44
--- /dev/null
+++ b/apps/workbench/app/views/manage_account/_show_manage_account.html.erb
@@ -0,0 +1,51 @@
+<div class="col-sm-6">
+  <div class="panel-group" id="arv-adv-accordion">
+    <% ['Virtual Machines',
+       'Repositories',
+       'Current Token'].each do |section| %>
+      <% section_id = section.gsub(" ","_").downcase %>
+      <div class="panel panel-default">
+        <div class="panel-heading">
+          <h4 class="panel-title">
+            <a data-parent="#arv-adv-accordion" href="#manage_<%=section_id%>">
+              <%= section %>
+            </a>
+          </h4>
+        </div>
+        <div id="manage_<%=section_id%>">
+          <div class="panel-body">
+            <%= render partial: "show_manage_#{section_id}", locals: {repositories: @repositories, virtual_machines: @virtual_machines, vm_logins: @vm_logins, ssh_keys: @ssh_keys} %>
+          </div>
+        </div>
+      </div>
+    <% end %>
+  </div>
+</div>
+<div class="col-sm-6">
+  <div class="panel-group" id="arv-adv-accordion">
+    <% ['SSH Keys'].each do |section| %>
+      <% section_id = section.gsub(" ","_").downcase %>
+      <div class="panel panel-default">
+        <div class="panel-heading">
+          <div class="pull-right">
+            <%= button_to projects_path(method: 'post'), class: 'btn btn-xs btn-primary' do %>
+              <i class="fa fa-fw fa-plus"></i>
+              Add new SSH key
+            <% end %>
+
+          </div>
+          <h4 class="panel-title">
+            <a data-parent="#arv-adv-accordion" href="#manage_<%=section_id%>">
+              <%= section %>
+            </a>
+          </h4>
+        </div>
+        <div id="manage_<%=section_id%>">
+          <div class="panel-body">
+            <%= render partial: "show_manage_#{section_id}", locals: {repositories: @repositories, virtual_machines: @virtual_machines, ssh_keys: @ssh_keys} %>
+          </div>
+        </div>
+      </div>
+    <% end %>
+  </div>
+</div>
diff --git a/apps/workbench/app/views/manage_account/_show_manage_current_token.html.erb b/apps/workbench/app/views/manage_account/_show_manage_current_token.html.erb
new file mode 100644
index 0000000..b87d80a
--- /dev/null
+++ b/apps/workbench/app/views/manage_account/_show_manage_current_token.html.erb
@@ -0,0 +1,11 @@
+### Pasting the following lines at a shell prompt will allow Arvados SDKs</br>
+### to authenticate to your account, <%= current_user.email %></br></br>
+read ARVADOS_API_TOKEN <<EOF</br>
+<%= Thread.current[:arvados_api_token] %></br>
+EOF</br>
+export ARVADOS_API_TOKEN ARVADOS_API_HOST=<%= current_api_host %></br>
+<% if Rails.configuration.arvados_insecure_https %>
+export ARVADOS_API_HOST_INSECURE=true</br>
+<% else %>
+unset ARVADOS_API_HOST_INSECURE</br>
+<% end %>
diff --git a/apps/workbench/app/views/manage_account/_show_manage_repositories.html.erb b/apps/workbench/app/views/manage_account/_show_manage_repositories.html.erb
new file mode 100644
index 0000000..0733b98
--- /dev/null
+++ b/apps/workbench/app/views/manage_account/_show_manage_repositories.html.erb
@@ -0,0 +1,36 @@
+<div>
+  <p>
+    For more information see <%= link_to raw('setting up SSH access'),
+    "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html", target: "_blank"%>
+  </p>
+
+  <table class="table repositories-table">
+    <colgroup>
+      <col style="width: 30%" />
+      <col style="width: 15%" />
+      <col style="width: 55%" />
+    </colgroup>
+    <thead>
+      <tr>
+        <th> Name </th>
+        <th> Writable </th>
+        <th> URL </th>
+      </tr>
+    </thead>
+    <tbody>
+      <% @repositories.andand.each do |repo| %>
+        <tr>
+          <td>
+            <%= repo[:name] %>
+          </td>
+          <td>
+            <%= repo[:push_url] != nil %>
+          </td>
+          <td>
+            <%= repo[:fetch_url] %>
+          </td>
+        </tr>
+      <% end %>
+    </tbody>
+  </table>
+</div>
diff --git a/apps/workbench/app/views/manage_account/_show_manage_ssh_keys.html.erb b/apps/workbench/app/views/manage_account/_show_manage_ssh_keys.html.erb
new file mode 100644
index 0000000..c8245c1
--- /dev/null
+++ b/apps/workbench/app/views/manage_account/_show_manage_ssh_keys.html.erb
@@ -0,0 +1,55 @@
+<div>
+<h4>Add / Delete SSH Keys</h4>
+  <table class="table virtual-machines-table">
+    <colgroup>
+      <col style="width: 95%" />
+      <col style="width: 5%" />
+    </colgroup>
+    <tbody>
+      <% @ssh_keys.andand.each do |key| %>
+        <tr>
+          <td>
+            <%= key[:uuid] %>
+          </td>
+          <td>
+    <%= link_to(authorized_key_path(id: key[:uuid]), method: 'delete', class: 'btn btn-sm', data: {confirm: "Really delete key"}) do %>
+      <i class="fa fa-fw fa-trash-o"></i>
+    <% end %>
+          </td>
+        </tr>
+      <% end %>
+    </tbody>
+  </table>
+</div>
+
+<hr>
+
+<div>
+<h4>Setting up SSH keys</h4>
+<p>
+Sample <code>~/.ssh/config</code>:
+</p>
+
+<pre>
+Host *.arvados
+  ProxyCommand ssh -p2222 turnout at switchyard.<%= current_api_host || 'xyzzy.arvadosapi.com' %> -x -a $SSH_PROXY_FLAGS %h
+<% if @vm_logins.andand.first %>
+  User <%= @vm_logins[@vm_logins.andand.keys.first].andand.first %>
+<% end %>
+</pre>
+
+<p>
+Sample login command:
+</p>
+
+<pre>
+ssh <%= @virtual_machines.first.andand.hostname.andand.sub('.'+current_api_host,'') or 'vm-hostname' %>.arvados
+</pre>
+
+<p>
+  See also:
+  <%= link_to raw('Arvados Docs → User Guide → SSH access'),
+  "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html",
+  target: "_blank"%>.
+</p>
+</div>
diff --git a/apps/workbench/app/views/manage_account/_show_manage_virtual_machines.html.erb b/apps/workbench/app/views/manage_account/_show_manage_virtual_machines.html.erb
new file mode 100644
index 0000000..8eddb69
--- /dev/null
+++ b/apps/workbench/app/views/manage_account/_show_manage_virtual_machines.html.erb
@@ -0,0 +1,35 @@
+<div>
+  <p>
+    For more information see <%= link_to raw('setting up SSH access'),
+    "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html", target: "_blank"%>
+  </p>
+
+  <table class="table virtual-machines-table">
+    <colgroup>
+      <col style="width: 35%" />
+      <col style="width: 35%" />
+      <col style="width: 30%" />
+    </colgroup>
+    <thead>
+      <tr>
+        <th> Host name </th>
+        <th> Login name </th>
+        <th> Last login </th>
+      </tr>
+    </thead>
+    <tbody>
+      <% @virtual_machines.andand.each do |vm| %>
+        <tr>
+          <td>
+            <%= vm[:hostname] %>
+          </td>
+          <td>
+            <%= @vm_logins[vm[:uuid]].andand.compact || [] %>
+          </td>
+          <td>
+          </td>
+        </tr>
+      <% end %>
+    </tbody>
+  </table>
+</div>
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 55e2fda..c7c5643 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -66,6 +66,7 @@ ArvadosWorkbench::Application.routes.draw do
     get 'choose', on: :collection
     post 'share_with', on: :member
   end
+  get '/manage_account' => 'manage_account#index'
 
   post 'actions' => 'actions#post'
   get 'websockets' => 'websocket#index'

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list