Merge branch 'master' into 2257-inequality-conditions
[arvados.git] / apps / workbench / app / views / users / _tables.html.erb
1 <% if current_user.andand.is_active %>
2   <div>
3     <strong>Recent jobs</strong>
4     <%= link_to '(refresh)', request.fullpath, class: 'refresh', remote: true, method: 'get' %>
5     <%= link_to raw("Show all jobs &rarr;"), jobs_path, class: 'pull-right' %>
6     <% if not current_user.andand.is_active or @my_jobs.empty? %>
7       <p>(None)</p>
8     <% else %>
9       <table class="table table-bordered table-condensed table-fixedlayout">
10         <colgroup>
11           <col width="20%" />
12           <col width="20%" />
13           <col width="20%" />
14           <col width="13%" />
15           <col width="13%" />
16           <col width="20%" />
17         </colgroup>
18
19         <tr>
20           <th>Script</th>
21           <th>Output</th>
22           <th>Log</th>
23           <th>Age</th>
24           <th>Status</th>
25           <th>Progress</th>
26         </tr>
27
28         <% @my_jobs[0..6].each do |j| %>
29           <tr>
30             <td>
31               <small>
32                 <%= link_to((j.script.andand[0..31] || j.uuid), job_path(j.uuid)) %>
33               </small>
34             </td>
35
36             <td>
37               <small>
38                 <% if j.success %>
39
40                   <a href="<%= collection_path(j.output) %>">
41                     <% Collection.limit(1).where(uuid: j.output).each do |c| %>
42                          <% c.files.each do |file| %>
43                       <%= file[0] == '.' ? file[1] : "#{file[0]}/#{file[1]}" %>
44                     <% end %>
45                 <% end %>
46                 </a>
47
48         <% end %>
49         </small>
50 </td>
51
52 <td>
53   <small>
54     <% if j.log %>
55       <% fixup = /([a-f0-9]{32}\+\d+)(\+?.*)/.match(j.log)%>
56       <% Collection.limit(1).where(uuid: fixup[1]).each do |c| %>
57         <% c.files.each do |file| %>
58           <a href="<%= collection_path(j.log) %>/<%= file[1] %>?disposition=inline&size=<%= file[2] %>">Log</a>
59         <% end %>
60       <% end %>
61     <% elsif j.respond_to? :log_buffer and j.log_buffer %>
62       <% buf = j.log_buffer.strip.split("\n").last %>
63       <span title="<%= buf %>"><%= buf %></span>
64     <% end %>
65   </small>
66 </td>
67
68 <td>
69   <small>
70     <%= raw(distance_of_time_in_words(j.created_at, Time.now).sub('about
71 ','~').sub(' ','&nbsp;')) if j.created_at %>
72   </small>
73 </td>
74
75 <td>
76   <%= render partial: 'job_status_label', locals: {:j => j} %>
77 </td>
78 <td>
79   <div class="inline-progress-container">
80   <%= render partial: 'job_progress', locals: {:j => j} %>
81   </div>
82 </td>
83
84 </tr>
85 <% end %>
86 </table>
87 <% end %>
88 </div>
89
90 <div>
91   <strong>Recent pipeline instances</strong>
92   <%= link_to '(refresh)', request.fullpath, class: 'refresh', remote: true, method: 'get' %>
93   <%= link_to raw("Show all pipeline instances &rarr;"), pipeline_instances_path, class: 'pull-right' %>
94   <% if not current_user.andand.is_active or @my_pipelines.empty? %>
95     <p>(None)</p>
96   <% else %>
97     <table class="table table-bordered table-condensed table-fixedlayout">
98       <colgroup>
99         <col width="30%" />
100         <col width="30%" />
101         <col width="13%" />
102         <col width="13%" />
103         <col width="20%" />
104       </colgroup>
105
106       <tr>
107         <th>Instance</th>
108         <th>Template</th>
109         <th>Age</th>
110         <th>Status</th>
111         <th>Progress</th>
112       </tr>
113
114       <% @my_pipelines[0..6].each do |p| %>
115         <tr>
116           <td>
117             <small>
118               <%= link_to_if_arvados_object p.uuid, friendly_name: true %>
119             </small>
120           </td>
121
122           <td>
123             <small>
124               <%= link_to_if_arvados_object p.pipeline_template_uuid, friendly_name: true %>
125             </small>
126           </td>
127
128           <td>
129             <small>
130               <%= raw(distance_of_time_in_words(p.created_at, Time.now).sub('about
131 ','~').sub(' ','&nbsp;')) if p.created_at %>
132             </small>
133           </td>
134
135           <td>
136             <%= render partial: 'pipeline_status_label', locals: {:p => p} %>
137           </td>
138
139           <td>
140             <div class="inline-progress-container">
141               <%= render partial: 'pipeline_progress', locals: {:p => p} %>
142             </div>
143           </td>
144         </tr>
145       <% end %>
146     </table>
147   <% end %>
148 </div>
149
150 <div>
151   <strong>Recent collections</strong>
152   <%= link_to '(refresh)', request.fullpath, class: 'refresh', remote: true, method: 'get' %>
153   <%= link_to raw("Show all collections &rarr;"), collections_path, class: 'pull-right' %>
154   <div class="pull-right" style="padding-right: 1em; width: 30%;">
155     <%= form_tag collections_path,
156           method: 'get',
157           class: 'form-search small-form-margin' do %>
158     <div class="input-group input-group-sm">
159       <%= text_field_tag :search, params[:search], class: 'form-control', placeholder: 'Search' %>
160       <span class="input-group-btn">
161         <%= button_tag(class: 'btn btn-info') do %>
162         <span class="glyphicon glyphicon-search"></span>
163         <% end %>
164       </span>
165     </div>  
166     <% end %>
167   </div>
168   <% if not current_user.andand.is_active or @my_collections.empty? %>
169     <p>(None)</p>
170   <% else %>
171     <table class="table table-bordered table-condensed table-fixedlayout">
172       <colgroup>
173         <col width="46%" />
174         <col width="27%" />
175         <col width="27%" />
176       </colgroup>
177
178       <tr>
179         <th>Contents</th>
180         <th>Tags</th>
181         <th>Age</th>
182       </tr>
183
184       <% @my_collections[0..6].each do |c| %>
185         <tr>
186           <td>
187             <small>
188               <a href="<%= collection_path(c.uuid) %>">
189                 <% c.files.each do |file| %>
190                   <%= file[0] == '.' ? file[1] : "#{file[0]}/#{file[1]}" %>
191                 <% end %>
192               </a>
193             </small>
194           </td>
195           <td>
196             <% if @my_tag_links[c.uuid] %>
197             <small>
198               <%= @my_tag_links[c.uuid].collect(&:name).join(", ") %>
199             </small>
200             <% end %>
201           </td>
202           <td>
203             <small>
204               <%= raw(distance_of_time_in_words(c.created_at, Time.now).sub('about
205 ','~').sub(' ','&nbsp;')) if c.created_at %>
206             </small>
207           </td>
208         </tr>
209       <% end %>
210     </table>
211   <% end %>
212 </div>
213
214 <% else %>
215
216   <div class="row-fluid">
217     <div class="col-sm-4">
218       <%= image_tag "dax.png", style: "max-width:100%" %>
219     </div>
220     <div class="col-sm-8">
221       <h2>Welcome to Arvados, <%= current_user.first_name %>!</h2>
222       <div class="well">
223         <p>
224           Your account must be activated by an Arvados administrator.  If this
225           is your first time accessing Arvados and would like to request
226           access, or you believe you are seeing the page in error, please 
227           <%= link_to "contact us", Rails.configuration.activation_contact_link %>.  
228           You should receive an email at the address you used to log in when
229           your account is activated.  In the mean time, you can 
230           <%= link_to "learn more about Arvados", "https://arvados.org/projects/arvados/wiki/Introduction_to_Arvados" %>,
231           and <%= link_to "read the Arvados user guide", "http://doc.arvados.org/user" %>.
232         </p>
233         <p style="padding-bottom: 1em">
234           <%= link_to raw('Contact us &#x2709;'),
235               Rails.configuration.activation_contact_link, class: "pull-right btn btn-primary" %></p>
236       </div>
237     </div>
238   </div>
239 <% end %>
240
241 <% content_for :js do %>
242 setInterval(function(){$('a.refresh:eq(0)').click()}, 60000);
243 <% end %>