* Added "Docs" menu to top navbar
[arvados.git] / apps / workbench / app / views / users / home.html.erb
1 <% content_for :head do %>
2     <style>
3       .dash-list {
4         padding: 9px 0;
5       }
6       .dash-list>ul>li>a>span {
7       min-width: 1.5em;
8       margin-left: auto;
9       margin-right: auto;
10       }
11       .job-table td {
12       overflow-x: hidden;
13       }
14       .centerme {
15       margin-left: auto;
16       margin-right: auto;
17       text-align: center;
18       }
19       .bigfatnumber {
20       font-size: 4em;
21       font-weight: bold;
22       }
23     </style>
24 <% end %>
25
26 <% if current_user.andand.is_active %>
27
28
29 <% if @my_ssh_keys.count == 0%>
30   <div class="alert alert-info">
31     <button type="button" class="close" data-dismiss="alert">&times;</button>
32     <div class="span5" style="overflow: hidden; margin-right: 1em">
33       <%= image_tag "dax.png", style: "max-width: 10%; margin-right: 1em; float: left" %>
34       Hi, I noticed that you have not yet set up an SSH public key for use with Arvados.  
35       <%= link_to "Click here to learn how to create a SSH key pair.",
36           "http://doc.arvados.org/user/getting_started/ssh-access.html", class: "alert-link" %>
37       After you have created an SSH key, you can paste your SSH public key
38       in the text box.
39     </div>
40       <%= form_for AuthorizedKey.new do |f| %>
41         <%= hidden_field_tag :return_to, request.original_url %>
42         <%= f.text_area :public_key, cols: 50, rows: 4, placeholder: "Paste your public key here", style: "width: 45%" %>
43         <%= f.submit :Save, value: raw("&check;"), class: "btn btn-primary", style: "vertical-align: top" %>
44       <% end %>
45   </div>
46 <% end %>
47
48 <% if Collection.limit(1).where(created_by: current_user.uuid).count == 0 %>
49 <div class="alert alert-block alert-info">
50   <button type="button" class="close" data-dismiss="alert">&times;</button>
51   <p><%= image_tag "dax.png", style: "max-width: 5%; margin-right: 1em" %>
52     Hi, I noticed you haven't uploaded a new collection yet. 
53     <%= link_to "Click here to learn how to upload data to Arvados Keep.", "http://doc.arvados.org/user/tutorials/tutorial-keep.html", class: "alert-link" %>
54   </p>
55 </div>
56
57 <% end %>
58
59 <% if Job.limit(1).where(created_by: current_user.uuid).count == 0 %>
60 <div class="alert alert-block alert-info">
61   <button type="button" class="close" data-dismiss="alert">&times;</button>  
62   <p><%= image_tag "dax.png", style: "max-width: 5%; margin-right: 1em" %>
63     Hi, I noticed you haven't run a job yet. 
64     <%= link_to "Click here to learn how to run an Arvados Crunch job.", "http://doc.arvados.org/user/tutorials/tutorial-job1.html", class: "alert-link" %>
65   </p>
66 </div>
67 <% end %>
68
69 <% if PipelineInstance.limit(1).where(created_by: current_user.uuid).count == 0 %>
70 <div class="alert alert-block alert-info">
71   <button type="button" class="close" data-dismiss="alert">&times;</button>
72   <p><%= image_tag "dax.png", style: "max-width: 5%; margin-right: 1em" %>
73     Hi, I noticed you haven't run a pipeline yet.  
74     <%= link_to "Click here to learn how to run an Arvados Crunch pipeline.", "http://doc.arvados.org/user/tutorials/tutorial-new-pipeline.html", class: "alert-link" %>
75   </p>
76 </div>
77 <% end %>
78
79 <div class="row-fluid">
80   <div class="col span12">
81     <div class="clearfix">
82       <h4>Account summary</h4>
83       <div class="well clearfix">
84         <% [Human, Trait, Collection, 'File', PipelineTemplate, PipelineInstance].each do |aclass| %>
85         <div class="col span2 centerme">
86           <span class="bigfatnumber">
87             <% if aclass == 'File' %>
88             <%= Collection.limit(4000).where({}).collect(&:files).flatten(1).count %>
89             <% else %>
90             <%= aclass.limit(4000).where({}).count %>
91             <% end %>
92           </span>
93           <br />
94           <%= raw(aclass.to_s.pluralize.underscore.gsub '_', '&nbsp;') %>
95         </div>
96         <% end %>
97       </div>
98     </div>
99   </div>
100 </div>
101
102 <div class="row-fluid">
103   <div class="col span3">
104     <div class="clearfix">
105       <h4>Configuration</h4>
106       <div class="well dash-list">
107         <ul class="nav nav-list">
108           <li class="clearfix">
109             <a href="<%= authorized_keys_path %>">
110               <span class="pull-left"><%= raw '&#x2714;' if @my_ssh_keys.any? %>&nbsp;</span>
111               SSH keys
112               <span class="pull-right"><%= @my_ssh_keys.count %></span>
113             </a>
114           </li>
115           <li class="clearfix">
116             <a href="<%= virtual_machines_path %>">
117               <span class="pull-left"><%= raw '&#x2714;' if @my_vm_perms.any? %>&nbsp;</span>
118               Virtual machines
119               <span class="pull-right"><%= @my_vm_perms.collect(&:head_uuid).uniq.count %></span>
120             </a>
121           </li>
122           <li class="clearfix">
123             <a href="<%= repositories_path %>">
124               <span class="pull-left"><%= raw '&#x2714;' if @my_repo_perms.any? %>&nbsp;</span>
125               Repositories
126               <span class="pull-right"><%= @my_repo_perms.collect(&:head_uuid).uniq.count %></span>
127             </a>
128           </li>
129         </ul>
130       </div>
131     </div>
132   </div>
133   <div class="col span4">
134     <%= render partial: 'quick_links' %>
135   </div>
136   <div class="col span5">
137     <div class="clearfix">
138       <h4>Recent jobs</h4>
139       <% if not current_user.andand.is_active or @my_jobs.empty? %>
140       (None)
141       <% else %>
142       <table class="table table-bordered table-condensed job-table">
143         <% @my_jobs[0..8].each do |j| %>
144         <tr>
145           <td>
146             <small>
147               <%= link_to j.script[0..31], job_path(j.uuid) %>
148             </small>
149           </td>
150           <td>
151             <small>
152               <%= j.script_version[0..7] %>
153             </small>
154           </td>
155           <td>
156             <small>
157               <%= j.script_parameters.andand[:input].andand.to_s.andand[0..7] %>
158             </small>
159           </td>
160           <td>
161             <% if j.success %>
162             <span class="label label-success">finished</span>
163             <% elsif j.success == false %>
164             <span class="label label-danger">failed</span>
165             <% elsif j.running and j.started_at and not j.finished_at %>
166             <% percent_total_tasks = 100 / (j.tasks_summary[:running] + j.tasks_summary[:done] + j.tasks_summary[:todo]) rescue 0 %>
167             <div class="progress" style="margin-bottom: 0">
168               <div class="bar bar-success" style="width: <%= j.tasks_summary[:done] * percent_total_tasks rescue 0 %>%;"></div>
169               <div class="bar" style="width: <%= j.tasks_summary[:running] * percent_total_tasks rescue 0 %>%; opacity: 0.3"></div>
170             </div>
171             <% else %>
172             <span class="label">queued</span>
173             <% end %>
174           </td>
175         </tr>
176         <% end %>
177       </table>
178       <%= link_to raw("Show more jobs / details &rarr;"), jobs_path, class: 'pull-right' %>
179       <% end %>
180     </div>
181   </div>
182 </div>
183
184 <% elsif current_user %>
185   <%= image_tag "dax.png", style: "float: left; max-width: 25%; margin-right: 2em" %>
186   <h1>Welcome to Arvados, <%= current_user.first_name %>!</h1>
187   <div class="row-fluid">
188     <div class="col span8">
189       <h4>Your account status</h4>
190       <div class="well clearfix">
191         <p><strong>New / inactive</strong></p>
192         <p>
193           Your account must be activated by an Arvados administrator.  If this
194           is your first time accessing Arvados and would like to request
195           access, or you believe you are seeing the page in error, please 
196           <%= link_to "contact us", Rails.configuration.activation_contact_link %>.  
197           You should receive an email at the address you used to log in when
198           your account is activated.  In the mean time, you can 
199           <%= link_to "learn more about Arvados", "https://arvados.org/projects/arvados/wiki/Introduction_to_Arvados" %>,
200           and <%= link_to "read the Arvados user guide", "http://doc.arvados.org/user" %>.
201         </p>
202         <p>
203           <%= link_to raw('Contact us &#x2709;'),
204               Rails.configuration.activation_contact_link, class: "pull-right btn btn-primary" %></p>
205       </div>
206     </div>
207   </div>
208 <% end %>