2754: Allow template to specify form label, fix up wording and formatting.
[arvados.git] / apps / workbench / app / views / pipeline_instances / _show_inputs.html.erb
1 <% n_inputs = 0 %>
2
3 <% content_for :pi_input_form do %>
4 <form role="form" style="width:60%">
5   <div class="form-group">
6     <% @object.components.each do |cname, component| %>
7       <% next if !component %>
8       <% component[:script_parameters].andand.each do |pname, pvalue_spec| %>
9         <% if pvalue_spec.is_a? Hash %>
10           <% if (pvalue_spec[:description] or
11                  (pvalue_spec[:required] and not pvalue_spec[:value])) %>
12             <% n_inputs += 1 %>
13             <label for="<% "#{cname}-#{pname}" %>">
14               <%= pvalue_spec[:title] ||
15                   "#{pname.to_s.humanize} for #{cname} component" %>
16             </label>
17             <div>
18               <p class="form-control-static">
19                 <%= render_pipeline_component_attribute @object, :components, [cname, :script_parameters, pname.to_sym], pvalue_spec %>
20               </p>
21             </div>
22             <p class="help-block">
23               <%= pvalue_spec[:description] %>
24             </p>
25           <% end %>
26         <% end %>
27       <% end %>
28     <% end %>
29   </div>
30 </form>
31 <% end %>
32
33 <% if n_inputs == 0 %>
34   <p>This pipeline does not need any further inputs specified. You can start it by clicking the "Run" button.</p>
35 <% else %>
36   <p><i>Provide <%= n_inputs > 1 ? 'values' : 'a value' %> for the following <%= n_inputs > 1 ? 'parameters' : 'parameter' %>, then click the "Run" button to start the pipeline.</i></p>
37   <%= content_for :pi_input_form %>
38
39   <%= form_tag @object, :method => :put do |f| %>
40     <%= hidden_field @object.class.to_s.underscore.singularize.to_sym, :state, :value => 'RunningOnServer' %>
41     <%= button_tag({class: 'btn btn-primary run-pipeline-button'}) do %>
42       Run <i class="fa fa-fw fa-play"></i>
43     <% end %>
44   <% end %>
45
46 <% end %>
47
48 <div style="margin-top: 1em;">
49   <p>Click the "Components" tab above to see a full list of pipeline components and parameters.</p>
50 </div>