app/views/miq_alert/_alert_snmp.html.haml
- if @edit
- url = url_for_only_path(: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
= _("Host")
.col-md-8
= text_field_tag("host_1", @edit[:new][:snmp][:host][0],
:maxlength => ViewHelper::MAX_DESC_LEN,
:class => "form-control",
"data-miq_observe" => observe_with_interval)
%br
= text_field_tag("host_2", @edit[:new][:snmp][:host][1],
:maxlength => ViewHelper::MAX_DESC_LEN,
:class => "form-control",
"data-miq_observe" => observe_with_interval)
%br
= text_field_tag("host_3", @edit[:new][:snmp][:host][2],
:maxlength => ViewHelper::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 => ViewHelper::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 => ViewHelper::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 => ViewHelper::MAX_DESC_LEN,
:class => "form-control",
"data-miq_observe" => observe_with_interval)
%hr