Fix 2.4.2 upgrade notes formatting refs #19330
[arvados.git] / apps / workbench / app / views / users / _virtual_machines.html.erb
1 <%# Copyright (C) The Arvados Authors. All rights reserved.
2
3 SPDX-License-Identifier: AGPL-3.0 %>
4
5 <div class="panel panel-default">
6   <div class="panel-heading">
7     <h4 class="panel-title">
8       <%= link_to virtual_machines_user_path(current_user) do %>
9         Virtual Machines
10       <% end %>
11
12     </h4>
13   </div>
14
15 <div id="manage_virtual_machines" class="panel-body">
16   <p>
17     For more information see <%= link_to raw('Arvados Docs &rarr; User Guide &rarr; VM access'),
18   "#{Rails.configuration.Workbench.ArvadosDocsite}/user/getting_started/vm-login-with-webshell.html",
19   target: "_blank"%>.
20   </p>
21
22   <% if !@my_virtual_machines.any? %>
23     <div id="no_shell_access" class="no_shell_access">
24       <div class="alert alert-warning clearfix">
25         <p>
26           You do not have access to any virtual machines.  Some
27           Arvados features require using the command line.  You may
28           request access to a hosted virtual machine with the command
29           line shell.
30         </p>
31         <div class="pull-right">
32           <%= link_to({
33               action: 'request_shell_access',
34               controller: 'users',
35               id: current_user.uuid
36               },
37               method: :post,
38               remote: true,
39               class: 'btn btn-xs btn-primary',
40               data: {
41               disable_with: "Sending request...",
42               on_error_hide: '.no_shell_access .alert-success',
43               on_error_show: '.no_shell_access .alert-danger',
44               on_error_write: '.no_shell_access .alert-danger .error-text',
45               on_success_hide: '.no_shell_access .alert-danger',
46               }) do %>
47             Send request for shell access
48           <% end %>
49         </div>
50       </div>
51       <div class="alert alert-success" style="display:none">
52         <p class="contain-align-left"><%# (see javascripts/request_shell_access.js) %></p>
53       </div>
54       <div class="alert alert-danger" style="display:none">
55         <p class="contain-align-left">Sorry, something went wrong. Please try again. (<span class="error-text"></span>)</p>
56       </div>
57     </div>
58   <% else %>
59     <script> localStorage.removeItem('request_shell_access'); </script>
60     <table class="table virtual-machines-table">
61       <colgroup>
62         <col style="width: 25%" />
63         <col style="width: 25%" />
64         <col style="width: 50%" />
65       </colgroup>
66       <thead>
67         <tr>
68           <th> Host name </th>
69           <th> Login name </th>
70           <th> Command line </th>
71           <% if Rails.configuration.Services.WebShell.ExternalURL != URI("") %>
72             <th> Web shell</th>
73           <% end %>
74         </tr>
75       </thead>
76       <tbody>
77         <% @my_virtual_machines.andand.each do |vm| %>
78           <tr>
79             <td style="word-break:break-all;">
80               <%= vm[:hostname] %>
81             </td>
82             <td style="word-break:break-all;">
83               <%= @my_vm_logins[vm[:uuid]].andand.compact.andand.join(", ") %>
84             </td>
85             <td style="word-break:break-all;">
86               <% if @my_vm_logins[vm[:uuid]] %>
87                 <% @my_vm_logins[vm[:uuid]].each do |login| %>
88                   <code>ssh&nbsp;<%= login %>@<%= vm[:hostname] %><%=Rails.configuration.Workbench.SSHHelpHostSuffix%></code>
89                 <% end %>
90               <% end %>
91             </td>
92             <% if Rails.configuration.Services.WebShell.ExternalURL != URI("") %>
93               <td>
94                 <% @my_vm_logins[vm[:uuid]].andand.each do |login| %>
95                   <%= 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 %>
96                     Log in as <%= login %><br />
97                   <% end %>
98                 <% end %>
99               </td>
100             <% end %>
101           </tr>
102         <% end %>
103       </tbody>
104     </table>
105   <% end %>
106 </div>
107 </div>
108
109 <p>In order to access virtual machines using SSH, <%= link_to ssh_keys_user_path(current_user) do%>add an SSH key to your account<%end%>.</p>
110
111 <%= raw(Rails.configuration.Workbench.SSHHelpPageHTML) %>