[ARVADOS] updated: c5fa3f7b2faea363cf73c7e4a2880086c7c9e4f0

git at public.curoverse.com git at public.curoverse.com
Thu Feb 5 16:23:51 EST 2015


Summary of changes:
 .../app/assets/javascripts/application.js          | 13 +++++++++++
 .../app/assets/javascripts/request_shell_access.js |  1 +
 apps/workbench/app/controllers/users_controller.rb |  3 +++
 apps/workbench/app/views/layouts/body.html.erb     |  4 +++-
 .../views/users/_manage_virtual_machines.html.erb  | 25 +++++++++++++++-------
 apps/workbench/config/routes.rb                    |  1 +
 sdk/cli/bin/crunch-job                             | 16 ++++++++------
 7 files changed, 47 insertions(+), 16 deletions(-)

       via  c5fa3f7b2faea363cf73c7e4a2880086c7c9e4f0 (commit)
       via  826cb14afd19197738ceba11ff382aaaf123a637 (commit)
       via  1e2e0e4f14a730ba1bbea6a4ced5d87ea2766c35 (commit)
       via  5ae2677e5ba023d23d10b2a81c800a007aa80646 (commit)
      from  dcba3e2c566b2cc3d0575f4b11a1deac808d5cd6 (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 c5fa3f7b2faea363cf73c7e4a2880086c7c9e4f0
Merge: 826cb14 1e2e0e4
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Thu Feb 5 16:22:57 2015 -0500

    Merge branch 'master' into 4951-request-vm


commit 826cb14afd19197738ceba11ff382aaaf123a637
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Thu Feb 5 16:20:48 2015 -0500

    4951: when a request for shell access is made, remember this in html5 localStorage so that on future revisits of the page (in the same browser) we can show an info message to that effect rather than showing the request button again.

diff --git a/apps/workbench/app/assets/javascripts/application.js b/apps/workbench/app/assets/javascripts/application.js
index 63887b3..8d92967 100644
--- a/apps/workbench/app/assets/javascripts/application.js
+++ b/apps/workbench/app/assets/javascripts/application.js
@@ -238,3 +238,16 @@ function hideLoadingModal() {
 function hasHTML5History() {
     return !!(window.history && window.history.pushState);
 }
+
+function invokeUrlWithLocalStorageValue(url, alias, item) {
+    value = localStorage.getItem(item);
+    if (value) {
+      window.location = alias;
+    } else {
+      window.location = url;
+    }
+}
+
+function clearLocalStorageValue(item) {
+    localStorage.removeItem(item);
+}
diff --git a/apps/workbench/app/assets/javascripts/request_shell_access.js b/apps/workbench/app/assets/javascripts/request_shell_access.js
index 57e3026..c8cbe34 100644
--- a/apps/workbench/app/assets/javascripts/request_shell_access.js
+++ b/apps/workbench/app/assets/javascripts/request_shell_access.js
@@ -8,6 +8,7 @@ $(document).
       success(function(data, status, jqxhr) {
         $('div').remove('.no_shell_access_msg');
         $('.no_shell_access').append('<div class="alert alert-success"><p class="contain-align-left">Request sent for shell access.</p></div>');
+        localStorage.setItem("request_shell_access", "sent");
       }).
       fail(function(jqxhr, status, error) {
         var $sendButton = $('#request_shell_submit');
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 6d9d8cb..dae9ae5 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -264,6 +264,9 @@ class UsersController < ApplicationController
     # current user's ssh keys
     @my_ssh_keys = AuthorizedKey.where(key_type: 'SSH', owner_uuid: current_user.uuid)
 
+    # when localStorage indicating previous shell access request, the url used is "manage_acct"
+    @local_storage_request_shell_access = true if request.url.include?('/manage_acct')
+
     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 fb28efe..8b1fd73 100644
--- a/apps/workbench/app/views/layouts/body.html.erb
+++ b/apps/workbench/app/views/layouts/body.html.erb
@@ -46,7 +46,9 @@
               </a>
               <ul class="dropdown-menu" role="menu">
                 <% if current_user.is_active %>
-                <li role="menuitem"><a href="/manage_account" role="menuitem"><i class="fa fa-key fa-fw"></i> Manage account</a></li>
+                <li id='manage_account_link' role="menuitem"><a href="#"
+                    onClick="invokeUrlWithLocalStorageValue('/manage_account', '/manage_acct', 'request_shell_access');"
+                    role="menuitem"><i class="fa fa-key fa-fw"></i> Manage account</a></li>
                 <% if Rails.configuration.user_profile_form_fields %>
                   <li role="menuitem"><a href="/users/<%=current_user.uuid%>/profile" role="menuitem"><i class="fa fa-key fa-fw"></i> Manage profile</a></li>
                 <% end %>
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 897f1d8..b324572 100644
--- a/apps/workbench/app/views/users/_manage_virtual_machines.html.erb
+++ b/apps/workbench/app/views/users/_manage_virtual_machines.html.erb
@@ -6,17 +6,26 @@
   </p>
 
   <% if !@my_virtual_machines.any? %>
-    <div id='no_shell_access' class='no_shell_access'>
-      <div id='no_shell_access_msg' class='no_shell_access_msg'>
-        You do not have access to any virtual machines. Many of the Arvados features depend on having shell access to a hosted VM.
-           
-        <div style='display:inline-block'>
-          <%= button_to('Request shell access', request_shell_access_user_url(id: current_user.uuid),
-                         id: 'request_shell_submit', class: 'btn btn-xs btn-primary', remote: true) %>
+    <% if @local_storage_request_shell_access %>
+      <div id='shell_access_requested' class='shell_access_requested'>
+        <div class="alert alert-info">
+          <p class="contain-align-left">You do not have access to any virtual machines. A request was sent on your behalf.</p>
         </div>
       </div>
-    </div>
+    <% else %>
+      <div id='no_shell_access' class='no_shell_access'>
+        <div id='no_shell_access_msg' class='no_shell_access_msg'>
+          You do not have access to any virtual machines. Many of the Arvados features depend on having shell access to a hosted VM.
+             
+          <div style='display:inline-block'>
+            <%= button_to('Request shell access', request_shell_access_user_url(id: current_user.uuid),
+                           id: 'request_shell_submit', class: 'btn btn-xs btn-primary', remote: true) %>
+          </div>
+        </div>
+      </div>
+    <% end %>
   <% else %>
+    <script> clearLocalStorageValue('request_shell_access'); </script>
     <table class="table virtual-machines-table">
       <colgroup>
         <col style="width: 25%" />
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 7ed02e7..a077c2e 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -42,6 +42,7 @@ ArvadosWorkbench::Application.routes.draw do
     post 'request_shell_access', :on => :member
   end
   get '/manage_account' => 'users#manage_account'
+  get '/manage_acct' => 'users#manage_account', :as => :manage_acct
   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
   resources :logs

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list