<commit_before>- if @exp_atom_errors
  -# Errors in this atom, display them instead of the atom
  %fieldset.adminform
    %ul#message{:style => "padding-left: 30px;"}
      %li#message.error
        - @exp_atom_errors.each do |ae|
          = ae
          %br
- else
  - url = url_for_only_path(:action => 'exp_changed')
  -# Grab the model for this expression
  - exp_model = @edit[@expkey][:exp_model]

  -# Get all of the expression types, then remove the count and/or find based ones if model has none
  - unless exp_model == "_display_filter_"
    -# Not valid for secondary display filter
    - exptypes = ExpAtomHelper::EXP_TYPES.map { |x| [_(x[0]), x[1]] }
    - unless MiqExpression.miq_adv_search_lists(exp_model, :exp_available_counts).length > 0
      - exptypes -= [[_(ExpAtomHelper::EXP_COUNT_TYPE[0]), ExpAtomHelper::EXP_COUNT_TYPE[1]]]
    - unless MiqExpression.miq_adv_search_lists(exp_model, :exp_available_finds).length > 0
      - exptypes -= [[_(ExpAtomHelper::EXP_FIND_TYPE[0]), ExpAtomHelper::EXP_FIND_TYPE[1]]]
  #exp_atom_editor_div
    %fieldset
      .toolbar-pf-actions{:style => "margin-left: 20px"}
        .form-group
          - t = _('Commit expression element changes')
          %button.btn.btn-default{"data-method" => :post,
          "data-miq_sparkle_on" => true,
          :onclick              => "miqAjaxButton('#{url_for_only_path(:action => 'exp_button', :pressed => 'commit')}');",
          :remote               => true,
          :title                => t}
            %i.fa.fa-lg.fa-check
          - t = _("Discard expression element changes")
          %button.btn.btn-default{"data-method" => :post,
          "data-miq_sparkle_on" => true,
          :onclick              => "miqAjaxButton('#{url_for_only_path(:action => 'exp_button', :pressed => 'discard')}');",
          :remote               => true,
          :title                => t}
            %i.fa-lg.pficon.pficon-close

      - if @edit[@expkey][:exp_key] == "NOT"
        %font{:color => "black"}
          = _('NOT')
      - else
        - opts = ["<#{_('Choose')}>"]
        - case exp_model
        - when 'Vm'
          - opts += exptypes + ExpAtomHelper::VM_EXP_TYPES.map { |x| [_(x[0]), x[1]] }
        - when 'AuditEvent'
          - opts += [[_('Field'), 'field']]
        - when '_display_filter_'
          - unless @edit[@expkey][:exp_available_fields].empty?
            - opts.push([_('Field'), 'field'])
          - unless @edit[@expkey].tags_for_display_filters.empty?
            - opts.push([_('Tag'), 'tag'])
        - when 'MiqGroup'
          - opts = [[_('Tag'), 'tags']]
          - @edit[@expkey][:exp_typ] = 'tags'
        - else
          - opts += exptypes<commit_msg>Only limit field expression to Tag when the group filter expression is edited<commit_after>- if @exp_atom_errors
  -# Errors in this atom, display them instead of the atom
  %fieldset.adminform
    %ul#message{:style => "padding-left: 30px;"}
      %li#message.error
        - @exp_atom_errors.each do |ae|
          = ae
          %br
- else
  - url = url_for_only_path(:action => 'exp_changed')
  -# Grab the model for this expression
  - exp_model = @edit[@expkey][:exp_model]

  -# Get all of the expression types, then remove the count and/or find based ones if model has none
  - unless exp_model == "_display_filter_"
    -# Not valid for secondary display filter
    - exptypes = ExpAtomHelper::EXP_TYPES.map { |x| [_(x[0]), x[1]] }
    - unless MiqExpression.miq_adv_search_lists(exp_model, :exp_available_counts).length > 0
      - exptypes -= [[_(ExpAtomHelper::EXP_COUNT_TYPE[0]), ExpAtomHelper::EXP_COUNT_TYPE[1]]]
    - unless MiqExpression.miq_adv_search_lists(exp_model, :exp_available_finds).length > 0
      - exptypes -= [[_(ExpAtomHelper::EXP_FIND_TYPE[0]), ExpAtomHelper::EXP_FIND_TYPE[1]]]
  #exp_atom_editor_div
    %fieldset
      .toolbar-pf-actions{:style => "margin-left: 20px"}
        .form-group
          - t = _('Commit expression element changes')
          %button.btn.btn-default{"data-method" => :post,
          "data-miq_sparkle_on" => true,
          :onclick              => "miqAjaxButton('#{url_for_only_path(:action => 'exp_button', :pressed => 'commit')}');",
          :remote               => true,
          :title                => t}
            %i.fa.fa-lg.fa-check
          - t = _("Discard expression element changes")
          %button.btn.btn-default{"data-method" => :post,
          "data-miq_sparkle_on" => true,
          :onclick              => "miqAjaxButton('#{url_for_only_path(:action => 'exp_button', :pressed => 'discard')}');",
          :remote               => true,
          :title                => t}
            %i.fa-lg.pficon.pficon-close

      - if @edit[@expkey][:exp_key] == "NOT"
        %font{:color => "black"}
          = _('NOT')
      - else
        - opts = ["<#{_('Choose')}>"]
        - case exp_model
        - when 'Vm'
          - opts += exptypes + ExpAtomHelper::VM_EXP_TYPES.map { |x| [_(x[0]), x[1]] }
        - when 'AuditEvent'
          - opts += [[_('Field'), 'field']]
        - when '_display_filter_'
          - unless @edit[@expkey][:exp_available_fields].empty?
            - opts.push([_('Field'), 'field'])
          - unless @edit[@expkey].tags_for_display_filters.empty?
            - opts.push([_('Tag'), 'tag'])
        - when 'MiqGroup'
          - if @expkey == :filter_expression
            - opts = [[_('Tag'), 'tags']]
            - @edit[@expkey][:exp_typ] = 'tags'
          -else
            - opts += exptypes
        - else
          - opts += exptypes
{'fraction_non_alphanumeric': 0.15897711015736768, 'fraction_numerical': 0.005007153075822604, 'mean_word_length': 2.236689814814815, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4142775', 'n_tokens_mistral': 1861, 'n_tokens_neox': 1851, 'n_words': 355}