Merge branch '5416-browse-repo-tree' refs #5416
[arvados.git] / apps / workbench / app / views / users / _manage_virtual_machines.html.erb
1 <div class="panel panel-default">
2   <div class="panel-heading">
3     <h4 class="panel-title">
4       <a data-parent="#arv-adv-accordion" href="#manage_virtual_machines">
5         Virtual Machines
6       </a>
7     </h4>
8   </div>
9
10 <div id="manage_virtual_machines" class="panel-body">
11   <p>
12     For more information see <%= link_to raw('Arvados Docs &rarr; User Guide &rarr; SSH access'),
13   "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html",
14   target: "_blank"%>.
15     <% if @my_virtual_machines.any? or true %>
16       A sample <code>~/.ssh/config</code> entry is provided below.
17     <% end %>
18   </p>
19
20   <% if !@my_virtual_machines.any? %>
21     <div id="no_shell_access" class="no_shell_access">
22       <div class="alert alert-warning clearfix">
23         <p>
24           You do not have access to any virtual machines.  Some
25           Arvados features require using the command line.  You may
26           request access to a hosted virtual machine with the command
27           line shell.
28         </p>
29         <div class="pull-right">
30           <%= link_to({
31               action: 'request_shell_access',
32               controller: 'users',
33               id: current_user.uuid
34               },
35               method: :post,
36               remote: true,
37               class: 'btn btn-xs btn-primary',
38               data: {
39               disable_with: "Sending request...",
40               on_error_hide: '.no_shell_access .alert-success',
41               on_error_show: '.no_shell_access .alert-danger',
42               on_error_write: '.no_shell_access .alert-danger .error-text',
43               on_success_hide: '.no_shell_access .alert-danger',
44               }) do %>
45             Send request for shell access
46           <% end %>
47         </div>
48       </div>
49       <div class="alert alert-success" style="display:none">
50         <p class="contain-align-left"><%# (see javascripts/request_shell_access.js) %></p>
51       </div>
52       <div class="alert alert-danger" style="display:none">
53         <p class="contain-align-left">Sorry, something went wrong. Please try again. (<span class="error-text"></span>)</p>
54       </div>
55     </div>
56   <% else %>
57     <script> localStorage.removeItem('request_shell_access'); </script>
58     <table class="table virtual-machines-table">
59       <colgroup>
60         <col style="width: 25%" />
61         <col style="width: 25%" />
62         <col style="width: 50%" />
63       </colgroup>
64       <thead>
65         <tr>
66           <th> Host name </th>
67           <th> Login name </th>
68           <th> Command line </th>
69         </tr>
70       </thead>
71       <tbody>
72         <% @my_virtual_machines.andand.each do |vm| %>
73           <tr>
74             <td style="word-break:break-all;">
75               <%= vm[:hostname] %>
76             </td>
77             <td style="word-break:break-all;">
78               <%= @my_vm_logins[vm[:uuid]].andand.compact.andand.join(", ") %>
79             </td>
80             <td style="word-break:break-all;">
81               <% if @my_vm_logins[vm[:uuid]] %>
82                 <% @my_vm_logins[vm[:uuid]].each do |login| %>
83                   <code>ssh&nbsp;<%= login %>@<%= vm[:hostname] %>.arvados</code>
84                 <% end %>
85               <% end %>
86             </td>
87           </tr>
88         <% end %>
89       </tbody>
90     </table>
91
92     <p><i>~/.ssh/config:</i></p>
93     <pre>Host *.arvados
94       TCPKeepAlive yes
95       ServerAliveInterval 60
96       ProxyCommand ssh -p2222 turnout@switchyard.<%= current_api_host || 'xyzzy.arvadosapi.com' %> -x -a $SSH_PROXY_FLAGS %h
97     </pre>
98   <% end %>
99 </div>
100 </div>