Merge branch 'master' into 2871-preload-objects
[arvados.git] / apps / workbench / app / views / application / _show_metadata.html.erb
1 <% outgoing = Link.where(tail_uuid: @object.uuid) %>
2 <% incoming = Link.where(head_uuid: @object.uuid) %>
3
4 <%
5   preload_uuids = []
6   preload_head_uuids = []
7   outgoing.results.each do |link|
8     preload_uuids << link.uuid
9     preload_head_uuids << link.head_uuid
10   end
11   preload_uuids << preload_head_uuids
12   preload_collections_for_objects preload_uuids
13   preload_links_for_objects preload_head_uuids
14 %>
15
16 <h3>Metadata about this object</h3>
17 <% if outgoing.items_available > 0 %>
18 <table class="table topalign">
19   <thead>
20     <tr>
21       <th>metadata uuid</th>
22       <th>class</th>
23       <th>name</th>
24       <th>properties</th>
25       <th>object</th>
26     </tr>
27   </thead>
28   <tbody>
29     <% outgoing.each do |link| %>
30       <tr>
31         <td><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "uuid", attrvalue: link.uuid } %></td>
32         <td><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "link_class", attrvalue: link.link_class } %></td>
33         <td><%= render_editable_attribute link, 'name' %></td>
34         <td><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "properties", attrvalue: link.properties } %></td>
35         <td><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "head_uuid", attrvalue: link.head_uuid } %></td>
36       </tr>
37     <% end %>
38   </tbody>
39 </table>
40 <% else %>
41 No metadata.
42 <% end %>
43
44 <h3>Metadata that refers to this object</h3>
45 <% if incoming.items_available > 0 %>
46 <table class="table topalign">
47   <thead>
48     <tr>
49       <th>metadata uuid</th>
50       <th>subject</th>
51       <th>class</th>
52       <th>name</th>
53       <th>properties</th>
54     </tr>
55   </thead>
56   <tbody>
57     <% incoming.each do |link| %>
58       <tr>
59         <td><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "uuid", attrvalue: link.uuid } %></td>
60         <td><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "tail_uuid", attrvalue: link.tail_uuid } %></td>
61         <td><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "link_class", attrvalue: link.link_class } %></td>
62         <td><%= render_editable_attribute link, 'name' %></td>
63         <td><%= render partial: 'application/arvados_attr_value', locals: { obj: link, attr: "properties", attrvalue: link.properties } %></td>
64       </tr>
65     <% end %>
66   </tbody>
67 </table>
68 <% else %>
69 No metadata.
70 <% end %>