Module: ForemanMonitoring::HostsHelperExt

Defined in:
app/helpers/concerns/foreman_monitoring/hosts_helper_ext.rb

Instance Method Summary collapse

Instance Method Details

#host_monitoring_result_class(result) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/helpers/concerns/foreman_monitoring/hosts_helper_ext.rb', line 45

def host_monitoring_result_class(result)
  case result
  when :ok
    'status-ok'
  when :warning
    'status-warn'
  when :critical
    'status-error'
  else
    'status-question'
  end
end

#host_monitoring_result_icon_class(result) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/helpers/concerns/foreman_monitoring/hosts_helper_ext.rb', line 30

def host_monitoring_result_icon_class(result)
  icon_class = case result
               when :ok
                 'pficon-ok'
               when :warning
                 'pficon-info'
               when :critical
                 'pficon-error-circle-o'
               else
                 'pficon-help'
               end

  "host-status #{icon_class} #{host_monitoring_result_class(result)}"
end

#host_title_actions(host) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/helpers/concerns/foreman_monitoring/hosts_helper_ext.rb', line 12

def host_title_actions(host)
  title_actions(
    button_group(
      display_link_if_authorized(_('Downtime'),
                                 hash_for_host_path(:id => host).merge(:auth_object => host,
                                                                       :permission => :manage_downtime_hosts,
                                                                       :anchor => 'set_host_downtime'),
                                 :class => 'btn btn-default',
                                 :disabled => !host.monitored?,
                                 :title => _('Set a downtime for this host'),
                                 :id => 'host-downtime',
                                 :data => { :toggle => 'modal',
                                            :target => '#set_host_downtime' })
    )
  )
  super
end

#monitoring_datetime_f(f, attr, options = {}) ⇒ Object



58
59
60
61
62
63
# File 'app/helpers/concerns/foreman_monitoring/hosts_helper_ext.rb', line 58

def monitoring_datetime_f(f, attr, options = {})
  field(f, attr, options) do
    addClass options, 'form-control'
    f.datetime_field attr, options
  end
end

#multiple_actionsObject



5
6
7
8
9
10
# File 'app/helpers/concerns/foreman_monitoring/hosts_helper_ext.rb', line 5

def multiple_actions
  actions = super
  actions << [_('Set downtime'), select_multiple_downtime_hosts_path] if authorized_for(:controller => :hosts, :action => :select_multiple_downtime)
  actions << [_('Change Monitoring Proxy'), select_multiple_monitoring_proxy_hosts_path] if authorized_for(:controller => :hosts, :action => :select_multiple_monitoring_proxy)
  actions
end