Merge branch '2107-update-documentation'
[arvados.git] / apps / workbench / app / views / collections / _show_provenance.html.erb
1 <%= content_for :css do %>
2 <%# https://github.com/mbostock/d3/wiki/Ordinal-Scales %>
3 <% n=-1; %w(#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf).each do |color| %>
4 .colorseries-10-<%= n += 1 %>, .btn.colorseries-10-<%= n %>:hover, .label.colorseries-10-<%= n %>:hover {
5   *background-color: <%= color %>;
6   background-color: <%= color %>;
7   background-image: none;
8 }
9 <% end %>
10 .colorseries-nil { }
11 .label a {
12   color: inherit;
13 }
14 <% end %>
15
16 <table class="topalign table table-bordered">
17   <thead>
18   </thead>
19   <tbody>
20
21     <% @provenance.reverse.each do |p| %>
22     <% j = p[:job] %>
23
24     <% if j %>
25
26     <tr class="job">
27       <td style="padding-bottom: 3em">
28         <table class="table" style="margin-bottom: 0; background: #f0f0ff">
29           <% j.script_parameters.each do |k,v| %>
30           <tr>
31             <td style="width: 20%">
32               <%= k.to_s %>
33             </td><td style="width: 60%">
34               <% if v and @output2job.has_key? v %>
35               <tt class="label colorseries-10-<%= @output2colorindex[v] %>"><%= link_to_if_arvados_object v %></tt>
36               <% else %>
37               <span class="deemphasize"><%= link_to_if_arvados_object v %></span>
38               <% end %>
39             </td><td style="text-align: center; width: 20%">
40               <% if v
41                  if @protected[v]
42                  labelclass = 'success'
43                  labeltext = 'keep'
44                  else
45                  labelclass = @output2job.has_key?(v) ? 'warning' : 'danger'
46                  labeltext = 'cache'
47                  end %>
48
49               <tt class="label label-<%= labelclass %>"><%= labeltext %></tt>
50               <% end %>
51             </td>
52           </tr>
53           <% end %>
54         </table>
55         <div style="text-align: center">
56           &darr;
57           <br />
58           <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>
59           <br />
60           &darr;
61           <br />
62           <tt class="label colorseries-10-<%= @output2colorindex[p[:output]] %>"><%= link_to_if_arvados_object p[:output] %></tt>
63         </div>
64       </td>
65       <td>
66         <tt><span class="deemphasize">job:</span><br /><%= link_to_if_arvados_object j %><br /><span class="deemphasize"><%= j.submit_id %></span></tt>
67       </td>
68     </tr>
69
70     <% else %>
71     <tr>
72       <td>
73         <span class="label label-danger">lookup fail</span>
74         <br />
75         <tt class="deemphasize"><%= p[:target] %></tt>
76       </td><td colspan="5">
77       </td>
78     </tr>
79     <% end %>
80
81     <% end %>
82
83   </tbody>
84 </table>