app/views/miq_ae_class/_class_fields.html.haml
#class_fields_div
- if x_node.split('-')[0] == "aec" || params[:pressed] || %w(field_select field_accept field_delete).include?(params[:action])
- if !@in_a_form_fields
/ Show Schema
%h3= _('Schema')
- if @ae_class.ae_fields.present?
= render :partial => 'datastore_list', :locals => {:type => MiqAeClassHelper::DATASTORE_TYPES[:schema], :data => @ae_class.ae_fields}
- else
= render :partial => "layouts/info_msg",
:locals => {:message => _("No schema found")}
- else
- url = url_for_only_path(:action => 'fields_form_field_changed', :id => (@ae_class.id || 'new'))
- obs = {:interval => '.5', :url => url}.to_json
/ Edit Schema
.form_div
%h3= _('Schema')
%table.table.table-striped.table-bordered
%thead
%tr
%th.table-view-pf-select
- [_('Name'), _('Type'), _('Data Type'), _('Default Value'), _('Display Name'), _('Description'), _('Sub'), _('Collect'),
_('Message'), _('On Entry'), _('On Exit'), _('On Error'), _('Max Retries'), _('Max Time')].each do |title|
%th
= title
%tbody
- @edit[:new][:fields].each_with_index do |field, i|
- unless @edit[:fields_to_delete].include?(field["id"])
%tr
%td
= link_to({:action => "field_delete", :id => field["id"].to_s, :arr_id => i},
"data-miq_sparkle_on" => true,
"data-miq_sparkle_off" => true,
:remote => true,
"data-method" => :post,
:class => 'btn btn-default',
:confirm => _('Are you sure you want to delete field from schema?'),
:title => _('Click to delete this field from schema')) do
%i.pficon.pficon-delete
- %w(name aetype datatype default_value display_name description substitute collect message on_entry on_exit on_error max_retries max_time).each do |fname|
%td
- if %w(aetype datatype).include?(fname.to_s)
- combo_name = "fields_#{fname}#{i}"
- combo_options = (fname == "aetype" ? @combo_xml : @dtype_combo_xml)
- combo_url = "/miq_ae_class/fields_form_field_changed/#{@ae_class.id || 'new'}"
.form-group
= select_tag(combo_name,
options_for_select(combo_options, field[fname]),
"title" => "Choose",
:class => "selectpicker")
:javascript
miqSelectPickerEvent("#{combo_name}", "#{combo_url}")
- elsif fname == "substitute"
= check_box_tag("fields_#{fname}_#{i}", "1", field["substitute"],
"data-miq_observe_checkbox" => {:url => url}.to_json)
- elsif fname == "default_value"
- default_value = field["default_value"]
= text_field_tag("fields_default_value_#{i}", default_value,
:style => field['datatype'] == "password" ? "display:none" : "",
"data-miq_observe" => obs)
= password_field_tag("fields_password_value_#{i}", '',
:placeholder => placeholder_if_present(default_value),
:style => field['datatype'] == "password" ? "" : "display:none",
:autocomplete => "new-password",
"data-miq_observe" => obs)
- else
= text_field_tag("fields_#{fname}_#{i}", field[fname],
"data-miq_observe" => obs)
- if !params[:add] && params[:add] != "new" && session[:field_data].blank?
%tr{:onclick => remote_function(:url => {:action => 'field_select', :add => 'new', :item => "field"})}
%td
%button.btn.btn-default
%i.fa.fa-plus
%td
= h("<#{_('New Field')}>")
- 13.times do
%td
- else
%tr
%td
= link_to({:action => "field_accept", :button => "accept"},
"data-miq_sparkle_on" => true,
"data-miq_sparkle_off" => true,
:remote => true,
:class => 'btn btn-default',
"data-method" => :post,
:title => _("Add this entry")) do
%i.pficon.pficon-save
- %w(name aetype datatype default_value display_name description substitute collect message on_entry on_exit on_error max_retries max_time).each do |fname|
%td
- if %w(aetype datatype).include?(fname)
- combo_name = "field_#{fname}"
- combo_options = @edit[:new]["#{fname}s".to_sym]
- combo_url = "/miq_ae_class/fields_form_field_changed/#{@ae_class.id || 'new'}"
.form-group
= select_tag(combo_name,
options_for_select(combo_options, session[:field_data][fname]),
"title" => "Choose",
:class => "selectpicker")
:javascript
miqSelectPickerEvent("#{combo_name}", "#{combo_url}")
- elsif fname == "substitute"
- checked = !session[:field_data].blank? && session[:field_data][:substitute]
= check_box_tag("field_#{fname}", "1", checked, "data-miq_observe_checkbox" => {:url => url}.to_json)
- elsif fname == "default_value"
= text_field_tag("field_default_value", session[:field_data][:default_value],
:style => session[:field_data][:datatype] == "password" ? "display:none" : "",
"data-miq_observe" => obs)
= password_field_tag("field_password_value", '',
:placeholder => placeholder_if_present(session[:field_data][:default_value]),
:style => session[:field_data][:datatype] == "password" ? "" : "display:none",
"data-miq_observe" => obs)
- else
= text_field_tag("field_#{fname}", session[:field_data][fname.to_sym],
"data-miq_observe" => obs)
:javascript
miqInitSelectPicker();