<%# Copyright (C) The Arvados Authors. All rights reserved. SPDX-License-Identifier: AGPL-3.0 %>

<%= link_to virtual_machines_user_path(current_user) do %> Virtual Machines <% end %>

For more information see <%= link_to raw('Arvados Docs → User Guide → VM access'), "#{Rails.configuration.Workbench.ArvadosDocsite}/user/getting_started/vm-login-with-webshell.html", target: "_blank"%>.

<% if !@my_virtual_machines.any? %>

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.

<%= 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 %>
<% else %> <% if Rails.configuration.Services.WebShell.ExternalURL != URI("") %> <% end %> <% @my_virtual_machines.andand.each do |vm| %> <% if Rails.configuration.Services.WebShell.ExternalURL != URI("") %> <% end %> <% end %>
Host name Login name Command line Web shell beta
<%= vm[:hostname] %> <%= @my_vm_logins[vm[:uuid]].andand.compact.andand.join(", ") %> <% if @my_vm_logins[vm[:uuid]] %> <% @my_vm_logins[vm[:uuid]].each do |login| %> ssh <%= login %>@<%= vm[:hostname] %>.<%= current_uuid_prefix || 'xyzzy' %> <% end %> <% end %> <% @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 %>
<% end %> <% end %>
<% end %>

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%> and add a section like this to your SSH configuration file ( ~/.ssh/config):

Host *.<%= current_uuid_prefix || 'xyzzy' %>
      TCPKeepAlive yes
      ServerAliveInterval 60
      ProxyCommand ssh -p2222 turnout@switchyard.<%= current_api_host || 'xyzzy.arvadosapi.com' %> -x -a $SSH_PROXY_FLAGS %h