Project

General

Profile

Download (4.26 KB) Statistics
| Branch: | Tag: | Revision:
<div id='<%= (f.object.key || 'new_lookup_keys').to_s.gsub(' ','_') + '_' + f.object.id.to_s %>' class='tab-pane fields' >
<% is_param = f.object.is_param %>

<%= text_f(f, :environment_classes, :value => f.object.environment_classes.map(&:environment).to_sentence, :label => _('Puppet Environments'),:size => "col-md-8", :disabled=>true) if is_param%>

<%= remove_child_link(_("Remove %s?") % (f.object.new_record? ? _("Variable") : f.object), f , {:class => 'btn btn-danger hide'}) unless controller_name == "lookup_keys" %>
<%= text_f f, :key, :disabled => f.object.is_param, :size => "col-md-8" %>
<%= f.hidden_field :key if is_param %>
<%= textarea_f f, :description, :rows => :auto, :size => "col-md-8" %>

<%= show_puppet_class f %>
<%= checkbox_f(f, :override, :onchange => 'toggleOverrideValue(this)', :size => "col-md-8",
:help_block => _('Whether the smart variable value is managed by Foreman')
) if is_param%>

<%= param_type_selector(f, :onchange => 'keyTypeChange(this)') %>
<%= textarea_f f, :default_value, :value => f.object.default_value_before_type_cast,:size => "col-md-8",
:disabled => (f.object.is_param && (!f.object.override || f.object.use_puppet_default)),
:rows => :auto, :help_block => _("Value to use when there is no match") %>
<%= checkbox_f(f, :use_puppet_default, :label => _('Use Puppet default'), :size => "col-md-8",
:help_block => _('Do not send this parameter via the ENC. Puppet will use the value defined in the Puppet manifest for this parameter.'),
:onchange=>'toggleUsePuppetDefaultValue(this, "default_value")',
:disabled => (f.object.is_param && !f.object.override)) if is_param%>
<div <%= "id=#{(f.object.key || 'new_lookup_keys').to_s.gsub(' ','_')}_lookup_key_override_value" %> style=<%= "display:none;" if (f.object.is_param && !f.object.override) %>>
<legend><%= _("Optional input validator") %></legend>
<p class="help-block">
<%= _('Note that if you use ERB as a value of parameter, value will be validated during ENC evaluation. If value is invalid, ENC evaluation will fail.') %>
</p>
<%= checkbox_f(f, :required, :size => "col-md-8", :disabled => !f.object.override,
:help_block => _("If checked, will raise an error if there is no default value and no matcher provide a value.")
) if is_param %>
<%= validator_type_selector f %>
<%= text_f f, :validator_rule, :size => "col-md-8", :disabled => f.object.validator_type.blank? %>

<legend><%= _("Override value for specific hosts") %></legend>
<%= checkbox_f(f, :merge_overrides, :onchange => 'mergeOverridesChanged(this)',
:disabled => !f.object.supports_merge?, :size => "col-md-8",
:help_block => _("Should the matchers continue to look for matches after first find (only array/hash type). Note: merging overrides ignores all matchers that use Puppet default")) %>
<%= checkbox_f(f, :avoid_duplicates, :disabled => (!f.object.supports_uniq? || !f.object.merge_overrides), :size => "col-md-8",
:help_block => _("Should the matched result avoid duplicate values (only array type).")) %>
<%= textarea_f f, :path, :rows => :auto, :label => _("Order"), :size => "col-md-8", :value => f.object.path,
:help_block => popover(_("The order in which values are resolved"),
_("The order in which matchers keys are processed, first match wins.<br> You may use multiple attributes as a matcher key, for example, an order of <code>host group, environment</code> would expect a matcher such as <code>hostgroup = \"web servers\", environment = production</code>"), :title => _("The order in which values are resolved")).html_safe
%>

<div class="children_fields">
<%= new_child_fields_template(f, :lookup_values, {:partial => "lookup_keys/value", :form_builder_attrs => {:is_param => is_param}}) %>
<%= f.fields_for :lookup_values do |lookup_values| %>
<%= render 'lookup_keys/value', :f => lookup_values, :is_param => is_param %>
<% end %>
<%= add_child_link '+ ' + _("Add Matcher-Value"), :lookup_values, { :title => _('add a new matcher-value pair')} %>
</div>
</div>
</div>
(1-1/4)