foreman_monitoring 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8c19621c4296a6cc5d051522ee0176ef3a4726f24bc73eda2c1182c812939c5
4
- data.tar.gz: 1691af6f9079acd23c0f826b6052605d99eff64346c127a5b50a2fbac4e38344
3
+ metadata.gz: 685e5be086aa9ee637a3ef119df3310475334138a687f2583e21148ba63e1743
4
+ data.tar.gz: 2dd299e15e6a4701e15ff7fc04e95c733c72454bd718f15082315fada5db2e4a
5
5
  SHA512:
6
- metadata.gz: 57746ee94c93571b9e8fa14050f2ff1358d265fa710908175fa26b9baa799c5597d31ef2b8a71c3d31b9a57c6c6e4e46fc7377700d1a4f686e1db2a18835f54c
7
- data.tar.gz: 14c121e8aaf4c486e1fdd74ce09747578658cc8f8d7c5c9e471d897ea55fe27d8e5c5a3068c87373988af09d6b96bfee113fb90428680abed618eca0c825ebbd
6
+ metadata.gz: 612b798a6f43d52b223c248e63298606fafe545caf2350633c9f24ec08b0f35de0a8459a560171b519a24972e39cc84c974b902c39c578adb680586cfc51f238
7
+ data.tar.gz: def3221fb65d2d545ee7b404725d173de31f444008dff5140fcbfe6e315d20574cba95f2e8f5a14ad580c3d180fc89022ec8827a51d1ad541df51a08964679fc
@@ -97,7 +97,8 @@ module ForemanMonitoring
97
97
  :comment => params[:downtime][:comment],
98
98
  :author => "Foreman User #{User.current}",
99
99
  :start_time => Time.zone.parse(params[:downtime][:starttime]).to_i,
100
- :end_time => Time.zone.parse(params[:downtime][:endtime]).to_i
100
+ :end_time => Time.zone.parse(params[:downtime][:endtime]).to_i,
101
+ **(params[:downtime][:all_services] == '1' ? { :all_services => true } : {})
101
102
  }
102
103
  end
103
104
 
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ForemanMonitoring
4
+ module HostsHelper
5
+ def monitoring_hosts_multiple_actions
6
+ actions = []
7
+ actions << { action: [_('Set downtime'), select_multiple_downtime_hosts_path], priority: 1000 } \
8
+ if authorized_for(:controller => :hosts, :action => :select_multiple_downtime)
9
+ actions << { action: [_('Change Monitoring Proxy'), select_multiple_monitoring_proxy_hosts_path], priority: 1000 } \
10
+ if authorized_for(:controller => :hosts, :action => :select_multiple_monitoring_proxy)
11
+ actions
12
+ end
13
+
14
+ def host_title_actions(host)
15
+ title_actions(
16
+ button_group(
17
+ display_link_if_authorized(
18
+ _('Downtime'),
19
+ hash_for_host_path(:id => host).merge(
20
+ :auth_object => host,
21
+ :permission => :manage_downtime_hosts,
22
+ :anchor => 'set_host_downtime'
23
+ ),
24
+ :class => 'btn btn-default',
25
+ :disabled => !host.monitored?,
26
+ :title => _('Set a downtime for this host'),
27
+ :id => 'host-downtime',
28
+ :data => {
29
+ :toggle => 'modal',
30
+ :target => '#set_host_downtime',
31
+ }
32
+ )
33
+ )
34
+ )
35
+ super
36
+ end
37
+
38
+ def host_monitoring_result_icon_class(result)
39
+ icon_class = case result
40
+ when :ok
41
+ 'pficon-ok'
42
+ when :warning
43
+ 'pficon-info'
44
+ when :critical
45
+ 'pficon-error-circle-o'
46
+ else
47
+ 'pficon-help'
48
+ end
49
+
50
+ "host-status #{icon_class} #{host_monitoring_result_class(result)}"
51
+ end
52
+
53
+ def host_monitoring_result_class(result)
54
+ case result
55
+ when :ok
56
+ 'status-ok'
57
+ when :warning
58
+ 'status-warn'
59
+ when :critical
60
+ 'status-error'
61
+ else
62
+ 'status-question'
63
+ end
64
+ end
65
+
66
+ def monitoring_datetime_f(f, attr, options = {})
67
+ field(f, attr, options) do
68
+ addClass options, 'form-control'
69
+ f.datetime_field attr, options
70
+ end
71
+ end
72
+ end
73
+ end
@@ -1,3 +1,4 @@
1
1
  <%= text_f f, :comment, :size => "col-md-5", :label => _('Comment'), :help_inline => _('Short description that explains why the downtime was set.'), :required => true %>
2
2
  <%= monitoring_datetime_f f, :starttime, :size => "col-md-5", :label => _('Starttime'), :help_inline => _('Time when the downtime should start.'), :min => DateTime.now, :value => Time.current, :required => true %>
3
3
  <%= monitoring_datetime_f f, :endtime, :size => "col-md-5", :label => _('Endtime'), :help_inline => _('Time when the downtime should end.'), :value => Time.current.advance(:hours => 2), :required => true %>
4
+ <%= checkbox_f f, :all_services, :size => "col-md-5", :label => _('All services'), :help_inline => _("Set downtime for all host's services.") %>
@@ -82,13 +82,16 @@ module ForemanMonitoring
82
82
  smart_proxy_for Hostgroup, :monitoring_proxy, monitoring_proxy_options
83
83
 
84
84
  add_controller_action_scope('HostsController', :index) { |base_scope| base_scope.includes(:monitoring_proxy) }
85
+
86
+ describe_host do
87
+ multiple_actions_provider :monitoring_hosts_multiple_actions
88
+ end
85
89
  end
86
90
  end
87
91
 
88
92
  config.to_prepare do
89
93
  ::Host::Managed.prepend(ForemanMonitoring::HostExtensions)
90
94
  ::Hostgroup.include(ForemanMonitoring::HostgroupExtensions)
91
- ::HostsHelper.prepend(ForemanMonitoring::HostsHelperExt)
92
95
  ::HostsController.prepend(ForemanMonitoring::HostsControllerExtensions)
93
96
  rescue StandardError => e
94
97
  Rails.logger.warn "ForemanMonitoring: skipping engine hook (#{e})"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanMonitoring
4
- VERSION = '3.1.0'
4
+ VERSION = '3.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_monitoring
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timo Goebel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-28 00:00:00.000000000 Z
11
+ date: 2024-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -52,7 +52,7 @@ files:
52
52
  - app/controllers/api/v2/monitoring_results_controller.rb
53
53
  - app/controllers/concerns/foreman_monitoring/find_host_by_client_cert.rb
54
54
  - app/controllers/concerns/foreman_monitoring/hosts_controller_extensions.rb
55
- - app/helpers/concerns/foreman_monitoring/hosts_helper_ext.rb
55
+ - app/helpers/foreman_monitoring/hosts_helper.rb
56
56
  - app/lib/proxy_api/monitoring.rb
57
57
  - app/models/concerns/foreman_monitoring/host_extensions.rb
58
58
  - app/models/concerns/foreman_monitoring/hostgroup_extensions.rb
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.5.9
121
+ rubygems_version: 3.2.3
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Foreman plugin for monitoring system integration.
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ForemanMonitoring
4
- module HostsHelperExt
5
- def multiple_actions
6
- actions = super
7
- actions << [_('Set downtime'), select_multiple_downtime_hosts_path] if authorized_for(:controller => :hosts, :action => :select_multiple_downtime)
8
- actions << [_('Change Monitoring Proxy'), select_multiple_monitoring_proxy_hosts_path] if authorized_for(:controller => :hosts, :action => :select_multiple_monitoring_proxy)
9
- actions
10
- end
11
-
12
- def host_title_actions(host)
13
- title_actions(
14
- button_group(
15
- display_link_if_authorized(_('Downtime'),
16
- hash_for_host_path(:id => host).merge(:auth_object => host,
17
- :permission => :manage_downtime_hosts,
18
- :anchor => 'set_host_downtime'),
19
- :class => 'btn btn-default',
20
- :disabled => !host.monitored?,
21
- :title => _('Set a downtime for this host'),
22
- :id => 'host-downtime',
23
- :data => { :toggle => 'modal',
24
- :target => '#set_host_downtime' })
25
- )
26
- )
27
- super
28
- end
29
-
30
- def host_monitoring_result_icon_class(result)
31
- icon_class = case result
32
- when :ok
33
- 'pficon-ok'
34
- when :warning
35
- 'pficon-info'
36
- when :critical
37
- 'pficon-error-circle-o'
38
- else
39
- 'pficon-help'
40
- end
41
-
42
- "host-status #{icon_class} #{host_monitoring_result_class(result)}"
43
- end
44
-
45
- def host_monitoring_result_class(result)
46
- case result
47
- when :ok
48
- 'status-ok'
49
- when :warning
50
- 'status-warn'
51
- when :critical
52
- 'status-error'
53
- else
54
- 'status-question'
55
- end
56
- end
57
-
58
- def monitoring_datetime_f(f, attr, options = {})
59
- field(f, attr, options) do
60
- addClass options, 'form-control'
61
- f.datetime_field attr, options
62
- end
63
- end
64
- end
65
- end