<commit_before>#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
      = render :partial => "layouts/flash_msg"
      %h3= _('Schema')
      - if @ae_class.ae_fields.present?
        %table.table.table-striped.table-bordered
          %thead
            %tr
            - [_('Name'), _('Description'), _('Default Value'), _('Collect'), _('Message'), _('On Entry'),
              _('On Exit'), _('On Error'), _('Max Retries'), _('Max Time')].each do |title|
              %th
                = title
          %tbody
          - @ae_class.ae_fields.each do |ae_field|
            - image = ae_field.substitute ? "pficon pficon-ok" : "pficon pficon-close"
            %tr
              - %w(name description default_value collect message on_entry on_exit on_error max_retries max_time).each do |fname|
                %td.text-nowrap
                  / Name is special processed
                  - if fname == 'name'
                    %i.product.fa-lg{:class => "product-ae_#{ae_field.aetype}",
                                      :alt   => (t = "#{_('Type:')} #{ae_field.aetype}"),
                                      :title => t}
                    - if !ae_field.datatype.blank? && ae_field.datatype != "string"
                      %i.product.fa-lg{:class => "product-#{ae_field.datatype}",
                                        :alt   => (t = "#{_('Data Type:')} #{ae_field.datatype}"), :title => t}

                    %i.fa-lg{:class => "#{image}",
                              :alt   => (t = "#{_('Substitution:')} #{ae_field.substitute}"),
                              :title => t}

                    = h(ae_field.display_name)
                    (#{h(ae_field.name)})
                  - elsif fname == 'default_value'
                    /-- show astericks if its a password field
                    = h((ae_field.datatype == "password") ? "********" : ae_field.send(fname))
                  - else
                    = h(ae_field.send(fname))
      - else
        = render :partial => "layouts/info_msg",
                 :locals  => {:message => _("No schema found")}

    - else
      - url = url_for(:action => 'fields_form_field_changed', :id => "#{@ae_class.id || 'new'}")
      - obs = {:interval => '.5', :url => url}.to_json
      / Edit Schema
      #form_div
        = render :partial => "layouts/flash_msg"
        %h3= _('Schema')
        %table.table.table-striped.table-bordered
          %thead
            %tr
              %th.narrow
              - [_('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(image_tag(image_path("16/notequal-red.png"), :alt => (t = _("Click to delete this field from schema"))),
                    {: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,
                    :confirm               => _('Are you sure you want to delete field from schema?'),
                    :title                 => t)
                - %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 = "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",
                        "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? || session[:field_data].empty?)
            %tr{:onclick => remote_function(:url => {:action => 'field_select', :add => 'new', :item => "field"})}
              %td
                = image_tag(image_path("16/equal-green.png"))
              %td
                = h("<#{_('New Field')}>")
              - 13.times do
                %td
          - else
            - @prty = 1
            - @edit[:new][:fields].sort_by { |a| [a['priority'].to_i] }.each_with_index do |field, i|
              - @prty = (field['priority'].to_i + 1) if i == (@edit[:new][:fields].length - 1)

            %tr
              %td
                = link_to(image_tag(image_path("16/na.png"), :alt => (t = _("Add this entry"))),
                  {:action => "field_accept", :button => "accept"},
                  "data-miq_sparkle_on"  => true,
                  "data-miq_sparkle_off" => true,
                  :remote                => true,
                  "data-method"          => :post,
                  :title                 => t)
              - %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" : "",<commit_msg>Removed useless code from partial (transferred from ManageIQ/manageiq@6a4c68b57a10dd75ceb2bd76c95aab2a863786f7)<commit_after>#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
      = render :partial => "layouts/flash_msg"
      %h3= _('Schema')
      - if @ae_class.ae_fields.present?
        %table.table.table-striped.table-bordered
          %thead
            %tr
            - [_('Name'), _('Description'), _('Default Value'), _('Collect'), _('Message'), _('On Entry'),
              _('On Exit'), _('On Error'), _('Max Retries'), _('Max Time')].each do |title|
              %th
                = title
          %tbody
          - @ae_class.ae_fields.each do |ae_field|
            - image = ae_field.substitute ? "pficon pficon-ok" : "pficon pficon-close"
            %tr
              - %w(name description default_value collect message on_entry on_exit on_error max_retries max_time).each do |fname|
                %td.text-nowrap
                  / Name is special processed
                  - if fname == 'name'
                    %i.product.fa-lg{:class => "product-ae_#{ae_field.aetype}",
                                      :alt   => (t = "#{_('Type:')} #{ae_field.aetype}"),
                                      :title => t}
                    - if !ae_field.datatype.blank? && ae_field.datatype != "string"
                      %i.product.fa-lg{:class => "product-#{ae_field.datatype}",
                                        :alt   => (t = "#{_('Data Type:')} #{ae_field.datatype}"), :title => t}

                    %i.fa-lg{:class => "#{image}",
                              :alt   => (t = "#{_('Substitution:')} #{ae_field.substitute}"),
                              :title => t}

                    = h(ae_field.display_name)
                    (#{h(ae_field.name)})
                  - elsif fname == 'default_value'
                    /-- show astericks if its a password field
                    = h((ae_field.datatype == "password") ? "********" : ae_field.send(fname))
                  - else
                    = h(ae_field.send(fname))
      - else
        = render :partial => "layouts/info_msg",
                 :locals  => {:message => _("No schema found")}

    - else
      - url = url_for(:action => 'fields_form_field_changed', :id => "#{@ae_class.id || 'new'}")
      - obs = {:interval => '.5', :url => url}.to_json
      / Edit Schema
      #form_div
        = render :partial => "layouts/flash_msg"
        %h3= _('Schema')
        %table.table.table-striped.table-bordered
          %thead
            %tr
              %th.narrow
              - [_('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(image_tag(image_path("16/notequal-red.png"), :alt => (t = _("Click to delete this field from schema"))),
                    {: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,
                    :confirm               => _('Are you sure you want to delete field from schema?'),
                    :title                 => t)
                - %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 = "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",
                        "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? || session[:field_data].empty?)
            %tr{:onclick => remote_function(:url => {:action => 'field_select', :add => 'new', :item => "field"})}
              %td
                = image_tag(image_path("16/equal-green.png"))
              %td
                = h("<#{_('New Field')}>")
              - 13.times do
                %td
          - else
            %tr
              %td
                = link_to(image_tag(image_path("16/na.png"), :alt => (t = _("Add this entry"))),
                  {:action => "field_accept", :button => "accept"},
                  "data-miq_sparkle_on"  => true,
                  "data-miq_sparkle_off" => true,
                  :remote                => true,
                  "data-method"          => :post,
                  :title                 => t)
              - %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" : "",
{'fraction_non_alphanumeric': 0.14978274363749225, 'fraction_numerical': 0.0033519553072625698, 'mean_word_length': 1.4962813758909204, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 117, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2226890', 'n_tokens_mistral': 4759, 'n_tokens_neox': 4536, 'n_words': 833}