function hasHTML5History() {
return !!(window.history && window.history.pushState);
}
-
-function getLocalStorageValue(item) {
- return localStorage.getItem(item);
-}
-
-function clearLocalStorageValue(item) {
- localStorage.removeItem(item);
-}
$(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');
}
$.ajax('/').
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");
+ $('div').remove('.shell_access_requested');
+
+ $('.no_shell_access').append('<div class="alert alert-success"><p class="contain-align-left">A request for shell access was sent.</p></div>');
+ 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');
<% if !@my_virtual_machines.any? %>
<div id='no_shell_access' class='no_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 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 class='no_shell_access_msg'>
+ 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.
<div style='display:inline-block'>
- <%= 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) %>
</div>
+ </div><br/>
+ <div class='shell_access_requested alert alert-info'>
+ <p id='shell_access_requested_msg' class="contain-align-left">A request for shell access was sent eariler.</p>
</div>
</div>
<% else %>
- <script> clearLocalStorageValue('request_shell_access'); </script>
+ <script> localStorage.removeItem('request_shell_access'); </script>
<table class="table virtual-machines-table">
<colgroup>
<col style="width: 25%" />
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
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