Merge branch 'master' into 3354-render-textile
[arvados.git] / apps / workbench / app / views / users / _manage_ssh_keys.html.erb
index 44dc6605242aa35301e9df519c337ec9fc250b87..17b64b27f9f7c7d74141bc55ea52de7ba3b080ff 100644 (file)
@@ -1,36 +1,46 @@
 <div>
-<h4>Add / Delete SSH Keys</h4>
   <% if !@my_ssh_keys.any? %>
      <p> You have not yet set up an SSH public key for use with Arvados. </p>
-     <p>  <%= link_to "Click here to learn about SSH keys in Arvados.",
+     <p>  <%= link_to "Click here",
                  "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html", 
                  style: "font-weight: bold",
-                 target: "_blank" %>       </p>
+                 target: "_blank" %>  to learn about SSH keys in Arvados.
+     </p>
      <p> When you have an SSH key you would like to use, add it using the <b>Add</b> button. </p>
-  <% end %>
-
-  <% if @my_ssh_keys.andand.any? %>
-    <table class="table virtual-machines-table">
+  <% else %>
+    <table class="table manage-ssh-keys-table">
       <colgroup>
-        <col style="width: 15%" />
-        <col style="width: 80%" />
-        <col style="width: 5%" />
+        <col style="width: 35%" />
+        <col style="width: 55%" />
+        <col style="width: 10%" />
       </colgroup>
       <thead>
         <tr>
           <th> Name </th>
-          <th> Public Key </th>
+          <th> Key Fingerprint </th>
           <th> </th>
         </tr>
       </thead>
       <tbody>
         <% @my_ssh_keys.andand.each do |key| %>
-          <tr>
-            <td style="word-break:break-all;">
+          <tr style="word-break:break-all;">
+            <td>
               <%= key[:name] %>
             </td>
             <td style="word-break:break-all;">
-              <%= key[:public_key] %>
+              <% if key[:public_key] && key[:public_key].size > 0 %>
+                <div>
+                  <span title="<%=key[:public_key]%>"> <%=
+                    begin
+                      SSHKey.fingerprint key[:public_key]
+                    rescue
+                      "INVALID KEY: " + key[:public_key]
+                    end
+                   %> </span>
+                </div>
+              <% else %>
+                  <%= key[:public_key] %>
+              <% end %>
             </td>
             <td>
               <%= link_to(authorized_key_path(id: key[:uuid]), method: 'delete', class: 'btn btn-sm', data: {confirm: "Really delete key?"}) do %>
     </table>
   <% end %>
 </div>
-
-<hr>
-
-<div>
-<h4>Setting up SSH access</h4>
-<p>
-Sample <code>~/.ssh/config</code>:
-</p>
-
-<pre>
-Host *.arvados
-  ProxyCommand ssh -p2222 turnout@switchyard.<%= current_api_host || 'xyzzy.arvadosapi.com' %> -x -a $SSH_PROXY_FLAGS %h
-<% if @my_vm_logins.andand.first %>
-  User <%= @my_vm_logins[@my_vm_logins.andand.keys.first].andand.first %>
-<% end %>
-</pre>
-
-<p>
-Sample login command:
-</p>
-
-<pre>
-ssh <%= @my_virtual_machines.first.andand.hostname.andand.sub('.'+current_api_host,'') or 'vm-hostname' %>.arvados
-</pre>
-
-<p>
-  See also:
-  <%= link_to raw('Arvados Docs &rarr; User Guide &rarr; SSH access'),
-  "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html",
-  target: "_blank"%>.
-</p>
-</div>