2760: Merge branch 'master' into 2760-folder-hierarchy
[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         <%# format:'js' here helps browsers avoid using the cached js
37         content in html context (e.g., duplicate tab -> see
38         javascript) %>
39         <%= link_to '(refresh)', {format:'js'}, class: 'refresh hide', remote: true, method: 'get' %>
40       </th><th>
41       </th><th>
42         output
43       </th>
44     </tr>
45   </thead>
46   <tbody>
47     <% render_pipeline_jobs.each do |pj| %>
48     <tr>
49       <td>
50         <% job_status = render(partial: 'job_status_label',
51                                locals: { :j => pj[:job], :title => pj[:name] }) %>
52         <% if pj[:job].andand[:uuid] %>
53           <%= link_to(job_status, job_url(id: pj[:job][:uuid])) %>
54         <% else %>
55           <%= job_status %>
56         <% end %>
57       </td><td>
58         <%= pj[:script] %>
59         <br /><span class="deemphasize"><%= pj[:script_version] %></span>
60       </td><td>
61         <%= pj[:progress_bar] %>
62       </td><td>
63         <%= render(partial: 'job_status_label',
64                                locals: { :j => pj[:job] }) %>
65       </td><td>
66         <%= link_to_if_arvados_object pj[:output], {:thumbnail => true} %>
67       </td>
68     </tr>
69     <% end %>
70   </tbody>
71   <tfoot>
72     <tr><td colspan="5"></td></tr>
73   </tfoot>
74 </table>
75
76 <% if @object.state == 'RunningOnServer' || @object.state == 'RunningOnClient' %>
77 <% content_for :js do %>
78 setInterval(function(){$('a.refresh').click()}, 15000);
79 <% end %>
80
81 <% content_for :tab_line_buttons do %>
82   <%= form_tag @object, :method => :put do |f| %>
83
84     <%= hidden_field @object.class.to_s.underscore.singularize.to_sym, :state, :value => 'Paused' %>
85
86     <%= button_tag({class: 'btn btn-primary pull-right run-pipeline-button'}) do %>
87       Stop <i class="fa fa-fw fa-stop"></i>
88     <% end %>
89   <% end %>
90 <% end %>
91
92 <% end %>
93
94 <% else %>
95   <% if @object.state == 'New' %>
96     <p>Please set the desired input parameters for the components of this pipeline.  Parameters highlighted in red are required.</p>
97   <% end %>
98
99   <% content_for :tab_line_buttons do %>
100     <%= form_tag @object, :method => :put do |f| %>
101
102       <%= hidden_field @object.class.to_s.underscore.singularize.to_sym, :state, :value => 'RunningOnServer' %>
103
104       <%= button_tag({class: 'btn btn-primary pull-right run-pipeline-button'}) do %>
105         Run <i class="fa fa-fw fa-play"></i>
106       <% end %>
107     <% end %>
108   <% end %>
109
110   <% if @object.state.in? ['New', 'Ready'] %>
111     <%= render partial: 'show_components_editable', locals: {editable: true} %>
112   <% else %>
113     <%= render partial: 'show_components_editable', locals: {editable: false} %>
114   <% end %>
115 <% end %>