Merge branch 'master' into 6445-incorrect-task-runtime-calc
[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           <% if Rails.configuration.shell_in_a_box_url %>
70             <th> Web shell <span class="label label-info">beta</span></th>
71           <% end %>
72         </tr>
73       </thead>
74       <tbody>
75         <% @my_virtual_machines.andand.each do |vm| %>
76           <tr>
77             <td style="word-break:break-all;">
78               <%= vm[:hostname] %>
79             </td>
80             <td style="word-break:break-all;">
81               <%= @my_vm_logins[vm[:uuid]].andand.compact.andand.join(", ") %>
82             </td>
83             <td style="word-break:break-all;">
84               <% if @my_vm_logins[vm[:uuid]] %>
85                 <% @my_vm_logins[vm[:uuid]].each do |login| %>
86                   <code>ssh&nbsp;<%= login %>@<%= vm[:hostname] %>.arvados</code>
87                 <% end %>
88               <% end %>
89             </td>
90             <% if Rails.configuration.shell_in_a_box_url %>
91               <td>
92                 <% @my_vm_logins[vm[:uuid]].andand.each do |login| %>
93                   <%= link_to webshell_virtual_machine_path(vm, login: login), title: "Open a terminal session in your browser", class: 'btn btn-xs btn-default', target: "_blank" do %>
94                     Log in as <%= login %><br />
95                   <% end %>
96                 <% end %>
97               </td>
98             <% end %>
99           </tr>
100         <% end %>
101       </tbody>
102     </table>
103
104     <p><i>~/.ssh/config:</i></p>
105     <pre>Host *.arvados
106       TCPKeepAlive yes
107       ServerAliveInterval 60
108       ProxyCommand ssh -p2222 turnout@switchyard.<%= current_api_host || 'xyzzy.arvadosapi.com' %> -x -a $SSH_PROXY_FLAGS %h
109     </pre>
110   <% end %>
111 </div>
112 </div>