Module: ForemanMonitoring::HostsHelper
- Defined in:
- app/helpers/foreman_monitoring/hosts_helper.rb
Instance Method Summary collapse
- #host_monitoring_result_class(result) ⇒ Object
- #host_monitoring_result_icon_class(result) ⇒ Object
- #host_title_actions(host) ⇒ Object
- #monitoring_datetime_f(f, attr, options = {}) ⇒ Object
- #monitoring_hosts_multiple_actions ⇒ Object
Instance Method Details
#host_monitoring_result_class(result) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/helpers/foreman_monitoring/hosts_helper.rb', line 53 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
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/helpers/foreman_monitoring/hosts_helper.rb', line 38 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
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/helpers/foreman_monitoring/hosts_helper.rb', line 14 def host_title_actions(host) title_actions( ( ( _('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
66 67 68 69 70 71 |
# File 'app/helpers/foreman_monitoring/hosts_helper.rb', line 66 def monitoring_datetime_f(f, attr, = {}) field(f, attr, ) do addClass , 'form-control' f.datetime_field attr, end end |
#monitoring_hosts_multiple_actions ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'app/helpers/foreman_monitoring/hosts_helper.rb', line 5 def monitoring_hosts_multiple_actions actions = [] actions << { action: [_('Set downtime'), select_multiple_downtime_hosts_path], priority: 1000 } \ if (:controller => :hosts, :action => :select_multiple_downtime) actions << { action: [_('Change Monitoring Proxy'), select_multiple_monitoring_proxy_hosts_path], priority: 1000 } \ if (:controller => :hosts, :action => :select_multiple_monitoring_proxy) actions end |