4951: localStorage lookup much simplified and handled during page loading.
[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 id='shell_access_requested' class='shell_access_requested'>
11         <div class="alert alert-info">
12           <p class="contain-align-left">You do not have access to any virtual machines. A request was sent on your behalf.</p>
13         </div>
14       </div>
15
16       <div id='no_shell_access_msg' class='no_shell_access_msg'>
17         You do not have access to any virtual machines. Many of the Arvados features depend on having shell access to a hosted VM.
18         &nbsp;&nbsp;&nbsp;
19         <div style='display:inline-block'>
20           <%= button_to('Request shell access', request_shell_access_user_url(id: current_user.uuid),
21                          id: 'request_shell_submit', class: 'btn btn-xs btn-primary', remote: true) %>
22         </div>
23       </div>
24     </div>
25   <% else %>
26     <script> clearLocalStorageValue('request_shell_access'); </script>
27     <table class="table virtual-machines-table">
28       <colgroup>
29         <col style="width: 25%" />
30         <col style="width: 25%" />
31         <col style="width: 50%" />
32       </colgroup>
33       <thead>
34         <tr>
35           <th> Host name </th>
36           <th> Login name </th>
37           <th> Command line </th>
38         </tr>
39       </thead>
40       <tbody>
41         <% @my_virtual_machines.andand.each do |vm| %>
42           <tr>
43             <td style="word-break:break-all;">
44               <%= vm[:hostname] %>
45             </td>
46             <td style="word-break:break-all;">
47               <%= @my_vm_logins[vm[:uuid]].andand.compact.andand.join(", ") %>
48             </td>
49             <td style="word-break:break-all;">
50               <% if @my_vm_logins[vm[:uuid]] %>
51                 <% @my_vm_logins[vm[:uuid]].each do |login| %>
52                   <code>ssh&nbsp;<%= login %>@<%= vm[:hostname] %>.arvados</code>
53                 <% end %>
54               <% end %>
55             </td>
56           </tr>
57         <% end %>
58       </tbody>
59     </table>
60
61     <p><i>~/.ssh/config:</i></p>
62     <pre>Host *.arvados
63       TCPKeepAlive yes
64       ServerAliveInterval 60
65       ProxyCommand ssh -p2222 turnout@switchyard.<%= current_api_host || 'xyzzy.arvadosapi.com' %> -x -a $SSH_PROXY_FLAGS %h
66     </pre>
67   <% end %>
68 </div>