6588: Added new pages in notifications menu for repositories, virtual machines,
[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; VM access'),
13   "#{Rails.configuration.arvados_docsite}/user/getting_started/vm-login-with-webshell.html",
14   target: "_blank"%>.
15   </p>
16
17   <% if !@my_virtual_machines.any? %>
18     <div id="no_shell_access" class="no_shell_access">
19       <div class="alert alert-warning clearfix">
20         <p>
21           You do not have access to any virtual machines.  Some
22           Arvados features require using the command line.  You may
23           request access to a hosted virtual machine with the command
24           line shell.
25         </p>
26         <div class="pull-right">
27           <%= link_to({
28               action: 'request_shell_access',
29               controller: 'users',
30               id: current_user.uuid
31               },
32               method: :post,
33               remote: true,
34               class: 'btn btn-xs btn-primary',
35               data: {
36               disable_with: "Sending request...",
37               on_error_hide: '.no_shell_access .alert-success',
38               on_error_show: '.no_shell_access .alert-danger',
39               on_error_write: '.no_shell_access .alert-danger .error-text',
40               on_success_hide: '.no_shell_access .alert-danger',
41               }) do %>
42             Send request for shell access
43           <% end %>
44         </div>
45       </div>
46       <div class="alert alert-success" style="display:none">
47         <p class="contain-align-left"><%# (see javascripts/request_shell_access.js) %></p>
48       </div>
49       <div class="alert alert-danger" style="display:none">
50         <p class="contain-align-left">Sorry, something went wrong. Please try again. (<span class="error-text"></span>)</p>
51       </div>
52     </div>
53   <% else %>
54     <script> localStorage.removeItem('request_shell_access'); </script>
55     <table class="table virtual-machines-table">
56       <colgroup>
57         <col style="width: 25%" />
58         <col style="width: 25%" />
59         <col style="width: 50%" />
60       </colgroup>
61       <thead>
62         <tr>
63           <th> Host name </th>
64           <th> Login name </th>
65           <th> Command line </th>
66           <% if Rails.configuration.shell_in_a_box_url %>
67             <th> Web shell <span class="label label-info">beta</span></th>
68           <% end %>
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             <% if Rails.configuration.shell_in_a_box_url %>
88               <td>
89                 <% @my_vm_logins[vm[:uuid]].andand.each do |login| %>
90                   <%= 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 %>
91                     Log in as <%= login %><br />
92                   <% end %>
93                 <% end %>
94               </td>
95             <% end %>
96           </tr>
97         <% end %>
98       </tbody>
99     </table>
100   <% end %>
101 </div>
102 </div>
103   <p>In order to access virtual machines using SSH, <%= link_to raw('add an SSH key to your account'), manage_account_path(page: "manage_ssh_keys") %> and add a section like this to your SSH configuration file ( <i>~/.ssh/config</i>):</p>
104     <pre>Host *.arvados
105       TCPKeepAlive yes
106       ServerAliveInterval 60
107       ProxyCommand ssh -p2222 turnout@switchyard.<%= current_api_host || 'xyzzy.arvadosapi.com' %> -x -a $SSH_PROXY_FLAGS %h
108     </pre>