Module: ForemanMonitoring::HostsHelperExt

Extended by:
ActiveSupport::Concern
Defined in:
app/helpers/concerns/foreman_monitoring/hosts_helper_ext.rb

Instance Method Summary collapse

Instance Method Details

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



61
62
63
64
65
66
# File 'app/helpers/concerns/foreman_monitoring/hosts_helper_ext.rb', line 61

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

#host_monitoring_result_class(result) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/helpers/concerns/foreman_monitoring/hosts_helper_ext.rb', line 48

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



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

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_with_monitoring(host) ⇒ Object



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

def host_title_actions_with_monitoring(host)
  title_actions(
    button_group(
      display_link_if_authorized(_('Downtime'),
                                 hash_for_host_path(:id => host).merge(:auth_object => host,
                                                                       :permission => :manage_host_downtimes,
                                                                       :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' })
    )
  )
  host_title_actions_without_monitoring(host)
end

#multiple_actions_with_monitoringObject



10
11
12
13
# File 'app/helpers/concerns/foreman_monitoring/hosts_helper_ext.rb', line 10

def multiple_actions_with_monitoring
  return multiple_actions_without_monitoring unless authorized_for(:controller => :hosts, :action => :select_multiple_downtime)
  multiple_actions_without_monitoring + [[_('Set downtime'), select_multiple_downtime_hosts_path], [_('Change Monitoring Proxy'), select_multiple_monitoring_proxy_hosts_path]]
end