foreman_custom_tab 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/LICENSE +0 -0
- data/README.md +0 -0
- data/Rakefile +1 -1
- data/app/controllers/concerns/foreman_custom_tab/hosts_controller_extensions.rb +2 -2
- data/app/helpers/concerns/foreman_custom_tab/hosts_helper_extensions.rb +0 -0
- data/app/overrides/custom_tab_add_tab.rb +1 -1
- data/app/overrides/custom_tab_add_tab_link.rb +1 -1
- data/app/views/foreman_custom_tab/hosts/_custom_tab.html.erb +0 -0
- data/config/foreman_custom_tab.yaml.example +0 -0
- data/config/routes.rb +1 -1
- data/lib/foreman_custom_tab.rb +0 -0
- data/lib/foreman_custom_tab/engine.rb +5 -8
- data/lib/foreman_custom_tab/version.rb +1 -1
- data/lib/tasks/foreman_custom_tab_tasks.rake +1 -1
- data/locale/Makefile +0 -0
- data/locale/en/foreman_custom_tab.po +0 -0
- data/locale/foreman_custom_tab.pot +0 -0
- data/locale/gemspec.rb +0 -0
- data/test/functional/concerns/hosts_controller_extensions_test.rb +8 -8
- data/test/helpers/concerns/foreman_custom_tab/hosts_helper_extensions_test.rb +2 -2
- data/test/test_plugin_helper.rb +0 -0
- data/test/unit/foreman_custom_tab_test.rb +0 -0
- data/test/views/foreman_custom_tab/hosts/_custom_tab_test.rb +5 -5
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fab57529be3fc7afdc27762df54dce297ee7a05de2dbe7442d6928f2c0f46430
|
4
|
+
data.tar.gz: 89cbbe7c14ac0131f2c94b03f5bfcc46b37f4655e7416804276b3ab4be8a7b0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee289ad795f603726360ceec9f617b724dfcac053189206e33b61aa38288083b4402a211d5e64262e114903acbe6dc9cbd4f9d6088bd7ab5ddc80866fb5840b6
|
7
|
+
data.tar.gz: 9c15dc80e341818d98740c7b0b9c3a4b5d4a18a3206b187808359c7e7088d93388fbc6f2fac346361b765bbf5e1384d533a0f7891951d26b523efa51b6e8a8b5
|
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
@@ -8,8 +8,8 @@ module ForemanCustomTab
|
|
8
8
|
# it'll override the default find_resource filter.
|
9
9
|
find_resource
|
10
10
|
render :partial => 'foreman_custom_tab/hosts/custom_tab', :locals => { :host => @host }
|
11
|
-
rescue ActionView::Template::Error =>
|
12
|
-
process_ajax_error
|
11
|
+
rescue ActionView::Template::Error => e
|
12
|
+
process_ajax_error e, 'fetch custom tab information'
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
if SETTINGS[:custom_tab]
|
2
2
|
Deface::Override.new(:virtual_path => 'hosts/show',
|
3
3
|
:name => 'custom_tab_add_tab',
|
4
|
-
:insert_bottom => 'ul#
|
4
|
+
:insert_bottom => 'ul#host-show-tabs',
|
5
5
|
:text =>
|
6
6
|
"<li><a href='#custom_tab' data-toggle='tab'><%= _(custom_tab_title) %></a></li>")
|
7
7
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
if SETTINGS[:custom_tab]
|
2
2
|
Deface::Override.new(:virtual_path => 'hosts/show',
|
3
3
|
:name => 'custom_tab_add_tab_link',
|
4
|
-
:insert_bottom => 'div#
|
4
|
+
:insert_bottom => 'div#host-show-tabs-content',
|
5
5
|
:text =>
|
6
6
|
"\n <div id='custom_tab' class='tab-pane'
|
7
7
|
data-ajax-url='<%= custom_tab_host_path(@host)%>' data-on-complete='onContentLoad'>
|
File without changes
|
File without changes
|
data/config/routes.rb
CHANGED
data/lib/foreman_custom_tab.rb
CHANGED
File without changes
|
@@ -17,7 +17,7 @@ module ForemanCustomTab
|
|
17
17
|
# http://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin#Adding-permission
|
18
18
|
initializer('foreman_custom_tab.register_plugin', :before => :finisher_hook) do
|
19
19
|
Foreman::Plugin.register :foreman_custom_tab do
|
20
|
-
requires_foreman '>=
|
20
|
+
requires_foreman '>= 2.3'
|
21
21
|
|
22
22
|
security_block :foreman_custom_tab do
|
23
23
|
permission :view_custom_tab,
|
@@ -31,13 +31,10 @@ module ForemanCustomTab
|
|
31
31
|
# Include concerns in this config.to_prepare block
|
32
32
|
# http://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin#Extending-a-Controller
|
33
33
|
config.to_prepare do
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
rescue StandardError => e
|
39
|
-
Rails.logger.warn "ForemanCustomTab: skipping engine hook (#{e})"
|
40
|
-
end
|
34
|
+
HostsHelper.include ForemanCustomTab::HostsHelperExtensions
|
35
|
+
::HostsController.include ForemanCustomTab::HostsControllerExtensions
|
36
|
+
rescue StandardError => e
|
37
|
+
Rails.logger.warn "ForemanCustomTab: skipping engine hook (#{e})"
|
41
38
|
end
|
42
39
|
|
43
40
|
initializer 'foreman_custom_tab.register_gettext', after: :load_config_initializers do |_app|
|
data/locale/Makefile
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/locale/gemspec.rb
CHANGED
File without changes
|
@@ -4,24 +4,24 @@ class HostsControllerTest < ActionController::TestCase
|
|
4
4
|
let(:os) { FactoryBot.create(:operatingsystem, name: 'CentOS', major: '7', type: 'Redhat') }
|
5
5
|
let(:arch) { FactoryBot.create(:architecture) }
|
6
6
|
let(:host_id) { 'foreman.example.com' }
|
7
|
-
# rubocop:disable
|
7
|
+
# rubocop:disable Layout/LineLength
|
8
8
|
let(:host) { FactoryBot.create(:host, id: host_id, mac: '00:00:00:00:00:00', ip: '127.0.0.1', operatingsystem: os, arch: arch) }
|
9
|
-
# rubocop:enable
|
9
|
+
# rubocop:enable Layout/LineLength
|
10
10
|
let(:custom_tab_title) { SETTINGS[:custom_tab][:title] }
|
11
11
|
|
12
|
-
# rubocop:disable
|
12
|
+
# rubocop:disable Layout/LineLength, Style/StringLiterals, Rails/HttpPositionalArguments
|
13
13
|
test 'GET hosts/:id displays tabs' do
|
14
14
|
get :show, { :id => host.id }, set_session_user
|
15
15
|
assert_includes response.headers['Content-Type'], 'text/html'
|
16
16
|
assert_equal response.status, 200
|
17
|
-
assert_includes response.body, "ul id=\"
|
17
|
+
assert_includes response.body, "ul id=\"host-show-tabs\""
|
18
18
|
end
|
19
19
|
|
20
20
|
test "host overview displays tabs 'Properties', 'Metrics', 'NICs'" do
|
21
21
|
get :show, { :id => host.id }, set_session_user
|
22
22
|
assert_includes response.headers['Content-Type'], 'text/html'
|
23
23
|
assert_equal response.status, 200
|
24
|
-
assert_includes response.body, "<ul id=\"
|
24
|
+
assert_includes response.body, "<ul id=\"host-show-tabs\""
|
25
25
|
assert_includes response.body, "<li class=\"active\"><a href=\"#properties\" data-toggle=\"tab\">Properties</a></li>"
|
26
26
|
assert_includes response.body, "<li><a href=\"#metrics\" data-toggle=\"tab\">Metrics</a></li>"
|
27
27
|
assert_includes response.body, "<li><a href=\"#nics\" data-toggle=\"tab\">NICs</a></li>"
|
@@ -30,7 +30,7 @@ class HostsControllerTest < ActionController::TestCase
|
|
30
30
|
test "host overview displays the Custom Tab" do
|
31
31
|
get :show, { :id => host.id }, set_session_user
|
32
32
|
assert_includes response.headers['Content-Type'], 'text/html'
|
33
|
-
assert_includes response.body, "<ul id=\"
|
33
|
+
assert_includes response.body, "<ul id=\"host-show-tabs\""
|
34
34
|
assert_equal response.status, 200
|
35
35
|
assert_includes response.body, "<li><a href=\"#custom_tab\" data-toggle=\"tab\">#{custom_tab_title}</a></li>"
|
36
36
|
end
|
@@ -40,7 +40,7 @@ class HostsControllerTest < ActionController::TestCase
|
|
40
40
|
|
41
41
|
assert_equal response.status, 200
|
42
42
|
assert_includes response.headers['Content-Type'], 'text/html'
|
43
|
-
assert_includes response.body, "<ul id=\"
|
43
|
+
assert_includes response.body, "<ul id=\"host-show-tabs\""
|
44
44
|
assert_includes response.body, "<li><a href=\"#custom_tab\" data-toggle=\"tab\">#{custom_tab_title}</a></li>"
|
45
45
|
assert_includes response.body, "<div id=\"custom_tab\" class=\"tab-pane\" data-ajax-url=\"/hosts/#{host.name}/custom_tab\" data-on-complete=\"onContentLoad\">"
|
46
46
|
end
|
@@ -70,5 +70,5 @@ class HostsControllerTest < ActionController::TestCase
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
73
|
-
# rubocop:enable
|
73
|
+
# rubocop:enable Layout/LineLength, Style/StringLiterals, Rails/HttpPositionalArguments
|
74
74
|
end
|
@@ -5,9 +5,9 @@ class HostsHelperExtensionsTest < ActiveSupport::TestCase
|
|
5
5
|
|
6
6
|
let(:os) { FactoryBot.create(:operatingsystem, name: 'CentOS', major: '7', type: 'Redhat') }
|
7
7
|
let(:arch) { FactoryBot.create(:architecture) }
|
8
|
-
# rubocop:disable
|
8
|
+
# rubocop:disable Layout/LineLength
|
9
9
|
let(:host) { FactoryBot.create(:host, id: 'foreman.example.com', mac: '00:00:00:00:00:00', ip: '127.0.0.1', operatingsystem: os, arch: arch) }
|
10
|
-
# rubocop:enable
|
10
|
+
# rubocop:enable Layout/LineLength
|
11
11
|
let(:expected_fields) do
|
12
12
|
fields = []
|
13
13
|
SETTINGS[:custom_tab][:fields].each do |title, host_attr|
|
data/test/test_plugin_helper.rb
CHANGED
File without changes
|
File without changes
|
@@ -3,20 +3,20 @@ require 'test_plugin_helper'
|
|
3
3
|
class CustomTabTest < ActionView::TestCase
|
4
4
|
let(:os) { FactoryBot.create(:operatingsystem, name: 'CentOS', major: '7', type: 'Redhat') }
|
5
5
|
let(:arch) { FactoryBot.create(:architecture) }
|
6
|
-
# rubocop:disable
|
6
|
+
# rubocop:disable Layout/LineLength
|
7
7
|
let(:host) { FactoryBot.create(:host, id: 'foreman.example.com', mac: '00:00:00:00:00:00', ip: '127.0.0.1', operatingsystem: os, arch: arch) }
|
8
|
-
# rubocop:enable
|
8
|
+
# rubocop:enable Layout/LineLength
|
9
9
|
let(:custom_tab_title) { SETTINGS[:custom_tab][:title] }
|
10
10
|
|
11
|
-
class FakeHostsController <
|
11
|
+
class FakeHostsController < ApplicationController
|
12
12
|
include ForemanCustomTab::HostsHelperExtensions
|
13
13
|
include LayoutHelper
|
14
14
|
|
15
15
|
def index
|
16
16
|
os = FactoryBot.create(:operatingsystem, name: 'CentOS', major: '7', type: 'Redhat')
|
17
|
-
# rubocop:disable
|
17
|
+
# rubocop:disable Layout/LineLength
|
18
18
|
@host = FactoryBot.create(:host, id: 'foreman.example.com', mac: '00:00:00:00:00:00', ip: '127.0.0.1', operatingsystem: os, arch: FactoryBot.create(:architecture))
|
19
|
-
# rubocop:enable
|
19
|
+
# rubocop:enable Layout/LineLength
|
20
20
|
render :partial => 'foreman_custom_tab/hosts/custom_tab', :locals => { :host => @host }
|
21
21
|
end
|
22
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_custom_tab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Stannard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Foreman Plugin that makes a new tab with different fields depending on
|
42
56
|
the settings file
|
43
57
|
email:
|
@@ -81,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
95
|
requirements:
|
82
96
|
- - ">="
|
83
97
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
98
|
+
version: 2.5.0
|
85
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
@@ -89,13 +103,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
103
|
version: '0'
|
90
104
|
requirements: []
|
91
105
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.6
|
106
|
+
rubygems_version: 2.7.6
|
93
107
|
signing_key:
|
94
108
|
specification_version: 4
|
95
109
|
summary: Creates custom tab for hosts in Foreman
|
96
110
|
test_files:
|
97
|
-
- test/test_plugin_helper.rb
|
98
111
|
- test/functional/concerns/hosts_controller_extensions_test.rb
|
112
|
+
- test/helpers/concerns/foreman_custom_tab/hosts_helper_extensions_test.rb
|
113
|
+
- test/test_plugin_helper.rb
|
99
114
|
- test/unit/foreman_custom_tab_test.rb
|
100
115
|
- test/views/foreman_custom_tab/hosts/_custom_tab_test.rb
|
101
|
-
- test/helpers/concerns/foreman_custom_tab/hosts_helper_extensions_test.rb
|