From f5a30607d1746b29688363530a3011ee5c2f4f9a Mon Sep 17 00:00:00 2001 From: Radhika Chippada Date: Wed, 11 Feb 2015 14:07:24 -0500 Subject: [PATCH] 4951: Incorporate review feedback. Always show the request button, along with the "sent" message if applicable. Include timestamp in sent message. Some text updates as well. --- .../app/assets/javascripts/application.js | 8 -------- .../javascripts/request_shell_access.js | 14 ++++++++++---- .../users/_manage_virtual_machines.html.erb | 19 +++++++++---------- .../integration/user_manage_account_test.rb | 9 +++++---- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/apps/workbench/app/assets/javascripts/application.js b/apps/workbench/app/assets/javascripts/application.js index d80420b3e5..63887b3ab9 100644 --- a/apps/workbench/app/assets/javascripts/application.js +++ b/apps/workbench/app/assets/javascripts/application.js @@ -238,11 +238,3 @@ function hideLoadingModal() { function hasHTML5History() { return !!(window.history && window.history.pushState); } - -function getLocalStorageValue(item) { - return localStorage.getItem(item); -} - -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 9378c6b0bf..a40334b8a2 100644 --- a/apps/workbench/app/assets/javascripts/request_shell_access.js +++ b/apps/workbench/app/assets/javascripts/request_shell_access.js @@ -1,8 +1,9 @@ $(document).ready(function(){ var $noShellAccessDiv = $('#no_shell_access'); if ($noShellAccessDiv.length) { - if (getLocalStorageValue('request_shell_access') == 'sent') { - $('div').remove('.no_shell_access_msg'); + requestSent = localStorage.getItem('request_shell_access'); + if (requestSent != null) { + $("#shell_access_requested_msg").html(requestSent) } else { $('div').remove('.shell_access_requested'); } @@ -18,8 +19,13 @@ $(document). $.ajax('/'). success(function(data, status, jqxhr) { $('div').remove('.no_shell_access_msg'); - $('.no_shell_access').append('

Request sent for shell access.

'); - localStorage.setItem("request_shell_access", "sent"); + $('div').remove('.shell_access_requested'); + + $('.no_shell_access').append('

A request for shell access was sent.

'); + var timestamp = new Date(); + localStorage.setItem("request_shell_access", "A request for shell access was sent on " + + timestamp.toLocaleDateString() + + " at " + timestamp.toLocaleTimeString()); }). fail(function(jqxhr, status, error) { var $sendButton = $('#request_shell_submit'); 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 5683316841..1e7fb3b07e 100644 --- a/apps/workbench/app/views/users/_manage_virtual_machines.html.erb +++ b/apps/workbench/app/views/users/_manage_virtual_machines.html.erb @@ -7,23 +7,22 @@ <% if !@my_virtual_machines.any? %>
-
-
-

You do not have access to any virtual machines. A request was sent on your behalf.

-
-
- -
- You do not have access to any virtual machines. Many of the Arvados features depend on having shell access to a hosted VM. +
+ You do not have access to any virtual machines. + Some Arvados features require using the command line. + You may request access to a hosted virtual machine with the command line shell.    
- <%= button_to('Request shell access', request_shell_access_user_url(id: current_user.uuid), + <%= button_to('Send request for shell access', request_shell_access_user_url(id: current_user.uuid), id: 'request_shell_submit', class: 'btn btn-xs btn-primary', remote: true) %>
+

+
+

A request for shell access was sent eariler.

<% else %> - + diff --git a/apps/workbench/test/integration/user_manage_account_test.rb b/apps/workbench/test/integration/user_manage_account_test.rb index af790f35c9..a84d424d3e 100644 --- a/apps/workbench/test/integration/user_manage_account_test.rb +++ b/apps/workbench/test/integration/user_manage_account_test.rb @@ -137,8 +137,9 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest test "request shell access" do visit page_with_token('spectator', '/manage_account') assert_text 'You do not have access to any virtual machines' - click_button 'Request shell access' - assert_text 'Request sent for shell access' + click_button 'Send request for shell access' + assert_text 'A request for shell access was sent.' + assert_no_text 'You do not have access to any virtual machines.' # revisit the page and verify that the Request button is no longer shown within('.navbar-fixed-top') do @@ -147,7 +148,7 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest find('a', text: 'Manage account').click end end - assert_no_selector 'a', text: 'Request shell access' - assert_text 'You do not have access to any virtual machines. A request was sent on your behalf.' + assert_text 'You do not have access to any virtual machines.' + assert_text 'A request for shell access was sent on ' end end -- 2.30.2