6588: Added new pages in notifications menu for repositories, virtual machines,
[arvados.git] / apps / workbench / app / views / users / _manage_virtual_machines.html.erb
index c6190ec5e142198aef4a4227d42027daee947841..daa0fc95b67f9c90f60cfffb164ff83f98b71cb0 100644 (file)
@@ -1,13 +1,57 @@
-<div>
+<div class="panel panel-default">
+  <div class="panel-heading">
+    <h4 class="panel-title">
+      <a data-parent="#arv-adv-accordion" href="#manage_virtual_machines">
+        Virtual Machines
+      </a>
+    </h4>
+  </div>
+
+<div id="manage_virtual_machines" class="panel-body">
   <p>
-    For more information see <%= link_to raw('Arvados Docs &rarr; User Guide &rarr; SSH access'),
-  "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html",
-  target: "_blank"%>.  A sample <i>~/.ssh/config</i> entry is provided below.
+    For more information see <%= link_to raw('Arvados Docs &rarr; User Guide &rarr; VM access'),
+  "#{Rails.configuration.arvados_docsite}/user/getting_started/vm-login-with-webshell.html",
+  target: "_blank"%>.
   </p>
 
   <% if !@my_virtual_machines.any? %>
-    You do not seem to have access to any virtual machines. If you would like to request access, please contact your system admin.
+    <div id="no_shell_access" class="no_shell_access">
+      <div class="alert alert-warning clearfix">
+        <p>
+          You do not have access to any virtual machines.  Some
+          Arvados features require using the command line.  You may
+          request access to a hosted virtual machine with the command
+          line shell.
+        </p>
+        <div class="pull-right">
+          <%= link_to({
+              action: 'request_shell_access',
+              controller: 'users',
+              id: current_user.uuid
+              },
+              method: :post,
+              remote: true,
+              class: 'btn btn-xs btn-primary',
+              data: {
+              disable_with: "Sending request...",
+              on_error_hide: '.no_shell_access .alert-success',
+              on_error_show: '.no_shell_access .alert-danger',
+              on_error_write: '.no_shell_access .alert-danger .error-text',
+              on_success_hide: '.no_shell_access .alert-danger',
+              }) do %>
+            Send request for shell access
+          <% end %>
+        </div>
+      </div>
+      <div class="alert alert-success" style="display:none">
+        <p class="contain-align-left"><%# (see javascripts/request_shell_access.js) %></p>
+      </div>
+      <div class="alert alert-danger" style="display:none">
+        <p class="contain-align-left">Sorry, something went wrong. Please try again. (<span class="error-text"></span>)</p>
+      </div>
+    </div>
   <% else %>
+    <script> localStorage.removeItem('request_shell_access'); </script>
     <table class="table virtual-machines-table">
       <colgroup>
         <col style="width: 25%" />
@@ -19,6 +63,9 @@
           <th> Host name </th>
           <th> Login name </th>
           <th> Command line </th>
+          <% if Rails.configuration.shell_in_a_box_url %>
+            <th> Web shell <span class="label label-info">beta</span></th>
+          <% end %>
         </tr>
       </thead>
       <tbody>
                 <% end %>
               <% end %>
             </td>
+            <% if Rails.configuration.shell_in_a_box_url %>
+              <td>
+                <% @my_vm_logins[vm[:uuid]].andand.each do |login| %>
+                  <%= 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 %>
+                    Log in as <%= login %><br />
+                  <% end %>
+                <% end %>
+              </td>
+            <% end %>
           </tr>
         <% end %>
       </tbody>
     </table>
-
-    <p><i>~/.ssh/config:</i></p>
+  <% end %>
+</div>
+</div>
+  <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>
     <pre>Host *.arvados
       TCPKeepAlive yes
       ServerAliveInterval 60
       ProxyCommand ssh -p2222 turnout@switchyard.<%= current_api_host || 'xyzzy.arvadosapi.com' %> -x -a $SSH_PROXY_FLAGS %h
     </pre>
-  <% end %>
-</div>