9767: need to parse the json string of the workflow yaml
[arvados.git] / apps / workbench / app / views / work_units / _component_detail.html.erb
1       <div class="container">
2         <div class="row">
3           <div class="col-md-5">
4             <% if current_obj.uuid.nil? %>
5               No <%= current_obj.title %> has been submitted yet.
6             <% else %>
7             <table>
8               <% keys = [:uuid, :modified_by_user_uuid, :created_at, :started_at, :finished_at, :container_uuid, :priority] %>
9               <% keys << :outputs if @object.uuid == current_obj.uuid %>
10               <% keys.each do |k| %>
11                 <% val = current_obj.send(k) if current_obj.respond_to?(k) %>
12                 <% has_val = val %>
13                 <% has_val = val.andand.any? if k == :outputs %>
14                 <% if has_val %>
15                 <tr>
16                   <td style="padding-right: 1em">
17                     <%= k.to_s %>:
18                   </td>
19                   <td>
20                     <% if k == :uuid %>
21                       <%= link_to_arvados_object_if_readable(val, val, link_text: val) %>
22                     <% elsif k.to_s.end_with? 'uuid' %>
23                       <%= link_to_arvados_object_if_readable(val, val, friendly_name: true) %>
24                     <% elsif k.to_s.end_with? '_at' %>
25                       <%= render_localized_date(val) %>
26                     <% elsif k == :outputs and val.any? %>
27                       <% if val.size == 1 %>
28                         <%= link_to_arvados_object_if_readable(val[0], 'Output data not available', friendly_name: true) %>
29                       <% else %>
30                         <%= render partial: 'work_units/show_outputs', locals: {id: current_obj.uuid, outputs: val, align:""} %>
31                       <% end %>
32                     <% else %>
33                       <%= val %>
34                     <% end %>
35                   </td>
36                 </tr>
37                 <% end %>
38               <% end %>
39             </table>
40             <% end %>
41           </div>
42           <div class="col-md-6">
43             <table>
44               <% # link to repo tree/file only if the repo is readable
45                  # and the commit is a sha1...
46                  repo =
47                  (/^[0-9a-f]{40}$/ =~ current_obj.script_version and
48                  Repository.where(name: current_obj.repository).first)
49
50                  # ...and the api server provides an http:// or https:// url
51                  repo = nil unless repo.andand.http_fetch_url
52                  %>
53               <% [:script, :repository, :script_version, :supplied_script_version, :nondeterministic,
54                   :command, :cwd, :environment, :mounts, :output_path].each do |k| %>
55                 <% val = current_obj.send(k) if current_obj.respond_to?(k) %>
56                 <% if val %>
57                 <tr>
58                   <td style="padding-right: 1em">
59                     <%= k.to_s %>:
60                   </td>
61                   <td>
62                     <% if repo and k == :repository %>
63                       <%= link_to val, show_repository_tree_path(id: repo.uuid, commit: current_obj.script_version, path: '/') %>
64                     <% elsif repo and k == :script %>
65                       <%= link_to val, show_repository_blob_path(id: repo.uuid, commit: current_obj.script_version, path: 'crunch_scripts/'+current_obj.script) %>
66                     <% elsif repo and k == :script_version %>
67                       <%= link_to val, show_repository_commit_path(id: repo.uuid, commit: current_obj.script_version) %>
68                     <% else %>
69                       <%= val %>
70                     <% end %>
71                   </td>
72                 </tr>
73                 <% end %>
74               <% end %>
75               <% if current_obj.runtime_constraints.andand[:docker_image] and current_obj.docker_image %>
76                 <tr>
77                   <td style="padding-right: 1em">
78                     docker_image:
79                   </td>
80                   <td>
81                     <%= current_obj.runtime_constraints[:docker_image] %>
82                   </td>
83                 </tr>
84                 <tr>
85                   <td style="padding-right: 1em">
86                     docker_image_locator:
87                   </td>
88                   <td>
89                     <%= link_to_arvados_object_if_readable(current_obj.docker_image,
90                       current_obj.docker_image, friendly_name: true) %>
91                   </td>
92                 </tr>
93               <% elsif current_obj.docker_image %>
94                 <tr>
95                   <td style="padding-right: 1em">
96                     docker_image_locator:
97                   </td>
98                   <td>
99                     <%= link_to_arvados_object_if_readable(current_obj.docker_image,
100                       current_obj.docker_image, friendly_name: true) %>
101                   </td>
102                 </tr>
103               <% end %>
104             </table>
105           </div>
106         </div>
107
108         <% if current_obj.parameters and !current_obj.parameters.empty? %>
109         <div class="row">
110           <div class="col-md-6">
111             <p>script_parameters:</p>
112             <pre><%= JSON.pretty_generate(current_obj.parameters) rescue nil %></pre>
113           </div>
114         </div>
115         <% end %>
116       </div>