]> git.arvados.org - arvados.git/blob - apps/workbench/app/views/collections/show.html.erb
Merge branch 'master' of git.clinicalfuture.com:arvados
[arvados.git] / apps / workbench / app / views / collections / show.html.erb
1 <%= content_for :head do %>
2 <style>
3 <%# https://github.com/mbostock/d3/wiki/Ordinal-Scales %>
4 <% n=-1; %w(#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf).each do |color| %>
5 .colorseries-10-<%= n += 1 %>, .btn.colorseries-10-<%= n %>:hover, .label.colorseries-10-<%= n %>:hover {
6   *background-color: <%= color %>;
7   background-color: <%= color %>;
8   background-image: none;
9 }
10 <% end %>
11 .colorseries-nil { }
12 .label a {
13   color: inherit;
14 }
15 </style>
16 <% end %>
17
18 <%#= render :partial => 'nav' %>
19
20 <ul class="nav nav-tabs">
21   <li class="active"><a href="#files" data-toggle="tab">Files (<%= @object.files ? @object.files.size : 0 %>)</a></li>
22   <li><a href="#provenance" data-toggle="tab">Provenance (<%= @provenance.size %>)</a></li>
23   <li><a href="#jobs" data-toggle="tab">Jobs (<%= @provenance.size %>)</a></li>
24   <li><a href="#sourcedata" data-toggle="tab">Source data (<%= @sourcedata.size %>)</a></li>
25   <li><a href="#owner-groups-resources" data-toggle="tab">Owner, groups, resources</a></li>
26 </ul>
27
28 <div class="tab-content">
29   <div id="files" class="tab-pane fade in active">
30     <table class="table table-bordered" style="table-layout: fixed">
31       <thead>
32         <tr>
33           <th>path</th>
34           <th>file</th>
35           <th style="width:1.5em">d/l</th>
36           <th style="width: 7em; text-align:right">size</th>
37         </tr>
38       </thead><tbody>
39         <% if @object then @object.files.sort_by{|f|f[1]}.each do |file| %>
40         <% file_path = "#{file[0]}/#{file[1]}" %>
41         <tr>
42           <td>
43             <%= file[0] %>
44           </td>
45
46           <td>
47             <%= link_to file[1], {controller: 'collections', action: 'show_file', uuid: @object.uuid, file: file_path, size: file[2], disposition: 'inline'}, {title: 'View in browser'} %>
48           </td>
49
50           <td>
51             <div style="display:inline-block">
52             <%= link_to raw('<i class="icon-download"></i>'), {controller: 'collections', action: 'show_file', uuid: @object.uuid, file: file_path, size: file[2], disposition: 'attachment'}, {class: 'label label-info', title: 'Download'} %>
53             </div>
54           </td>
55
56           <td style="text-align:right">
57             <%= raw(human_readable_bytes_html(file[2])) %>
58           </td>
59
60         </tr>
61         <% end; end %>
62       </tbody>
63     </table>
64   </div>
65   <div id="provenance" class="tab-pane fade">
66     <table class="topalign table table-bordered">
67       <thead>
68       </thead>
69       <tbody>
70
71         <% @provenance.reverse.each do |p| %>
72         <% j = p[:job] %>
73
74         <% if j %>
75
76         <tr class="job">
77           <td style="padding-bottom: 3em">
78             <table class="table" style="margin-bottom: 0; background: #f0f0ff">
79               <% j.script_parameters.each do |k,v| %>
80               <tr>
81                 <td style="width: 20%">
82                   <%= k.to_s %>
83                 </td><td style="width: 60%">
84                   <% if v and @output2job.has_key? v %>
85                   <tt class="label colorseries-10-<%= @output2colorindex[v] %>"><%= link_to_if_arvados_object v %></tt>
86                   <% else %>
87                   <span class="deemphasize"><%= link_to_if_arvados_object v %></span>
88                   <% end %>
89                 </td><td style="text-align: center; width: 20%">
90                   <% if v
91                        if @protected[v]
92                          labelclass = 'success'
93                          labeltext = 'keep'
94                        else
95                          labelclass = @output2job.has_key?(v) ? 'warning' : 'danger'
96                          labeltext = 'cache'
97                        end %>
98
99                   <tt class="label label-<%= labelclass %>"><%= labeltext %></tt>
100                   <% end %>
101                 </td>
102               </tr>
103               <% end %>
104             </table>
105             <div style="text-align: center">
106               &darr;
107               <br />
108               <span class="label"><%= j.script %><br /><tt><%= link_to_if j.script_version.match(/[0-9a-f]{40}/), j.script_version, "https://arvados.org/projects/arvados/repository/revisions/#{j.script_version}/entry/crunch_scripts/#{j.script}" if j.script_version %></tt></span>
109               <br />
110               &darr;
111               <br />
112               <tt class="label colorseries-10-<%= @output2colorindex[p[:output]] %>"><%= link_to_if_arvados_object p[:output] %></tt>
113             </div>
114           </td>
115           <td>
116             <tt><span class="deemphasize">job:</span><br /><%= link_to_if_arvados_object j %><br /><span class="deemphasize"><%= j.submit_id %></span></tt>
117           </td>
118         </tr>
119
120         <% else %>
121         <tr>
122           <td>
123             <span class="label label-danger">lookup fail</span>
124             <br />
125             <tt class="deemphasize"><%= p[:target] %></tt>
126           </td><td colspan="5">
127           </td>
128         </tr>
129         <% end %>
130
131         <% end %>
132
133       </tbody>
134     </table>
135   </div>
136   <div id="jobs" class="tab-pane fade">
137     <table class="topalign table table-bordered">
138       <thead>
139         <tr class="contain-align-left">
140           <th>
141             job
142           </th><th>
143             version
144           </th><th>
145             status
146           </th><th>
147             start
148           </th><th>
149             finish
150           </th><th>
151             clock time
152           </th>
153         </tr>
154       </thead>
155       <tbody>
156
157         <% @provenance.reverse.each do |p| %>
158         <% j = p[:job] %>
159
160         <% if j %>
161
162         <tr class="job">
163           <td>
164             <tt><%= j.uuid %></tt>
165             <br />
166             <tt class="deemphasize"><%= j.submit_id %></tt>
167           </td><td>
168             <%= j.script_version %>
169           </td><td>
170             <span class="label <%= if j.success then 'label-success'; elsif j.active then 'label-primary'; else 'label-warning'; end %>">
171               <%= j.success || j.active ? 'ok' : 'failed' %>
172             </span>
173           </td><td>
174             <%= j.started_at %>
175           </td><td>
176             <%= j.finished_at %>
177           </td><td>
178             <% if j.started_at and j.finished_at %>
179             <%= raw(distance_of_time_in_words(j.started_at, j.finished_at).sub('about ','~').sub(' ','&nbsp;')) %>
180             <% elsif j.started_at and j.running %>
181             <%= raw(distance_of_time_in_words(j.started_at, Time.now).sub('about ','~').sub(' ','&nbsp;')) %> (running)
182             <% end %>
183           </td>
184         </tr>
185
186         <% else %>
187         <tr>
188           <td>
189             <span class="label label-danger">lookup fail</span>
190             <br />
191             <tt class="deemphasize"><%= p[:target] %></tt>
192           </td><td colspan="4">
193           </td>
194         </tr>
195         <% end %>
196
197         <% end %>
198
199       </tbody>
200     </table>
201   </div>
202   <div id="sourcedata" class="tab-pane fade">
203     <table class="table table-bordered table-striped">
204       <thead>
205         <tr class="contain-align-left">
206           <th>
207             collection
208           </th><th class="data-size">
209             data size
210           </th><th>
211             storage
212           </th><th>
213             origin
214           </th>
215         </tr>
216       </thead>
217       <tbody>
218
219         <% @sourcedata.values.each do |sourcedata| %>
220
221         <tr class="collection">
222           <td>
223             <tt class="label"><%= sourcedata[:uuid] %></tt>
224           </td><td class="data-size">
225             <%= raw(human_readable_bytes_html(sourcedata[:collection].data_size)) if sourcedata[:collection] and sourcedata[:collection].data_size %>
226           </td><td>
227             <% if @protected[sourcedata[:uuid]] %>
228             <span class="label label-success">keep</span>
229             <% else %>
230             <span class="label label-danger">cache</span>
231             <% end %>
232           </td><td>
233             <% if sourcedata[:data_origins] %>
234             <% sourcedata[:data_origins].each do |data_origin| %>
235             <span class="deemphasize"><%= data_origin[0] %></span>
236             <%= data_origin[2] %>
237             <br />
238             <% end %>
239             <% end %>
240           </td>
241         </tr>
242
243         <% end %>
244
245       </tbody>
246     </table>
247   </div>
248   <div id="owner-groups-resources" class="tab-pane fade">
249     <%= render :partial => 'application/arvados_object' %>
250   </div>
251 </div>