<%= form_for @composer.job_invocation, :html => {'data-refresh-url' => refresh_job_invocations_path, :id => 'job_invocation_form'} do |f| %> <% unless @composer.rerun_possible? %> <%= alert :text => _('Could not rerun job %{id} because its template could not be found') % { :id => @composer.reruns }, :class => 'alert alert-block alert-danger has-error', :close => false %> <% end %> <%= selectable_f f, :job_category, @composer.available_job_categories, { :selected => @composer.job_invocation.job_category, :include_blank => @composer.job_invocation.job_category.nil? }, :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) || @composer.resolve_job_template(templates_for_provider) %> <%= 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 %> <%= autocomplete_f targeting_fields, :search_query, :search_query => @composer.displayed_search_query, :full_path => auto_complete_search_hosts_path %>
<%= @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, :onchange => "regenerate_description(this);" } %> <% end %> <%= advanced_switch_f _('Display advanced fields'), _('Hide advanced fields') %> <% end %> <% end %>
<% end %> <% end %> <% end %> <% end %>
<% end %>
<%= add_label({ :label => _('Type of query'), :label_help => _("Type has impact on when is the query evaluated to hosts.
") }, f, :targetting_type) %>
<%= radio_button_f targeting_fields, :targeting_type, :value => Targeting::STATIC_TYPE, :text => _(Targeting::TYPES[Targeting::STATIC_TYPE]) %> <%= radio_button_f targeting_fields, :targeting_type, :value => Targeting::DYNAMIC_TYPE, :text => _(Targeting::TYPES[Targeting::DYNAMIC_TYPE]) %>
<% end %> <%= trigger_selector f, @composer.triggering %> <%= render :partial => 'preview_hosts_modal' %> <%= render partial: 'rerun_taxonomies' if action_name == 'rerun' %> <%= submit_or_cancel f, false, :cancel_path => job_invocations_path, :disabled => !@composer.rerun_possible? %> <% end %>