Merge remote-tracking branch 'origin/master' into 2042-new-collection-from-selected...
[arvados.git] / apps / workbench / app / views / pipeline_instances / _show_components.html.erb
1 <% content_for :css do %>
2   .pipeline_color_legend {
3     padding-left: 1em;
4     padding-right: 1em;
5   }
6 table.pipeline-components-table {
7   width: 100%;
8   table-layout: fixed;
9   overflow: hidden;
10 }
11
12 table.pipeline-components-table thead th {
13   text-align: bottom;
14 }
15 table.pipeline-components-table div.progress {
16   margin-bottom: 0;
17 }
18
19 table.pipeline-components-table td {
20   overflow: hidden;
21   text-overflow: ellipsis;
22 }
23
24 td.required {
25   background: #ffdddd;
26 }
27
28 <% end %>
29
30 <% template = PipelineTemplate.find(@object.pipeline_template_uuid) %>
31 <% if template %>
32   <h2><%= template.name %></h2>
33 <% end %>
34
35 <% if @object.active != nil %>
36 <table class="table pipeline-components-table">
37   <colgroup>
38     <col style="width: 15%" />
39     <col style="width: 20%" />
40     <col style="width: 12%" />
41     <col style="width: 8%" />
42     <col style="width: 45%" />
43   </colgroup>
44   <thead>
45     <tr>
46       <th>
47         component
48       </th><th>
49         script, version
50       </th><th>
51         progress
52         <%= link_to '(refresh)', request.fullpath, class: 'refresh', remote: true, method: 'get' %>
53       </th><th>
54       </th><th>
55         output
56       </th>
57     </tr>
58   </thead>
59   <tbody>
60     <% render_pipeline_jobs.each do |pj| %>
61     <tr>
62       <td>
63         <% label = if pj[:job].andand[:uuid] 
64              if pj[:job][:success] == true
65                'label-success'
66              elsif pj[:job][:success] == false
67                'label-danger'
68              elsif pj[:job][:running] == true
69                'label-info'
70              else
71                'label-default'
72              end
73            else
74              'label-default'
75          end %>
76         <% if pj[:job].andand[:uuid] %>
77         <%= link_to pj[:name], job_url(id: pj[:job][:uuid]), class: "label #{label}" %>
78         <% else %>
79           <span class="label <%= label %>"><%= pj[:name] %></span>
80         <% end %>
81
82       </td><td>
83         <%= pj[:script] %>
84         <br /><span class="deemphasize"><%= pj[:script_version] %></span>
85       </td><td>
86         <%= pj[:progress_bar] %>
87       </td><td>
88         <% if pj[:job].andand[:cancelled_at] %>
89         <span class="label label-warning">cancelled</span>
90         <% elsif pj[:failed] %>
91         <span class="label label-danger">failed</span>
92         <% elsif pj[:result] == 'queued' %>
93         <span class="label">queued</span>
94         <% end %>
95       </td><td>
96         <%= link_to_if_arvados_object pj[:output] %>
97       </td>
98     </tr>
99     <% end %>
100   </tbody>
101   <tfoot>
102     <tr><td colspan="4"></td></tr>
103   </tfoot>
104 </table>
105
106 <% if @object.active %>
107 <% content_for :js do %>
108 setInterval(function(){$('a.refresh').click()}, 15000);
109 <% end %>
110 <% end %>
111
112 <% else %>
113
114   <%= form_tag @object, :method => :put do |f| %>
115
116   <%= hidden_field @object.class.to_s.underscore.singularize.to_sym, :active, :value => true %>
117   <%= button_tag "Run pipeline", {class: 'btn btn-primary pull-right', id: "run-pipeline-button"} %>
118   <% end %>
119
120 <table class="table pipeline-components-table" style="margin-top: -.1em">
121   <colgroup>
122     <col style="width: 15%" />
123     <col style="width: 20%" />
124     <col style="width: 20%" />
125     <col style="width: 45%" />
126   </colgroup>
127
128   <thead>
129     <tr>
130       <th>
131         component
132       </th><th>
133         script
134       </th><th>
135         parameter
136       </th><th>
137         value
138       </th>
139     </tr>
140   </thead>
141   <tbody>
142     <% template.components.each do |k, template_value| %>
143
144     <tr>
145       <td><span class="label label-default"><%= k %></span></td>
146
147       <td><%= render_editable_subattribute @object, :components, [k, :script], template_value[:script] %></td>
148
149       <td>script version</td>
150
151       <td>
152         <%= render_editable_subattribute @object, :components, [k, :script_version], template_value[:script_version] %>
153       </td>
154     </tr>
155
156     <% if template_value[:script_parameters].length > 0 %>
157       <% template_value[:script_parameters].each do |p, tv| %>
158         <tr>
159           <td style="border-top: none"></td>
160           <td style="border-top: none"></td>
161           
162           <td class="property-edit-row"><%= p %></td>
163           <td class="property-edit-row"><%= render_editable_subattribute @object, :components, [k, :script_parameters, p.to_sym], tv %></td>
164       <% end %>
165       </tr>
166     <% end %>
167   <% end %>
168   </tbody>
169   </table>
170   
171 <% end %>