3235: Merge branch 'master' into 3235-top-nav-site-search
[arvados.git] / apps / workbench / app / views / pipeline_instances / _show_components.html.erb
1 <% if !@object.state.in? ['New', 'Ready'] %>
2
3   <% pipeline_job_uuids = [] %>
4
5   <div class="pull-right">
6     Current state: <span class="badge badge-info" data-pipeline-state="<%= @object.state %>"><%= @object.state.sub('OnServer', '') %></span>&nbsp;
7   </div>
8
9   <table class="table pipeline-components-table">
10     <colgroup>
11       <col style="width: 15%" />
12       <col style="width: 25%" />
13       <col style="width: 8%" />
14       <col style="width: 13%" />
15       <col style="width: 12%" />
16       <col style="width: 14%" />
17       <col style="width: 13%" />
18     </colgroup>
19     <thead>
20       <tr>
21         <th colspan="2">
22           component
23         </th><th colspan="5">
24           job
25           <%# format:'js' here helps browsers avoid using the cached js
26           content in html context (e.g., duplicate tab -> see
27           javascript) %>
28           <%= link_to '(refresh)', {format: :js}, {class: 'refresh hide', remote: true, method: 'get'} %>
29         </th>
30       </tr>
31     </thead>
32     <tbody>
33       <% render_pipeline_jobs.each do |pj| %>
34         <% if pj[:job].andand[:uuid]
35              pipeline_job_uuids << pj[:job][:uuid]
36            end %>
37       <tr>
38         <td>
39           <%= pj[:name] %>
40         </td><td>
41           <%= pj[:script] %>
42           <br /><span class="deemphasize"><%= pj[:script_version] %></span>
43         </td><td>
44           <%= render(partial: 'job_status_label', locals: { j: pj[:job] }) %>
45         </td><td>
46           <%= pj[:progress_bar] %>
47         </td>
48         <% current_job = Job.find(pj[:job][:uuid]) rescue nil %>
49         <td>
50           <% if current_job %>
51             <%= render partial: 'show_object_button', locals: {object: current_job, size: 'xs', link_text: 'Show job details'} %>
52           <% end %>
53         </td><td>
54           <% if current_job.andand[:log] %>
55             <% fixup = /([a-f0-9]{32}\+\d+)(\+?.*)/.match(current_job[:log])%>
56             <% Collection.limit(1).where(uuid: fixup[1]).each do |c| %>
57               <% c.files.first.andand do |file| %>
58                 <%= link_to url_for(controller: 'collections', action: 'show_file', uuid: current_job[:log], file: "#{file[0]}/#{file[1]}", disposition: 'inline', size: file[2]), class: 'btn btn-default btn-xs' do %>
59                   <i class="fa fa-fw fa-info"></i> Show log messages
60                 <% end %>
61               <% end %>
62             <% end %>
63           <% end %>
64         </td><td>
65           <% if current_job.andand[:output] %>
66             <%= link_to_if_arvados_object current_job[:output], {thumbnail: true, link_text: raw('<i class="fa fa-fw fa-archive"></i> Show output files')}, {class: 'btn btn-default btn-xs'} %>
67           <% end %>
68         </td>
69       </tr>
70       <% end %>
71     </tbody>
72     <tfoot>
73       <tr><td colspan="7"></td></tr>
74     </tfoot>
75   </table>
76
77   <% if @object.state.in? %w(RunningOnServer RunningOnClient Failed) %>
78
79       <h4>Log messages from jobs</h4>
80       <% log_history = pipeline_log_history((pipeline_job_uuids || []) + [@object.uuid]) %>
81       <div class="arv-log-event-listener arv-log-event-handler-append-logs arv-job-log-window" id="pipeline_event_log_div" data-object-uuids="<%= @object.uuid %> <%=(pipeline_job_uuids || []).join(" ")%>">
82         <% log_history.each do |entry| %>
83           <%=entry%><br/>
84         <% end %>
85       </div>
86
87   <% end %>
88
89 <% else %>
90   <%# state is either New or Ready %>
91
92   <% if @object.state.in? %w(New Ready) %>
93     <p><i>Here are all of the pipeline's components (jobs that will need to run in order to complete the pipeline). If you know what you're doing (or you're experimenting) you can modify these parameters before starting the pipeline. Usually, you only need to edit the settings presented on the "Inputs" tab above.</i></p>
94   <% end %>
95
96   <% if @object.state.in? ['New', 'Ready'] %>
97     <%= render partial: 'show_components_editable', locals: {editable: true} %>
98   <% else %>
99     <%= render partial: 'show_components_editable', locals: {editable: false} %>
100   <% end %>
101 <% end %>