4951: button_to cannot be used to submit; instead change to link_to
[arvados.git] / apps / workbench / app / views / users / _manage_virtual_machines.html.erb
1 <div>
2   <p>
3     For more information see <%= link_to raw('Arvados Docs &rarr; User Guide &rarr; SSH access'),
4   "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html",
5   target: "_blank"%>.  A sample <i>~/.ssh/config</i> entry is provided below.
6   </p>
7
8   <% if !@my_virtual_machines.any? %>
9     <div id='no_shell_access' class='no_shell_access'>
10       <div class='no_shell_access_msg'>
11         You do not have access to any virtual machines.
12         Some Arvados features require using the command line.
13         You may request access to a hosted virtual machine with the command line shell.
14         &nbsp;&nbsp;&nbsp;
15         <div style='display:inline-block'>
16           <%= link_to({action: 'request_shell_access', controller: 'users', id: current_user.uuid},
17                        method: :post, remote: true, class: 'btn btn-xs btn-primary',
18                        id: 'request_shell_submit', data: {disable_with: "Sending request..."}) do %>
19               Send request for shell access
20           <% end %>
21         </div>
22       </div><br/>
23       <div class='shell_access_requested alert alert-info'>
24         <p id='shell_access_requested_msg' class="contain-align-left">A request for shell access was sent eariler.</p>
25       </div>
26     </div>
27   <% else %>
28     <script> localStorage.removeItem('request_shell_access'); </script>
29     <table class="table virtual-machines-table">
30       <colgroup>
31         <col style="width: 25%" />
32         <col style="width: 25%" />
33         <col style="width: 50%" />
34       </colgroup>
35       <thead>
36         <tr>
37           <th> Host name </th>
38           <th> Login name </th>
39           <th> Command line </th>
40         </tr>
41       </thead>
42       <tbody>
43         <% @my_virtual_machines.andand.each do |vm| %>
44           <tr>
45             <td style="word-break:break-all;">
46               <%= vm[:hostname] %>
47             </td>
48             <td style="word-break:break-all;">
49               <%= @my_vm_logins[vm[:uuid]].andand.compact.andand.join(", ") %>
50             </td>
51             <td style="word-break:break-all;">
52               <% if @my_vm_logins[vm[:uuid]] %>
53                 <% @my_vm_logins[vm[:uuid]].each do |login| %>
54                   <code>ssh&nbsp;<%= login %>@<%= vm[:hostname] %>.arvados</code>
55                 <% end %>
56               <% end %>
57             </td>
58           </tr>
59         <% end %>
60       </tbody>
61     </table>
62
63     <p><i>~/.ssh/config:</i></p>
64     <pre>Host *.arvados
65       TCPKeepAlive yes
66       ServerAliveInterval 60
67       ProxyCommand ssh -p2222 turnout@switchyard.<%= current_api_host || 'xyzzy.arvadosapi.com' %> -x -a $SSH_PROXY_FLAGS %h
68     </pre>
69   <% end %>
70 </div>