<%= form_for @composer.job_invocation, :html => {'data-refresh-url' => refresh_job_invocations_path, :id => 'job_invocation_form'} do |f| %> <%= selectable_f f, :job_category, @composer.available_job_categories, {}, :label => _('Job category') %> <%= f.hidden_field(:remote_execution_feature_id, :value => @composer.remote_execution_feature_id) %> <% selected_templates_per_provider = {} %> <% @composer.displayed_provider_types.each do |provider_type| %> <%= f.fields_for 'providers' do |providers_fields| %> <%= providers_fields.fields_for provider_type do |provider_type_fields| %> <% templates_for_provider = @composer.templates_for_provider(provider_type) %> <% selected_templates_per_provider[provider_type] = @composer.preselected_template_for_provider(provider_type) || templates_for_provider.first %> <%= selectable_f provider_type_fields, 'job_template_id', templates_for_provider.map { |t| [t.name, t.id] }, { :selected => selected_templates_per_provider[provider_type].try(:id) }, { :class => 'job_template_selector', :label => _('Job template'), :data => { :provider_type => provider_type }, :required => true, :onchange => "template_change(this);" }%> <% end %> <% end %> <% end %> <%= fields_for @composer.targeting do |targeting_fields| %> <% @composer.available_bookmarks.each do |bookmark| %> <% end %> <%= selectable_f targeting_fields, :bookmark_id, @composer.available_bookmarks.map { |b| [b.name, b.id] }, :selected => @composer.targeting.bookmark_id, :include_blank => true %> <%= textarea_f targeting_fields, :search_query, :value => @composer.displayed_search_query, :rows => 5 %>
<%= @composer.targeted_hosts_count %> <%= _('hosts') %> <%= button_tag(:type => 'button', :class => 'btn btn-default btn-sm', :title => _("Refresh"), :id => 'refresh_execution_form') do %> <%= icon_text('refresh', '', :kind => 'fa') %> <% end %> <%= button_tag(:type => 'button', :class => 'btn btn-default btn-sm', :title => _("Preview"), :id => 'preview_hosts') do %> <%= icon_text('eye', '', :kind => 'fa') %> <% end %>
<% @composer.displayed_provider_types.each do |provider_type| %>
<%= f.fields_for 'providers' do |providers_fields| %> <%= providers_fields.fields_for provider_type do |provider_type_fields| %> <%= provider_type_fields.fields_for :job_templates do |job_templates_fields| %> <% @composer.templates_for_provider(provider_type).each do |job_template| %>
<%= job_templates_fields.fields_for job_template.id.to_s do |job_template_fields| %> <%= job_template_fields.fields_for :input_values do |input_values_fields| %> <% inputs = job_template.template_inputs_with_foreign.select { |input| input.input_type == 'user' } %> <% inputs.select { |i| i.basic? }.each do |input| %> <%= render :partial => 'template_inputs/invocation_form', :locals => { :input_values_fields => input_values_fields, :composer => @composer, :job_template => job_template, :input => input } %> <% end %> <%= advanced_switch_f _('Display advanced fields'), _('Hide advanced fields') %> <% end %> <% end %>
<% end %> <% end %> <% end %> <% end %>
<% end %> <% end %> <%= trigger_selector f, @composer.triggering %> <%= render :partial => 'preview_hosts_modal' %> <%= submit_or_cancel f, false, :cancel_path => job_invocations_path %> <% end %>