2756: store websocket in window to facilitate reuse within page. also, remove element...
[arvados.git] / apps / workbench / app / views / pipeline_instances / _show_components.html.erb
1 <% content_for :css do %>
2
3 <% end %>
4
5 <% template = PipelineTemplate.find(@object.pipeline_template_uuid) rescue nil %>
6
7 <%= content_for :content_top do %>
8   <h2>
9     <%= render_editable_attribute @object, 'name', nil, { 'data-emptytext' => 'Unnamed pipeline' } %>
10   </h2>
11   <% if template %>
12   <h4>
13     From template:
14     <%= link_to_if_arvados_object template, friendly_name: true %>
15   </h4>
16   <% end %>
17 <% end %>
18
19 <% if !@object.state.in? ['New', 'Ready', 'Paused'] %>
20 <table class="table pipeline-components-table">
21   <colgroup>
22     <col style="width: 15%" />
23     <col style="width: 20%" />
24     <col style="width: 12%" />
25     <col style="width: 12%" />
26     <col style="width: 45%" />
27   </colgroup>
28   <thead>
29     <tr>
30       <th>
31         component
32       </th><th>
33         script, version
34       </th><th>
35         progress
36         <%= link_to '(refresh)', request.fullpath, class: 'refresh hide', remote: true, method: 'get' %>
37       </th><th>
38       </th><th>
39         output
40       </th>
41     </tr>
42   </thead>
43   <tbody>
44     <% render_pipeline_jobs.each do |pj| %>
45     <tr>
46       <td>
47         <% job_status = render(partial: 'job_status_label',
48                                locals: { :j => pj[:job], :title => pj[:name] }) %>
49         <% if pj[:job].andand[:uuid] %>
50           <%= link_to(job_status, job_url(id: pj[:job][:uuid])) %>
51         <% else %>
52           <%= job_status %>
53         <% end %>
54       </td><td>
55         <%= pj[:script] %>
56         <br /><span class="deemphasize"><%= pj[:script_version] %></span>
57       </td><td>
58         <%= pj[:progress_bar] %>
59       </td><td>
60         <%= render(partial: 'job_status_label',
61                                locals: { :j => pj[:job] }) %>
62       </td><td>
63         <%= link_to_if_arvados_object pj[:output], {:thumbnail => true} %>
64       </td>
65     </tr>
66     <% end %>
67   </tbody>
68   <tfoot>
69     <tr><td colspan="5"></td></tr>
70   </tfoot>
71 </table>
72
73 <% if @object.state == 'RunningOnServer' || @object.state == 'RunningOnClient' %>
74 <% content_for :js do %>
75 setInterval(function(){$('a.refresh').click()}, 15000);
76 <% end %>
77
78 <% content_for :tab_line_buttons do %>
79   <%= form_tag @object, :method => :put do |f| %>
80
81     <%= hidden_field @object.class.to_s.underscore.singularize.to_sym, :state, :value => 'Paused' %>
82
83     <%= button_tag "Stop pipeline", {class: 'btn btn-primary pull-right', id: "run-pipeline-button"} %>
84   <% end %>
85 <% end %>
86
87 <% end %>
88
89 <% else %>
90   <% if @object.state == 'New' %>
91     <p>Please set the desired input parameters for the components of this pipeline.  Parameters highlighted in red are required.</p>
92   <% end %>
93
94   <% content_for :tab_line_buttons do %>
95     <%= form_tag @object, :method => :put do |f| %>
96
97       <%= hidden_field @object.class.to_s.underscore.singularize.to_sym, :state, :value => 'RunningOnServer' %>
98
99       <%= button_tag "Run pipeline", {class: 'btn btn-primary pull-right', id: "run-pipeline-button"} %>
100     <% end %>
101   <% end %>
102
103   <% if @object.state.in? ['New', 'Ready'] %>
104     <%= render partial: 'show_components_editable', locals: {editable: true} %>
105   <% else %>
106     <%= render partial: 'show_components_editable', locals: {editable: false} %>
107   <% end %>
108 <% end %>
109
110 <%= render partial: 'show_event_log', locals: {object: @object} %>