foreman_expire_hosts 6.0.2 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +13 -9
- data/.rubocop_todo.yml +1 -36
- data/README.md +1 -0
- data/app/controllers/concerns/foreman_expire_hosts/host_controller_extensions.rb +10 -12
- data/app/helpers/concerns/foreman_expire_hosts/hosts_helper_extensions.rb +2 -16
- data/app/helpers/foreman_expire_hosts/hosts_helper.rb +16 -0
- data/app/services/foreman_expire_hosts/safe_destroy.rb +1 -1
- data/app/services/foreman_expire_hosts/ui_notifications/hosts/base.rb +1 -1
- data/app/views/hosts/_expired_on_field.html.erb +11 -20
- data/app/views/hosts/select_multiple_expiration.html.erb +10 -15
- data/foreman_expire_hosts.gemspec +3 -2
- data/lib/foreman_expire_hosts/engine.rb +10 -7
- data/lib/foreman_expire_hosts/version.rb +1 -1
- data/test/functional/concerns/hosts_controller_extensions_test.rb +1 -1
- data/test/helpers/hosts_helper_test.rb +3 -0
- data/test/lib/expire_hosts_notifications_test.rb +1 -1
- metadata +26 -15
- data/app/assets/javascripts/foreman_expire_hosts/application.js +0 -3
- data/app/assets/javascripts/foreman_expire_hosts/datepicker_for_host_expired_on_field.js +0 -27
- data/app/assets/stylesheets/foreman_expire_hosts/application.scss +0 -4
- data/app/overrides/add_js_to_host_index.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f4ea5566b63be22aff9f760b76e60ca34a5ae6c4b09c5cbf1350095b092599d
|
4
|
+
data.tar.gz: 599502fc7cd748e98c3c5e4caeec46868c1484a7e0c883fddf281ab19e11e76e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81cfb253f0a07dbc56641c6fb194f3cd61b4d0d366d855a71202ca9ae9d686f5ef5d56aeabed31b8905990c30c59527035218541fd3f860855843e2adc0cfddf
|
7
|
+
data.tar.gz: 4b9c1c317f1abc646c04260bc92822833ac743cb018e79b62eaa48fd3ef94a43fd752a04a553c253b7424bd67308e75251002f84b0fe2e7f49706ea714e96e74
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
inherit_from:
|
2
2
|
- .rubocop_todo.yml
|
3
3
|
|
4
|
+
require:
|
5
|
+
- rubocop-performance
|
6
|
+
- rubocop-rails
|
7
|
+
|
4
8
|
AllCops:
|
5
9
|
TargetRubyVersion: 2.3
|
6
10
|
TargetRailsVersion: 5.1
|
@@ -17,18 +21,12 @@ Rails/Date:
|
|
17
21
|
Style/Documentation:
|
18
22
|
Enabled: false
|
19
23
|
|
20
|
-
Metrics/MethodLength:
|
21
|
-
Max: 40
|
22
|
-
|
23
24
|
Naming/AccessorMethodName:
|
24
25
|
Enabled: false
|
25
26
|
|
26
27
|
Style/RedundantSelf:
|
27
28
|
Enabled: false
|
28
29
|
|
29
|
-
Metrics/ClassLength:
|
30
|
-
Max: 500
|
31
|
-
|
32
30
|
Naming/FileName:
|
33
31
|
Exclude:
|
34
32
|
- 'db/seeds.d/*'
|
@@ -48,9 +46,6 @@ Style/ClassAndModuleChildren:
|
|
48
46
|
Style/EachWithObject:
|
49
47
|
Enabled: false
|
50
48
|
|
51
|
-
Metrics/ParameterLists:
|
52
|
-
Enabled: false
|
53
|
-
|
54
49
|
Style/SymbolArray:
|
55
50
|
Enabled: false
|
56
51
|
|
@@ -71,3 +66,12 @@ Style/CommentedKeyword:
|
|
71
66
|
|
72
67
|
Rails/LexicallyScopedActionFilter:
|
73
68
|
Enabled: false
|
69
|
+
|
70
|
+
Rails/OutputSafety:
|
71
|
+
Enabled: false
|
72
|
+
|
73
|
+
Rails/SkipsModelValidations:
|
74
|
+
Enabled: false
|
75
|
+
|
76
|
+
Metrics:
|
77
|
+
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
@@ -1,42 +1,7 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2019-12-04 09:30:58 +0100 using RuboCop version 0.75.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 12
|
10
|
-
Metrics/AbcSize:
|
11
|
-
Max: 51
|
12
|
-
|
13
|
-
# Offense count: 4
|
14
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
15
|
-
Metrics/BlockLength:
|
16
|
-
Max: 35
|
17
|
-
Exclude:
|
18
|
-
- 'test/**/*.rb'
|
19
|
-
|
20
|
-
# Offense count: 3
|
21
|
-
Metrics/CyclomaticComplexity:
|
22
|
-
Max: 11
|
23
|
-
|
24
|
-
# Offense count: 89
|
25
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
26
|
-
# URISchemes: http, https
|
27
|
-
Metrics/LineLength:
|
28
|
-
Max: 362
|
29
|
-
|
30
|
-
# Offense count: 1
|
31
|
-
# Configuration parameters: CountComments.
|
32
|
-
Metrics/ModuleLength:
|
33
|
-
Max: 110
|
34
|
-
|
35
|
-
# Offense count: 3
|
36
|
-
Metrics/PerceivedComplexity:
|
37
|
-
Max: 11
|
38
|
-
|
39
|
-
# Offense count: 2
|
40
|
-
Rails/OutputSafety:
|
41
|
-
Exclude:
|
42
|
-
- 'app/helpers/concerns/foreman_expire_hosts/audits_helper_extensions.rb'
|
data/README.md
CHANGED
@@ -18,6 +18,7 @@ This plugin will send two warning notifications before host expiry (see Settings
|
|
18
18
|
| >= 1.16 | ~> 4.0 |
|
19
19
|
| >= 1.17 | ~> 5.0 |
|
20
20
|
| >= 1.18 | ~> 6.0 |
|
21
|
+
| >= 1.24 | ~> 7.0 |
|
21
22
|
|
22
23
|
# Screenshots
|
23
24
|
![Expiry date field in host form](https://raw.githubusercontent.com/ingenico-group/screenshots/master/foreman_host_expiry/expiry-date-field-in-host-form.png)
|
@@ -13,9 +13,6 @@ module ForemanExpireHosts
|
|
13
13
|
def select_multiple_expiration; end
|
14
14
|
|
15
15
|
def update_multiple_expiration
|
16
|
-
expiration_date = params[:host][:expired_on]
|
17
|
-
expiration_date = Date.parse(expiration_date) if expiration_date.present?
|
18
|
-
|
19
16
|
failed_hosts = {}
|
20
17
|
|
21
18
|
@hosts.each do |host|
|
@@ -50,15 +47,16 @@ module ForemanExpireHosts
|
|
50
47
|
private
|
51
48
|
|
52
49
|
def validate_multiple_expiration
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
50
|
+
expiration_date
|
51
|
+
rescue ArgumentError
|
52
|
+
error _('Invalid expiration date!')
|
53
|
+
redirect_to(hosts_path) && (return false)
|
54
|
+
end
|
55
|
+
|
56
|
+
def expiration_date
|
57
|
+
@expiration_date ||= begin
|
58
|
+
expiration_date_arr = params[:host].select { |k| k.start_with?('expired_on') }.values.map(&:to_i)
|
59
|
+
Date.new(*expiration_date_arr.reverse) unless expiration_date_arr.all?(&:zero?)
|
62
60
|
end
|
63
61
|
end
|
64
62
|
|
@@ -4,18 +4,6 @@ module ForemanExpireHosts
|
|
4
4
|
module HostsHelperExtensions
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
|
-
module Overrides
|
8
|
-
def multiple_actions
|
9
|
-
actions = super
|
10
|
-
actions << [_('Change Expiration'), select_multiple_expiration_hosts_path] if authorized_for(:controller => :hosts, :action => :select_multiple_expiration)
|
11
|
-
actions
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
included do
|
16
|
-
prepend Overrides
|
17
|
-
end
|
18
|
-
|
19
7
|
def host_expiry_warning_message(host)
|
20
8
|
return nil unless host.expires?
|
21
9
|
|
@@ -41,12 +29,10 @@ module ForemanExpireHosts
|
|
41
29
|
end
|
42
30
|
end
|
43
31
|
|
44
|
-
def datepicker_f(form, attr, options = {})
|
32
|
+
def datepicker_f(form, attr, options = {}, html_options = {})
|
45
33
|
field(form, attr, options) do
|
46
34
|
addClass options, 'form-control'
|
47
|
-
|
48
|
-
addon = input_group_addon('', :class => 'glyphicon glyphicon-calendar')
|
49
|
-
input_group date, addon
|
35
|
+
form.date_select(attr, options, html_options)
|
50
36
|
end
|
51
37
|
end
|
52
38
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ForemanExpireHosts
|
4
|
+
module HostsHelper
|
5
|
+
def expire_hosts_host_multiple_actions
|
6
|
+
actions = []
|
7
|
+
if authorized_for(:controller => :hosts, :action => :select_multiple_expiration)
|
8
|
+
actions << {
|
9
|
+
action: [_('Change Expiration'), select_multiple_expiration_hosts_path],
|
10
|
+
priority: 200
|
11
|
+
}
|
12
|
+
end
|
13
|
+
actions
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -15,7 +15,7 @@ module ForemanExpireHosts
|
|
15
15
|
# See https://community.theforeman.org/t/how-to-properly-destroy-a-content-host/8621
|
16
16
|
# for reasoning.
|
17
17
|
if subject.is_a?(Host::Base) && with_katello?
|
18
|
-
Katello::RegistrationManager.unregister_host(
|
18
|
+
Katello::RegistrationManager.unregister_host(subject)
|
19
19
|
else
|
20
20
|
subject.destroy!
|
21
21
|
end
|
@@ -48,7 +48,7 @@ module ForemanExpireHosts
|
|
48
48
|
|
49
49
|
def redeliver!
|
50
50
|
recipients = find_notification.notification_recipients
|
51
|
-
recipients.update_all(seen: false)
|
51
|
+
recipients.update_all(seen: false)
|
52
52
|
recipients.pluck(:user_id).each do |user_id|
|
53
53
|
::UINotifications::CacheHandler.new(user_id).clear
|
54
54
|
end
|
@@ -1,22 +1,13 @@
|
|
1
|
-
<% if @host.can_modify_expiry_date? %>
|
2
|
-
<%= stylesheet 'foreman_expire_hosts/application' %>
|
3
|
-
<%= javascript 'foreman_expire_hosts/application' %>
|
4
|
-
<% end %>
|
5
1
|
<%= datepicker_f f, :expired_on,
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
:help_block => ('<span class="pficon-warning-triangle-o"></span> '.html_safe + _('You are not allowed to change the expiry date of this host.') unless @host.can_modify_expiry_date?),
|
18
|
-
:readonly => !@host.can_modify_expiry_date?,
|
19
|
-
:help_inline => popover('Auto Expiry', _('Host will be deleted automatically on given expiry date.') + '<br>'.html_safe +
|
20
|
-
_('Leave blank to keep the host until deleted manually')),
|
21
|
-
:onfocus => 'append_shortcuts()'
|
2
|
+
{
|
3
|
+
:label => _('Expires on'),
|
4
|
+
:autocomplete => false,
|
5
|
+
:include_blank => true,
|
6
|
+
:use_month_numbers => false,
|
7
|
+
:start_year => Date.today.year,
|
8
|
+
:help_block => ('<span class="pficon-warning-triangle-o"></span> '.html_safe + _('You are not allowed to change the expiry date of this host.') unless @host.can_modify_expiry_date?),
|
9
|
+
:disabled => !@host.can_modify_expiry_date?,
|
10
|
+
:help_inline => popover('Auto Expiry', _('Host will be deleted automatically on the given expiry date.') + '<br>'.html_safe +
|
11
|
+
_('Leave blank to keep the host until deleted manually.'))
|
12
|
+
}
|
22
13
|
%>
|
@@ -1,23 +1,18 @@
|
|
1
|
-
<%= stylesheet 'foreman_expire_hosts/application' %>
|
2
|
-
<%= javascript 'foreman_expire_hosts/application' %>
|
3
1
|
<%= render 'selected_hosts', :hosts => @hosts %>
|
4
2
|
|
5
3
|
<%= form_for :host, :url => update_multiple_expiration_hosts_path(:host_ids => params[:host_ids]) do |f| %>
|
6
4
|
|
7
|
-
<%= _('
|
5
|
+
<%= _('Hosts will be deleted automatically on the given expiry date. Leave blank to clear expiration date.') %>
|
8
6
|
|
9
7
|
<%= datepicker_f f, :expired_on,
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
:autocomplete => false,
|
20
|
-
:placeholder => 'dd/mm/yyyy',
|
21
|
-
:onfocus => 'append_shortcuts()'
|
8
|
+
{
|
9
|
+
:autocomplete => false,
|
10
|
+
:include_blank => true,
|
11
|
+
:use_month_numbers => false,
|
12
|
+
:start_year => Date.today.year
|
13
|
+
},
|
14
|
+
{
|
15
|
+
:onchange => 'tfm.hosts.table.toggleMultipleOkButton(this);'
|
16
|
+
}
|
22
17
|
%>
|
23
18
|
<% end %>
|
@@ -20,9 +20,10 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
s.require_paths = ['lib']
|
22
22
|
|
23
|
-
s.add_dependency 'bootstrap-datepicker-rails'
|
24
23
|
s.add_dependency 'deface'
|
25
24
|
|
26
25
|
s.add_development_dependency 'rdoc'
|
27
|
-
s.add_development_dependency 'rubocop', '0.
|
26
|
+
s.add_development_dependency 'rubocop', '0.75.0'
|
27
|
+
s.add_development_dependency 'rubocop-performance'
|
28
|
+
s.add_development_dependency 'rubocop-rails', '~> 2.3.2'
|
28
29
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'deface'
|
4
|
-
require 'bootstrap-datepicker-rails'
|
5
4
|
|
6
5
|
module ForemanExpireHosts
|
7
6
|
class Engine < ::Rails::Engine
|
@@ -26,7 +25,7 @@ module ForemanExpireHosts
|
|
26
25
|
|
27
26
|
initializer 'foreman_expire_hosts.register_plugin', :before => :finisher_hook do |_app|
|
28
27
|
Foreman::Plugin.register :foreman_expire_hosts do
|
29
|
-
requires_foreman '>= 1.
|
28
|
+
requires_foreman '>= 1.24'
|
30
29
|
register_custom_status HostStatus::ExpirationStatus
|
31
30
|
|
32
31
|
# strong parameters
|
@@ -45,16 +44,20 @@ module ForemanExpireHosts
|
|
45
44
|
]
|
46
45
|
|
47
46
|
extend_rabl_template 'api/v2/hosts/main', 'api/v2/hosts/expiration'
|
47
|
+
|
48
|
+
describe_host do
|
49
|
+
multiple_actions_provider :expire_hosts_host_multiple_actions
|
50
|
+
end
|
48
51
|
end
|
49
52
|
end
|
50
53
|
|
51
54
|
config.to_prepare do
|
52
55
|
begin
|
53
|
-
Host::Managed.
|
54
|
-
HostsHelper.
|
55
|
-
HostsController.
|
56
|
-
AuditsHelper.
|
57
|
-
::Api::V2::HostsController.
|
56
|
+
Host::Managed.include ForemanExpireHosts::HostExt
|
57
|
+
HostsHelper.include ForemanExpireHosts::HostsHelperExtensions
|
58
|
+
HostsController.prepend ForemanExpireHosts::HostControllerExtensions
|
59
|
+
AuditsHelper.include ForemanExpireHosts::AuditsHelperExtensions
|
60
|
+
::Api::V2::HostsController.include ForemanExpireHosts::Api::V2::HostsControllerExtensions
|
58
61
|
rescue StandardError => e
|
59
62
|
Rails.logger.warn "ForemanExpireHosts: skipping engine hook (#{e})"
|
60
63
|
end
|
@@ -70,7 +70,7 @@ class HostsControllerTest < ActionController::TestCase
|
|
70
70
|
test 'should set expiration date' do
|
71
71
|
expiration_date = Date.today + 14
|
72
72
|
params = { :host_ids => @hosts.map(&:id),
|
73
|
-
:host => {
|
73
|
+
:host => { 'expired_on(1i)' => expiration_date.day.to_s, 'expired_on(2i)' => expiration_date.month.to_s, 'expired_on(3i)' => expiration_date.year.to_s } }
|
74
74
|
|
75
75
|
post :update_multiple_expiration, params: params, session: set_session_user.merge(:user => users(:admin).id)
|
76
76
|
|
@@ -4,6 +4,9 @@ require 'test_plugin_helper'
|
|
4
4
|
|
5
5
|
class HostsHelperTest < ActionView::TestCase
|
6
6
|
include HostsHelper
|
7
|
+
include HostDescriptionHelper
|
8
|
+
include PuppetRelatedHelper
|
9
|
+
include ForemanExpireHosts::HostsHelper
|
7
10
|
include ApplicationHelper
|
8
11
|
|
9
12
|
describe '#multiple_actions' do
|
@@ -169,7 +169,7 @@ class ExpireHostsNotificationsTest < ActiveSupport::TestCase
|
|
169
169
|
ExpireHostsNotifications.deliver_expiry_warning_notification
|
170
170
|
notification = Notification.find_by(notification_blueprint_id: blueprint.id, subject_id: hosts.first.id)
|
171
171
|
assert_not_nil notification
|
172
|
-
assert_equal 1, NotificationRecipient.where(notification_id: notification.id).update_all(seen: true)
|
172
|
+
assert_equal 1, NotificationRecipient.where(notification_id: notification.id).update_all(seen: true)
|
173
173
|
ExpireHostsNotifications.deliver_expiry_warning_notification
|
174
174
|
assert_equal 1, NotificationRecipient.where(notification_id: notification.id, seen: false).count
|
175
175
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_expire_hosts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nagarjuna Rachaneni
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: deface
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
@@ -26,13 +26,13 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: rdoc
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
|
-
type: :
|
35
|
+
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
@@ -40,7 +40,21 @@ dependencies:
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: rubocop
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.75.0
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.75.0
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rubocop-performance
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
45
59
|
requirements:
|
46
60
|
- - ">="
|
@@ -54,19 +68,19 @@ dependencies:
|
|
54
68
|
- !ruby/object:Gem::Version
|
55
69
|
version: '0'
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
|
-
name: rubocop
|
71
|
+
name: rubocop-rails
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
59
73
|
requirements:
|
60
|
-
- -
|
74
|
+
- - "~>"
|
61
75
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
76
|
+
version: 2.3.2
|
63
77
|
type: :development
|
64
78
|
prerelease: false
|
65
79
|
version_requirements: !ruby/object:Gem::Requirement
|
66
80
|
requirements:
|
67
|
-
- -
|
81
|
+
- - "~>"
|
68
82
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
83
|
+
version: 2.3.2
|
70
84
|
description: This Plugin will add new column expired_on to hosts to limit the lifetime
|
71
85
|
of a host.
|
72
86
|
email:
|
@@ -84,21 +98,18 @@ files:
|
|
84
98
|
- Gemfile
|
85
99
|
- LICENSE
|
86
100
|
- README.md
|
87
|
-
- app/assets/javascripts/foreman_expire_hosts/application.js
|
88
|
-
- app/assets/javascripts/foreman_expire_hosts/datepicker_for_host_expired_on_field.js
|
89
|
-
- app/assets/stylesheets/foreman_expire_hosts/application.scss
|
90
101
|
- app/controllers/concerns/foreman_expire_hosts/api/v2/hosts_controller_extensions.rb
|
91
102
|
- app/controllers/concerns/foreman_expire_hosts/host_controller_extensions.rb
|
92
103
|
- app/helpers/concerns/foreman_expire_hosts/audits_helper_extensions.rb
|
93
104
|
- app/helpers/concerns/foreman_expire_hosts/hosts_helper_extensions.rb
|
94
105
|
- app/helpers/expire_hosts_mailer_helper.rb
|
106
|
+
- app/helpers/foreman_expire_hosts/hosts_helper.rb
|
95
107
|
- app/mailers/expire_hosts_mailer.rb
|
96
108
|
- app/models/concerns/foreman_expire_hosts/host_ext.rb
|
97
109
|
- app/models/host_status/expiration_status.rb
|
98
110
|
- app/models/setting/expire_hosts.rb
|
99
111
|
- app/overrides/add_expired_on_field_to_host_form.rb
|
100
112
|
- app/overrides/add_expired_on_field_to_host_show.rb
|
101
|
-
- app/overrides/add_js_to_host_index.rb
|
102
113
|
- app/overrides/deleted_expired_host_comment_in_audits.rb
|
103
114
|
- app/services/foreman_expire_hosts/action/base.rb
|
104
115
|
- app/services/foreman_expire_hosts/action/delete_expired_hosts.rb
|
@@ -1,27 +0,0 @@
|
|
1
|
-
var shortcuts = {"1 day": 1, "1 week": 7, "1 month": 30, "1 year": 365, "3 days": 3, "3 weeks": 21, "3 months": 90};
|
2
|
-
function append_shortcuts() {
|
3
|
-
if ($(".datepicker-days #datepicker_shortcuts").length == 0) {
|
4
|
-
var shortcuts_html = "<div id='datepicker_shortcuts'><div>";
|
5
|
-
var shortcut_item = 1;
|
6
|
-
$.each(shortcuts, function (lable, days) {
|
7
|
-
var today = new Date();
|
8
|
-
today.setDate(today.getDate() + days);
|
9
|
-
if (shortcut_item == 5) {
|
10
|
-
shortcuts_html += "</div><div style='padding-top: 3px'>"
|
11
|
-
}
|
12
|
-
shortcuts_html += "<a style='width: 65px;' class='btn btn-default btn-xs' role='button' title='" + $.fn.datepicker.dates.en.monthsShort[today.getMonth()] + " " + today.getDate() + " " + today.getFullYear() + "' onclick='populate_date_from_days(" + days + ")'>" + lable + "</a> ";
|
13
|
-
shortcut_item += 1
|
14
|
-
});
|
15
|
-
shortcuts_html += "</div></div>";
|
16
|
-
$(".datepicker-days table").before(shortcuts_html)
|
17
|
-
}
|
18
|
-
}
|
19
|
-
|
20
|
-
function populate_date_from_days(shortcut_days) {
|
21
|
-
var today = new Date();
|
22
|
-
today.setDate(today.getDate() + shortcut_days);
|
23
|
-
$('#host_expired_on').datepicker('setDate', today);
|
24
|
-
$('#host_expired_on').datepicker('remove');
|
25
|
-
//$('#host_expired_on').val(today.getDate()+'/'+(today.getMonth()+1)+'/'+today.getFullYear())
|
26
|
-
//$('#host_expired_on').datepicker('hide')
|
27
|
-
}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Deface::Override.new(
|
4
|
-
:virtual_path => 'hosts/_list',
|
5
|
-
:name => 'host_list_expiration_js',
|
6
|
-
:insert_before => '#confirmation-modal',
|
7
|
-
:text => "<%= stylesheet 'foreman_expire_hosts/application' %><%= javascript 'foreman_expire_hosts/application' %>"
|
8
|
-
)
|