4951: add ajax handling for request shell access button.
[arvados.git] / apps / workbench / app / assets / javascripts / request_shell_access.js
1 $(document).
2   on('click', "#request_shell_submit", function(e){
3     $(this).html('Sending request ...');
4     $(this).prop('disabled', true);
5     $('div').remove('.request_shell_access_failed');
6
7     $.ajax('/').
8       success(function(data, status, jqxhr) {
9         $('div').remove('.no_shell_access_msg');
10         $('.no_shell_access').append('<div class="alert alert-success"><p class="contain-align-left">Request sent for shell access.</p></div>');
11       }).
12       fail(function(jqxhr, status, error) {
13         var $sendButton = $('#request_shell_submit');
14         $sendButton.html('Request shell access');
15         $sendButton.prop('disabled', false);
16         $('.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>');
17       });
18   });