Merge branch '1678-new-user-orientation-pete-wfh' of git.clinicalfuture.com:arvados...
[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
78 <% end %>
79
80 <div class="row-fluid">
81   <div class="col span12">
82     <div class="clearfix">
83       <h4>Account summary</h4>
84       <div class="well clearfix">
85         <% [Human, Trait, Collection, 'File', PipelineTemplate, PipelineInstance].each do |aclass| %>
86         <div class="col span2 centerme">
87           <span class="bigfatnumber">
88             <% if aclass == 'File' %>
89             <%= Collection.limit(4000).where({}).collect(&:files).flatten(1).count %>
90             <% else %>
91             <%= aclass.limit(4000).where({}).count %>
92             <% end %>
93           </span>
94           <br />
95           <%= raw(aclass.to_s.pluralize.underscore.gsub '_', '&nbsp;') %>
96         </div>
97         <% end %>
98       </div>
99     </div>
100   </div>
101 </div>
102
103 <div class="row-fluid">
104   <div class="col span3">
105     <div class="clearfix">
106       <h4>Configuration</h4>
107       <div class="well dash-list">
108         <ul class="nav nav-list">
109           <li class="clearfix">
110             <a href="<%= authorized_keys_path %>">
111               <span class="pull-left"><%= raw '&#x2714;' if @my_ssh_keys.any? %>&nbsp;</span>
112               SSH keys
113               <span class="pull-right"><%= @my_ssh_keys.count %></span>
114             </a>
115           </li>
116           <li class="clearfix">
117             <a href="<%= virtual_machines_path %>">
118               <span class="pull-left"><%= raw '&#x2714;' if @my_vm_perms.any? %>&nbsp;</span>
119               Virtual machines
120               <span class="pull-right"><%= @my_vm_perms.collect(&:head_uuid).uniq.count %></span>
121             </a>
122           </li>
123           <li class="clearfix">
124             <a href="<%= repositories_path %>">
125               <span class="pull-left"><%= raw '&#x2714;' if @my_repo_perms.any? %>&nbsp;</span>
126               Repositories
127               <span class="pull-right"><%= @my_repo_perms.collect(&:head_uuid).uniq.count %></span>
128             </a>
129           </li>
130         </ul>
131       </div>
132     </div>
133   </div>
134   <div class="col span4">
135     <%= render partial: 'quick_links' %>
136   </div>
137   <div class="col span5">
138     <div class="clearfix">
139       <h4>Recent jobs</h4>
140       <% if not current_user.andand.is_active or @my_jobs.empty? %>
141       (None)
142       <% else %>
143       <table class="table table-bordered table-condensed job-table">
144         <% @my_jobs[0..8].each do |j| %>
145         <tr>
146           <td>
147             <small>
148               <%= link_to j.script[0..31], job_path(j.uuid) %>
149             </small>
150           </td>
151           <td>
152             <small>
153               <%= j.script_version[0..7] %>
154             </small>
155           </td>
156           <td>
157             <small>
158               <%= j.script_parameters.andand[:input].andand.to_s.andand[0..7] %>
159             </small>
160           </td>
161           <td>
162             <% if j.success %>
163             <span class="label label-success">finished</span>
164             <% elsif j.success == false %>
165             <span class="label label-danger">failed</span>
166             <% elsif j.running and j.started_at and not j.finished_at %>
167             <% percent_total_tasks = 100 / (j.tasks_summary[:running] + j.tasks_summary[:done] + j.tasks_summary[:todo]) rescue 0 %>
168             <div class="progress" style="margin-bottom: 0">
169               <div class="bar bar-success" style="width: <%= j.tasks_summary[:done] * percent_total_tasks rescue 0 %>%;"></div>
170               <div class="bar" style="width: <%= j.tasks_summary[:running] * percent_total_tasks rescue 0 %>%; opacity: 0.3"></div>
171             </div>
172             <% else %>
173             <span class="label">queued</span>
174             <% end %>
175           </td>
176         </tr>
177         <% end %>
178       </table>
179       <%= link_to raw("Show more jobs / details &rarr;"), jobs_path, class: 'pull-right' %>
180       <% end %>
181     </div>
182   </div>
183 </div>
184
185 <% elsif current_user %>
186   <%= image_tag "dax.png", style: "float: left; max-width: 25%; margin-right: 2em" %>
187   <h1>Welcome to Arvados, <%= current_user.first_name %>!</h1>
188   <div class="row-fluid">
189     <div class="col span8">
190       <h4>Your account status</h4>
191       <div class="well clearfix">
192         <p><strong>New / inactive</strong></p>
193         <p>
194           Your account must be activated by an Arvados administrator.  If this
195           is your first time accessing Arvados and would like to request
196           access, or you believe you are seeing the page in error, please 
197           <%= link_to "contact us", Rails.configuration.activation_contact_link %>.  
198           You should receive an email at the address you used to log in when
199           your account is activated.  In the mean time, you can 
200           <%= link_to "learn more about Arvados", "https://arvados.org/projects/arvados/wiki/Introduction_to_Arvados" %>,
201           and <%= link_to "read the Arvados user guide", "http://doc.arvados.org/user" %>.
202         </p>
203         <p>
204           <%= link_to raw('Contact us &#x2709;'),
205               Rails.configuration.activation_contact_link, class: "pull-right btn btn-primary" %></p>
206       </div>
207     </div>
208   </div>
209 <% end %>