closes #8441
[arvados.git] / apps / workbench / app / views / users / _ssh_keys.html.erb
1 <div class="panel panel-default">
2   <div class="panel-heading">
3     <div class="pull-right">
4       <%= link_to raw('<i class="fa fa-plus"></i>' " Add new SSH key"), add_ssh_key_popup_url,
5                    {class: 'btn btn-xs btn-primary', :remote => true, 'data-toggle' =>  "modal",
6                     'data-target' => '#add-ssh-key-modal-window'}  %>
7     </div>
8     <h4 class="panel-title">
9       <%= link_to ssh_keys_user_path(current_user) do %>
10         SSH Keys
11       <%end%>
12     </h4>
13   </div>
14
15 <div id="manage_ssh_keys" class="panel-body">
16   <% if !@my_ssh_keys.any? %>
17      <p> You have not yet set up an SSH public key for use with Arvados. <%= link_to "Learn more.",
18                   "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html",
19                   style: "font-weight: bold",
20                   target: "_blank" %>
21      </p>
22      <p> When you have an SSH key you would like to use, add it using the <b>Add</b> button. </p>
23   <% else %>
24     <table class="table manage-ssh-keys-table">
25       <colgroup>
26         <col style="width: 35%" />
27         <col style="width: 55%" />
28         <col style="width: 10%" />
29       </colgroup>
30       <thead>
31         <tr>
32           <th> Name </th>
33           <th> Key Fingerprint </th>
34           <th> </th>
35         </tr>
36       </thead>
37       <tbody>
38         <% @my_ssh_keys.andand.each do |key| %>
39           <tr style="word-break:break-all;">
40             <td>
41               <%= key[:name] %>
42             </td>
43             <td style="word-break:break-all;">
44               <% if key[:public_key] && key[:public_key].size > 0 %>
45                 <div>
46                   <span title="<%=key[:public_key]%>"> <%=
47                     begin
48                       SSHKey.fingerprint key[:public_key]
49                     rescue
50                       "INVALID KEY: " + key[:public_key]
51                     end
52                    %> </span>
53                 </div>
54               <% else %>
55                   <%= key[:public_key] %>
56               <% end %>
57             </td>
58             <td>
59               <%= link_to(authorized_key_path(id: key[:uuid]), method: :delete, class: 'btn btn-sm', data: {confirm: "Really delete key?"}) do %>
60                   <i class="fa fa-fw fa-trash-o"></i>
61               <% end %>
62             </td>
63           </tr>
64         <% end %>
65       </tbody>
66     </table>
67   <% end %>
68 </div>
69 </div>