--- /dev/null
+$(document).
+ on('click', "#request_shell_submit", function(e){
+ $(this).html('Sending request ...');
+ $(this).prop('disabled', true);
+ $('div').remove('.request_shell_access_failed');
+
+ $.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>');
+ }).
+ fail(function(jqxhr, status, error) {
+ var $sendButton = $('#request_shell_submit');
+ $sendButton.html('Request shell access');
+ $sendButton.prop('disabled', false);
+ $('.no_shell_access').append('<div class="request_shell_access_failed alert alert-danger"><p class="contain-align-left">Something went wrong. Please try again.</p></div>');
+ });
+ });
</p>
<% if !@my_virtual_machines.any? %>
- You do not have access to any virtual machines. Many of the Arvados features depend on having shell access to a hosted VM.
- <%= link_to 'Request shell access', request_shell_access_user_url(id: current_user.uuid),
- {class: 'btn btn-xs btn-primary', :remote => true} %>
+ <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>
<% else %>
<table class="table virtual-machines-table">
<colgroup>
post 'unsetup', :on => :member
get 'setup_popup', :on => :member
get 'profile', :on => :member
- get 'request_shell_access', :on => :member
+ post 'request_shell_access', :on => :member
end
get '/manage_account' => 'users#manage_account'
get "/add_ssh_key_popup" => 'users#add_ssh_key_popup', :as => :add_ssh_key_popup