<commit_before>- if @edit
  - url = url_for(:action => 'alert_field_changed', :id => "#{@alert.id || 'new'}")
  - observe_with_interval = {:interval => '.5', :url => url}.to_json
  - observe = {:url => url}.to_json
#alert_snmp_div
  %h3
    = _('SNMP Trap')
  .form-horizontal
    - if @edit
      .form-group
        %label.control-label.col-md-2
          = _('Send an SNMP Trap')
        .col-md-8
          = check_box_tag("send_snmp_cb", "1", @edit[:new][:send_snmp],
            "data-miq_observe_checkbox" => observe)
      - if @edit[:new][:send_snmp]
        .form-group
          %label.control-label.col-md-2
            = title_for_host
          .col-md-8
            = text_field_tag("host_1", @edit[:new][:snmp][:host][0],
              :maxlength         => MAX_DESC_LEN,
              "data-miq_observe" => observe_with_interval)
            %br
            = text_field_tag("host_2", @edit[:new][:snmp][:host][1],
              :maxlength => MAX_DESC_LEN,
              "data-miq_observe" => observe_with_interval)
            %br
            = text_field_tag("host_3", @edit[:new][:snmp][:host][2],
              :maxlength => MAX_DESC_LEN,
              "data-miq_observe" => {:interval => '.5',  :url => url}.to_json)
        .form-group
          %label.control-label.col-md-2
            = _("Version")
          .col-md-8
            = select_tag('snmp_version', options_for_select(%w(v1 v2), @edit[:new][:snmp][:snmp_version]),
              :style => "width:50px",
              :class => "selectpicker")
            :javascript
              miqInitSelectPicker();
              miqSelectPickerEvent('snmp_version', '#{url}', {beforeSend: true, complete: true})
        - trap_text = @edit[:new][:snmp][:snmp_version] == "v1" || @edit[:new][:snmp][:snmp_version].nil? ? _("Trap Number") : _("Trap Object ID")
        .form-group
          %label.control-label.col-md-2
            = trap_text
          .col-md-8
            = text_field_tag("trap_id", @edit[:new][:snmp][:trap_id],
              :maxlength         => MAX_DESC_LEN,
              :class             => "form-control",
              "data-miq_observe" => observe_with_interval)
  - if @edit[:new][:send_snmp]
    %br
    %table.table.table-striped.table-bordered.table-hover
      %thead
        %tr
          %th= _('Variable Object ID')
          %th= _('Type')
          %th= _('Value')
      %tbody
        - 10.times do |i|
          %tr
            %td
              = text_field_tag("oid__#{i + 1}", @edit[:new][:snmp][:variables][i][:oid],
                :maxlength         => MAX_DESC_LEN,
                "data-miq_observe" => observe_with_interval)
            %td
              = select_tag("var_type__#{i + 1}",
                options_for_select(["<#{_('None')}>"] + @edit[:snmp_var_types].sort, @edit[:new][:snmp][:variables][i][:var_type]),
                :style                 => "width:100px",
                "data-miq_sparkle_on"  => true,
                "data-miq_sparkle_off" => true,
                "data-miq_observe"     => observe)
            - if @edit[:new][:snmp][:variables][i][:var_type] == "Null" || @edit[:new][:snmp][:variables][i][:var_type] == "<None>"
              - val_disabled = true
            - else
              - val_disabled = false
            %td
              = text_field_tag("value__#{i + 1}", @edit[:new][:snmp][:variables][i][:value],
                :disabled  => val_disabled,
                :maxlength => MAX_DESC_LEN,
                "data-miq_observe" => observe_with_interval)
  %hr<commit_msg>Correction to style1 conversion in Control-Explorer-Alert<commit_after>- if @edit
  - url = url_for(:action => 'alert_field_changed', :id => "#{@alert.id || 'new'}")
  - observe_with_interval = {:interval => '.5', :url => url}.to_json
  - observe = {:url => url}.to_json
#alert_snmp_div
  %h3
    = _('SNMP Trap')
  .form-horizontal
    - if @edit
      .form-group
        %label.control-label.col-md-2
          = _('Send an SNMP Trap')
        .col-md-8
          = check_box_tag("send_snmp_cb", "1", @edit[:new][:send_snmp],
            "data-miq_observe_checkbox" => observe)
      - if @edit[:new][:send_snmp]
        .form-group
          %label.control-label.col-md-2
            = title_for_host
          .col-md-8
            = text_field_tag("host_1", @edit[:new][:snmp][:host][0],
              :maxlength         => MAX_DESC_LEN,
              :class             => "form-control",
              "data-miq_observe" => observe_with_interval)
            %br
            = text_field_tag("host_2", @edit[:new][:snmp][:host][1],
              :maxlength => MAX_DESC_LEN,
              :class             => "form-control",
              "data-miq_observe" => observe_with_interval)
            %br
            = text_field_tag("host_3", @edit[:new][:snmp][:host][2],
              :maxlength => MAX_DESC_LEN,
              :class             => "form-control",
              "data-miq_observe" => {:interval => '.5',  :url => url}.to_json)
        .form-group
          %label.control-label.col-md-2
            = _("Version")
          .col-md-8
            = select_tag('snmp_version', options_for_select(%w(v1 v2), @edit[:new][:snmp][:snmp_version]),
              :style => "width:50px",
              :class => "selectpicker")
            :javascript
              miqInitSelectPicker();
              miqSelectPickerEvent('snmp_version', '#{url}', {beforeSend: true, complete: true})
        - trap_text = @edit[:new][:snmp][:snmp_version] == "v1" || @edit[:new][:snmp][:snmp_version].nil? ? _("Trap Number") : _("Trap Object ID")
        .form-group
          %label.control-label.col-md-2
            = trap_text
          .col-md-8
            = text_field_tag("trap_id", @edit[:new][:snmp][:trap_id],
              :maxlength         => MAX_DESC_LEN,
              :class             => "form-control",
              "data-miq_observe" => observe_with_interval)
  - if @edit[:new][:send_snmp]
    %br
    %table.table.table-striped.table-bordered.table-hover
      %thead
        %tr
          %th= _('Variable Object ID')
          %th= _('Type')
          %th= _('Value')
      %tbody
        - 10.times do |i|
          %tr
            %td
              = text_field_tag("oid__#{i + 1}", @edit[:new][:snmp][:variables][i][:oid],
                :maxlength         => MAX_DESC_LEN,
                :class             => "form-control",
                "data-miq_observe" => observe_with_interval)
            %td
              = select_tag("var_type__#{i + 1}",
                options_for_select(["<#{_('None')}>"] + @edit[:snmp_var_types].sort, @edit[:new][:snmp][:variables][i][:var_type]),
                "data-miq_sparkle_on"  => true,
                "data-miq_sparkle_off" => true,
                :class    => "selectpicker")
              :javascript
                miqInitSelectPicker();
                miqSelectPickerEvent("var_type__#{i + 1}", "#{url}")
            - if @edit[:new][:snmp][:variables][i][:var_type] == "Null" || @edit[:new][:snmp][:variables][i][:var_type] == "<None>"
              - val_disabled = true
            - else
              - val_disabled = false
            %td
              = text_field_tag("value__#{i + 1}", @edit[:new][:snmp][:variables][i][:value],
                :disabled  => val_disabled,
                :maxlength => MAX_DESC_LEN,
                :class             => "form-control",
                "data-miq_observe" => observe_with_interval)
  %hr
{'fraction_non_alphanumeric': 0.17123013222919728, 'fraction_numerical': 0.008147455589688794, 'mean_word_length': 1.8310018903591683, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 67, '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': '6876657', 'n_tokens_mistral': 2503, 'n_tokens_neox': 2463, 'n_words': 353}