UI for editing component parameters now correctly highlights the background of requir...
[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 <% if @object.active != nil %>
31 <table class="table pipeline-components-table">
32   <colgroup>
33     <col style="width: 15%" />
34     <col style="width: 20%" />
35     <col style="width: 20%" />
36     <col style="width: 45%" />
37   </colgroup>
38   <thead>
39     <tr>
40       <th>
41         component
42       </th><th>
43         script, version
44       </th><th>
45         progress
46         <%= link_to '(refresh)', request.fullpath, class: 'refresh', remote: true, method: 'get' %>
47       </th><th>
48         output
49       </th>
50     </tr>
51   </thead>
52   <tbody>
53     <% render_pipeline_jobs.each do |pj| %>
54     <tr>
55       <td>
56         <% label = if pj[:job].andand[:uuid] 
57                        if pj[:job][:running]
58                          'label-info'
59                        elsif pj[:job][:success]
60                          'label-success'
61                        else
62                          'label-danger'
63                        end 
64                      else
65                        'label-default'
66                      end %>
67         <% if pj[:job].andand[:uuid] %>
68         <%= link_to pj[:name], job_url(id: pj[:job][:uuid]), class: "label #{label}" %>
69         <% else %>
70           <span class="label <%= label %>"><%= pj[:name] %></span>
71         <% end %>
72         </span>
73       </td><td>
74         <%= pj[:script] %>
75         <br /><span class="deemphasize"><%= pj[:script_version] %></span>
76       </td><td>
77         <%= pj[:progress_bar] %>
78         <% if pj[:job].andand[:cancelled_at] %>
79         <span class="pull-right label label-warning">cancelled</span>
80         <% elsif pj[:failed] %>
81         <span class="pull-right label label-warning">failed</span>
82         <% elsif pj[:result] == 'queued' %>
83         <span class="pull-right label">queued</span>
84         <% end %>
85       </td><td>
86         <%= link_to_if_arvados_object pj[:output] %>
87       </td>
88     </tr>
89     <% end %>
90   </tbody>
91   <tfoot>
92     <tr><td colspan="4"></td></tr>
93   </tfoot>
94 </table>
95
96 <% if @object.active %>
97 <% content_for :js do %>
98 setInterval(function(){$('a.refresh').click()}, 30000);
99 <% end %>
100 <% end %>
101
102 <% else %>
103
104   <%= form_tag @object, :method => :put do |f| %>
105
106   <%= hidden_field @object.class.to_s.underscore.singularize.to_sym, :active, :value => true %>
107   <%= button_tag "Run pipeline", {class: 'btn btn-primary pull-right'} %>
108   <% end %>
109
110 <table class="table pipeline-components-table" style="margin-top: -.1em">
111   <colgroup>
112     <col style="width: 15%" />
113     <col style="width: 20%" />
114     <col style="width: 20%" />
115     <col style="width: 45%" />
116   </colgroup>
117
118   <thead>
119     <tr>
120       <th>
121         component
122       </th><th>
123         script
124       </th><th>
125         parameter
126       </th><th>
127         value
128       </th>
129     </tr>
130   </thead>
131   <tbody>
132     <% template = PipelineTemplate.find(@object.pipeline_template_uuid) %>
133     <% template.components.each do |k, template_value| %>
134
135     <tr>
136       <td><span class="label label-default"><%= k %></span></td>
137
138       <td><%= render_editable_subattribute @object, :components, [k, :script], template_value[:script] %></td>
139
140       <td>script version</td>
141
142       <td>
143         <%= render_editable_subattribute @object, :components, [k, :script_version], template_value[:script_version] %>
144       </td>
145     </tr>
146
147     <% if template_value[:script_parameters].length > 0 %>
148       <% template_value[:script_parameters].each do |p, tv| %>
149         <tr>
150           <td style="border-top: none"></td>
151           <td style="border-top: none"></td>
152           
153           <td class="property-edit-row"><%= p %></td>
154           <td class="property-edit-row"><%= render_editable_subattribute @object, :components, [k, :script_parameters, p.to_sym], tv %></td>
155       <% end %>
156       </tr>
157     <% end %>
158   <% end %>
159   </tbody>
160   </table>
161   
162 <% end %>