foreman_rh_cloud 2.0.17 → 3.0.14
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 +4 -4
- data/README.md +0 -13
- data/app/helpers/foreman_inventory_upload_host_helper.rb +1 -8
- data/app/models/setting/rh_cloud.rb +5 -5
- data/lib/foreman_inventory_upload.rb +1 -1
- data/lib/foreman_inventory_upload/generators/archived_report.rb +1 -1
- data/lib/foreman_inventory_upload/generators/slice.rb +3 -3
- data/lib/foreman_rh_cloud/engine.rb +4 -2
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/tasks/rh_cloud_inventory.rake +0 -23
- data/package.json +1 -1
- data/test/unit/slice_generator_test.rb +3 -29
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/InventoryAutoUpload.js +92 -0
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/InventoryAutoUpload.test.js +17 -0
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/__snapshots__/InventoryAutoUpload.test.js.snap +106 -0
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/components/AdvancedSettings/AdvancedSettings.js +60 -0
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/components/AdvancedSettings/index.js +28 -0
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/index.js +22 -0
- data/webpack/ForemanRhCloudFills.js +23 -0
- data/webpack/ForemanRhCloudPages.js +6 -1
- data/webpack/ForemanRhCloudReducers.js +10 -1
- data/webpack/InsightsHostDetailsTab/InsightsTab.js +5 -7
- data/webpack/InsightsHostDetailsTab/__tests__/InsightsTab.fixtures.js +12 -14
- data/webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTabActions.test.js.snap +10 -12
- data/webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTabReducer.test.js.snap +10 -12
- data/webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTabSelectors.test.js.snap +10 -12
- data/webpack/__mocks__/foremanReact/common/MountingService.js +1 -0
- data/webpack/common/Switcher/index.js +79 -0
- data/webpack/global_index.js +5 -0
- data/webpack/index.js +4 -14
- metadata +25 -20
- data/config/Gemfile.lock.gh_test +0 -815
- data/config/database.yml.example +0 -17
- data/config/package-lock.json.gh_test +0 -36317
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/SubscriptionsPageExtensionActions.js +0 -34
- data/webpack/subscriptions_extension_index.js +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b0882515e038d95959e1926b002f3caebb0b38ed0bd05951208d33cea7748ae
|
|
4
|
+
data.tar.gz: 29d8594297d6c4ed6936d568c7c7a8547186ab7390d03b81448cc5c563f5031d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 71d58183a48ca30f148138bb036ba0cd7bea80dd1ce087b13605e884b763035b674207f91c359f193d658211f2e742f54b2f7e4fadac3f7bc723eb10dbd85f6e
|
|
7
|
+
data.tar.gz: ef3740403be8ab6cc6bb2848666833b424b41cabbc7fac78b06af573db3e59cfed40b01dad2deb88d3bfcba6b8ef86a5c7fe16f8dc48d6b68e821d8f5f2c3ddf
|
data/README.md
CHANGED
|
@@ -19,23 +19,10 @@ In UI: Configure -> Inventory Upload -> Restart
|
|
|
19
19
|
|
|
20
20
|
From command-line:
|
|
21
21
|
|
|
22
|
-
# generate and upload report for all organizations
|
|
23
|
-
/usr/sbin/foreman-rake rh_cloud_inventory:report:generate_upload
|
|
24
|
-
|
|
25
|
-
# generate and upload report for specific organization
|
|
26
|
-
export organization_id=1
|
|
27
|
-
/usr/sbin/foreman-rake rh_cloud_inventory:report:generate_upload
|
|
28
|
-
|
|
29
|
-
# generate report for specific organization (don't upload)
|
|
30
22
|
export organization_id=1
|
|
31
23
|
export target=/var/lib/foreman/red_hat_inventory/generated_reports/
|
|
32
24
|
/usr/sbin/foreman-rake rh_cloud_inventory:report:generate
|
|
33
25
|
|
|
34
|
-
# upload previously generated report (needs to be named 'report_for_#{organization_id}.tar.gz')
|
|
35
|
-
export organization_id=1
|
|
36
|
-
export target=/var/lib/foreman/red_hat_inventory/generated_reports/
|
|
37
|
-
/usr/sbin/foreman-rake rh_cloud_inventory:report:upload
|
|
38
|
-
|
|
39
26
|
#### Fetch hosts remediation data
|
|
40
27
|
|
|
41
28
|
In UI: Configure -> Insights -> Sync now
|
|
@@ -6,14 +6,7 @@ module ForemanInventoryUploadHostHelper
|
|
|
6
6
|
def hits_counts_cell(host)
|
|
7
7
|
host_hits = hits_counts[host.id]
|
|
8
8
|
tag.td class: ['hidden-xs', 'ellipsis', 'text-center'] do
|
|
9
|
-
if host_hits
|
|
10
|
-
link_to(
|
|
11
|
-
host_hits,
|
|
12
|
-
InsightsCloud::WebUi.system_url(InsightsCloud::WebUi::ADVISOR, host.insights.uuid),
|
|
13
|
-
:rel => 'external noopener noreferrer',
|
|
14
|
-
:target => '_blank'
|
|
15
|
-
)
|
|
16
|
-
end
|
|
9
|
+
link_to(host_hits, "#{host_path(host)}#insights") if host_hits
|
|
17
10
|
end
|
|
18
11
|
end
|
|
19
12
|
end
|
|
@@ -3,12 +3,12 @@ class Setting::RhCloud < Setting
|
|
|
3
3
|
return unless ActiveRecord::Base.connection.table_exists?('settings')
|
|
4
4
|
return unless super
|
|
5
5
|
[
|
|
6
|
-
set('allow_auto_inventory_upload', N_('Allow automatic upload of the host inventory to the Red Hat cloud'), false
|
|
7
|
-
set('allow_auto_insights_sync', N_('Allow recommendations synchronization from Red Hat cloud'), false
|
|
8
|
-
set('obfuscate_inventory_hostnames', N_('Obfuscate host names sent to Red Hat cloud'), false
|
|
9
|
-
set('obfuscate_inventory_ips', N_('Obfuscate ip addresses sent to Red Hat cloud'), false
|
|
6
|
+
set('allow_auto_inventory_upload', N_('Allow automatic upload of the host inventory to the Red Hat cloud'), false),
|
|
7
|
+
set('allow_auto_insights_sync', N_('Allow recommendations synchronization from Red Hat cloud'), false),
|
|
8
|
+
set('obfuscate_inventory_hostnames', N_('Obfuscate host names sent to Red Hat cloud'), false),
|
|
9
|
+
set('obfuscate_inventory_ips', N_('Obfuscate ip addresses sent to Red Hat cloud'), false),
|
|
10
10
|
set('rh_cloud_token', N_('Authentication token to Red Hat cloud services. Used to authenticate requests to cloud APIs'), 'DEFAULT', N_('Red Hat Cloud token'), nil, encrypted: true),
|
|
11
|
-
set('exclude_installed_packages', N_('Exclude installed packages from Red Hat cloud inventory report'), false
|
|
11
|
+
set('exclude_installed_packages', N_('Exclude installed packages from Red Hat cloud inventory report'), false),
|
|
12
12
|
]
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -28,7 +28,7 @@ module ForemanInventoryUpload
|
|
|
28
28
|
|
|
29
29
|
@logger.info 'Archiving generated report'
|
|
30
30
|
# success = system('tar', '-zcvf', @target, '-C', tmpdir, '.')
|
|
31
|
-
Open3.popen2e('tar', '-
|
|
31
|
+
Open3.popen2e('tar', '-zcvf', @target, '-C', tmpdir, '.') do |_in, out, wait_thr|
|
|
32
32
|
@logger.info("tar: #{out.read}")
|
|
33
33
|
|
|
34
34
|
if wait_thr.value.success?
|
|
@@ -103,10 +103,10 @@ module ForemanInventoryUpload
|
|
|
103
103
|
@stream.simple_field('cores_per_socket', fact_value(host, 'cpu::core(s)_per_socket')) { |v| v.to_i }
|
|
104
104
|
@stream.simple_field('system_memory_bytes', fact_value(host, 'memory::memtotal')) { |v| kilobytes_to_bytes(v.to_i) }
|
|
105
105
|
@stream.array_field('network_interfaces') do
|
|
106
|
-
@stream.raw(host.interfaces.
|
|
106
|
+
@stream.raw(host.interfaces.map do |nic|
|
|
107
107
|
{
|
|
108
|
-
'ipv4_addresses': [host_ips_cache[nic.ip]].
|
|
109
|
-
'ipv6_addresses': [nic.ip6].
|
|
108
|
+
'ipv4_addresses': [host_ips_cache[nic.ip]].compact,
|
|
109
|
+
'ipv6_addresses': [nic.ip6].compact,
|
|
110
110
|
'mtu': nic.try(:mtu) && nic.mtu.to_i,
|
|
111
111
|
'mac_address': nic.mac,
|
|
112
112
|
'name': nic.identifier,
|
|
@@ -27,7 +27,7 @@ module ForemanRhCloud
|
|
|
27
27
|
|
|
28
28
|
initializer 'foreman_rh_cloud.register_plugin', :before => :finisher_hook do |_app|
|
|
29
29
|
Foreman::Plugin.register :foreman_rh_cloud do
|
|
30
|
-
requires_foreman '
|
|
30
|
+
requires_foreman '>= 2.3'
|
|
31
31
|
|
|
32
32
|
# Add permissions
|
|
33
33
|
security_block :foreman_rh_cloud do
|
|
@@ -64,7 +64,7 @@ module ForemanRhCloud
|
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
register_global_js_file '
|
|
67
|
+
register_global_js_file 'global'
|
|
68
68
|
|
|
69
69
|
register_custom_status(InventorySync::InventoryStatus)
|
|
70
70
|
|
|
@@ -72,6 +72,7 @@ module ForemanRhCloud
|
|
|
72
72
|
context.add_pagelet :main_tabs,
|
|
73
73
|
partial: 'hosts/insights_tab',
|
|
74
74
|
name: _('Insights'),
|
|
75
|
+
id: 'insights',
|
|
75
76
|
onlyif: proc { |host| host.insights }
|
|
76
77
|
end
|
|
77
78
|
end
|
|
@@ -79,6 +80,7 @@ module ForemanRhCloud
|
|
|
79
80
|
::Katello::UINotifications::Subscriptions::ManifestImportSuccess.include ForemanInventoryUpload::Notifications::ManifestImportSuccessNotificationOverride if defined?(Katello)
|
|
80
81
|
|
|
81
82
|
::Host::Managed.include RhCloudHost
|
|
83
|
+
::Host::Base.include RhCloudHost
|
|
82
84
|
end
|
|
83
85
|
|
|
84
86
|
initializer "foreman_rh_cloud.set_dynflow.config.on_init", :before => :finisher_hook do |_app|
|
|
@@ -2,21 +2,6 @@ require 'tempfile'
|
|
|
2
2
|
|
|
3
3
|
namespace :rh_cloud_inventory do
|
|
4
4
|
namespace :report do
|
|
5
|
-
desc 'Generate inventory report and send it to Red Hat cloud'
|
|
6
|
-
task generate_upload: [:environment, 'dynflow:client'] do
|
|
7
|
-
unless ENV['organization_id'].nil?
|
|
8
|
-
organizations = [ Organization.where(:id => ENV['organization_id']).first ]
|
|
9
|
-
else
|
|
10
|
-
organizations = Organization.unscoped.all
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
User.as_anonymous_admin do
|
|
14
|
-
organizations.each do |organization|
|
|
15
|
-
ForemanInventoryUpload::Async::GenerateReportJob.perform_now(ForemanInventoryUpload.generated_reports_folder, organization.id)
|
|
16
|
-
puts "Generated and uploaded inventory report for organization '#{organization.name}'"
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
5
|
desc 'Generate inventory report to be sent to Red Hat cloud'
|
|
21
6
|
task generate: :environment do
|
|
22
7
|
portal_user = ENV['portal_user']
|
|
@@ -42,14 +27,6 @@ namespace :rh_cloud_inventory do
|
|
|
42
27
|
end
|
|
43
28
|
end
|
|
44
29
|
end
|
|
45
|
-
desc 'Upload generated inventory report to Red Hat cloud'
|
|
46
|
-
task upload: [:environment, 'dynflow:client'] do
|
|
47
|
-
base_folder = ENV['target'] || ForemanInventoryUpload.generated_reports_folder
|
|
48
|
-
organization_id = ENV['organization_id']
|
|
49
|
-
report_file = ForemanInventoryUpload.facts_archive_name(organization_id)
|
|
50
|
-
ForemanInventoryUpload::Async::QueueForUploadJob.perform_now(base_folder, report_file, organization_id)
|
|
51
|
-
puts "Uploaded #{report_file}"
|
|
52
|
-
end
|
|
53
30
|
end
|
|
54
31
|
|
|
55
32
|
desc "Synchronize Insights hosts hits"
|
data/package.json
CHANGED
|
@@ -18,8 +18,6 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
@host.organization.pools << FactoryBot.create(:katello_pool, account_number: '1234', cp_id: 1)
|
|
21
|
-
@host.interfaces.first.identifier = 'test_nic1'
|
|
22
|
-
@host.save!
|
|
23
21
|
|
|
24
22
|
ForemanInventoryUpload::Generators::Queries.instance_variable_set(:@fact_names, nil)
|
|
25
23
|
end
|
|
@@ -83,7 +81,7 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
|
83
81
|
assert_not_nil(actual_nic = actual_network_interfaces.first)
|
|
84
82
|
refute actual_nic.key?('mtu')
|
|
85
83
|
refute actual_nic.key?('mac_address')
|
|
86
|
-
|
|
84
|
+
refute actual_nic.key?('name')
|
|
87
85
|
end
|
|
88
86
|
|
|
89
87
|
test 'hosts report fields should be present if fact exist' do
|
|
@@ -125,10 +123,8 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
|
125
123
|
end
|
|
126
124
|
|
|
127
125
|
test 'generates nic fields' do
|
|
128
|
-
empty_nic = FactoryBot.build(:nic_managed, ip6: '', identifier: 'empty_nic')
|
|
129
|
-
@host.interfaces << empty_nic
|
|
130
126
|
ip6 = Array.new(4) { '%x' % rand(16**4) }.join(':') + '::' + '5'
|
|
131
|
-
nic = FactoryBot.build(:nic_managed, ip6: ip6
|
|
127
|
+
nic = FactoryBot.build(:nic_managed, ip6: ip6)
|
|
132
128
|
nic.attrs['mtu'] = '1500'
|
|
133
129
|
@host.interfaces << nic
|
|
134
130
|
batch = Host.where(id: @host.id).in_batches.first
|
|
@@ -143,9 +139,7 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
|
143
139
|
assert_equal @host.interfaces.where.not(mac: nil).first.mac, actual_host['mac_addresses'].first
|
|
144
140
|
assert_not_nil(actual_system_profile = actual_host['system_profile'])
|
|
145
141
|
assert_not_nil(actual_network_interfaces = actual_system_profile['network_interfaces'])
|
|
146
|
-
assert_not_nil(
|
|
147
|
-
assert actual_empty_nic['ipv6_addresses'].empty?
|
|
148
|
-
assert_not_nil(actual_nic = actual_network_interfaces.find { |actual_nic| actual_nic['name'] == 'good_nic' })
|
|
142
|
+
assert_not_nil(actual_nic = actual_network_interfaces.first)
|
|
149
143
|
assert_equal nic.ip, actual_nic['ipv4_addresses'].first
|
|
150
144
|
assert_equal nic.ip6, actual_nic['ipv6_addresses'].first
|
|
151
145
|
assert_equal 1500, actual_nic['mtu']
|
|
@@ -156,26 +150,6 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
|
156
150
|
assert_equal 1, generator.hosts_count
|
|
157
151
|
end
|
|
158
152
|
|
|
159
|
-
test 'skips nameless nics' do
|
|
160
|
-
ip6 = Array.new(4) { '%x' % rand(16**4) }.join(':') + '::' + '5'
|
|
161
|
-
nic = FactoryBot.build(:nic_managed, ip6: ip6, identifier: '')
|
|
162
|
-
nic.attrs['mtu'] = '1500'
|
|
163
|
-
@host.interfaces << nic
|
|
164
|
-
batch = Host.where(id: @host.id).in_batches.first
|
|
165
|
-
generator = create_generator(batch)
|
|
166
|
-
|
|
167
|
-
json_str = generator.render
|
|
168
|
-
actual = JSON.parse(json_str.join("\n"))
|
|
169
|
-
|
|
170
|
-
assert_equal 'slice_123', actual['report_slice_id']
|
|
171
|
-
assert_not_nil(actual_host = actual['hosts'].first)
|
|
172
|
-
assert_equal @host.interfaces.where.not(ip: nil).first.ip, actual_host['ip_addresses'].first
|
|
173
|
-
assert_equal @host.interfaces.where.not(mac: nil).first.mac, actual_host['mac_addresses'].first
|
|
174
|
-
assert_not_nil(actual_system_profile = actual_host['system_profile'])
|
|
175
|
-
assert_not_nil(actual_network_interfaces = actual_system_profile['network_interfaces'])
|
|
176
|
-
assert_nil actual_network_interfaces.find { |actual_nic| actual_nic['name'].empty? }
|
|
177
|
-
end
|
|
178
|
-
|
|
179
153
|
test 'generates obfuscated ip_address fields without inisghts-client' do
|
|
180
154
|
FactoryBot.create(:setting, :name => 'obfuscate_inventory_ips', :value => true)
|
|
181
155
|
|
|
@@ -9,7 +9,7 @@ const AutoUploadSwitcher = ({ autoUploadEnabled, handleToggle }) => (
|
|
|
9
9
|
<span>Auto upload</span>
|
|
10
10
|
<FieldLevelHelp
|
|
11
11
|
content={__(
|
|
12
|
-
'Enable automatic upload of your
|
|
12
|
+
'Enable automatic upload of your hosts inventory to the Red Hat cloud'
|
|
13
13
|
)}
|
|
14
14
|
/>
|
|
15
15
|
<Switch
|
|
@@ -9,7 +9,7 @@ exports[`AutoUploadSwitcher rendering render with props 1`] = `
|
|
|
9
9
|
</span>
|
|
10
10
|
<FieldLevelHelp
|
|
11
11
|
buttonClass=""
|
|
12
|
-
content="Enable automatic upload of your
|
|
12
|
+
content="Enable automatic upload of your hosts inventory to the Red Hat cloud"
|
|
13
13
|
placement="top"
|
|
14
14
|
rootClose={true}
|
|
15
15
|
/>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Text, TextVariants, Popover, Button } from '@patternfly/react-core';
|
|
4
|
+
import { InfoAltIcon, CaretRightIcon } from '@patternfly/react-icons';
|
|
5
|
+
import { FormGroup, Grid } from 'patternfly-react';
|
|
6
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
|
7
|
+
import { foremanUrl } from '../../../ForemanRhCloudHelpers';
|
|
8
|
+
import Switcher from '../../../common/Switcher';
|
|
9
|
+
import AdvancedSettings from './components/AdvancedSettings';
|
|
10
|
+
|
|
11
|
+
const InventoryAutoUploadSwitcher = ({
|
|
12
|
+
autoUploadEnabled,
|
|
13
|
+
handleToggle,
|
|
14
|
+
fetchSettings,
|
|
15
|
+
}) => {
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
fetchSettings();
|
|
18
|
+
}, [fetchSettings]);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<FormGroup>
|
|
22
|
+
<Grid>
|
|
23
|
+
<h3>{__('Red Hat Cloud Inventory')}</h3>
|
|
24
|
+
<hr />
|
|
25
|
+
<Grid.Row>
|
|
26
|
+
<Switcher
|
|
27
|
+
id="auto-upload"
|
|
28
|
+
label={__('Inventory Auto Upload')}
|
|
29
|
+
tooltip={__(
|
|
30
|
+
'Enable automatic upload of your hosts inventory to the Red Hat cloud'
|
|
31
|
+
)}
|
|
32
|
+
isChecked={autoUploadEnabled}
|
|
33
|
+
onChange={() => handleToggle(autoUploadEnabled)}
|
|
34
|
+
labelCol={5}
|
|
35
|
+
/>
|
|
36
|
+
|
|
37
|
+
<Grid.Col sm={5}>
|
|
38
|
+
<Popover
|
|
39
|
+
headerContent={<strong>Advanced Inventory Settings</strong>}
|
|
40
|
+
bodyContent={
|
|
41
|
+
<AdvancedSettings
|
|
42
|
+
autoUploadEnabled={autoUploadEnabled}
|
|
43
|
+
handleToggle={handleToggle}
|
|
44
|
+
/>
|
|
45
|
+
}
|
|
46
|
+
position="right"
|
|
47
|
+
>
|
|
48
|
+
<Button
|
|
49
|
+
variant="secondary"
|
|
50
|
+
style={{ fontSize: 'small', marginTop: '-4px' }}
|
|
51
|
+
>
|
|
52
|
+
{__('Show Advanced Settings')} <CaretRightIcon />
|
|
53
|
+
</Button>
|
|
54
|
+
</Popover>
|
|
55
|
+
</Grid.Col>
|
|
56
|
+
</Grid.Row>
|
|
57
|
+
<br />
|
|
58
|
+
<Grid.Row>
|
|
59
|
+
<Grid.Col sm={12}>
|
|
60
|
+
<Text component={TextVariants.p}>
|
|
61
|
+
<InfoAltIcon /> {__('More details can be found in')}{' '}
|
|
62
|
+
<Text
|
|
63
|
+
component={TextVariants.a}
|
|
64
|
+
href={foremanUrl('/foreman_rh_cloud/inventory_upload')}
|
|
65
|
+
target="_blank"
|
|
66
|
+
rel="noopener noreferrer"
|
|
67
|
+
>
|
|
68
|
+
<strong>
|
|
69
|
+
{__('Configure')}
|
|
70
|
+
{' > '}
|
|
71
|
+
{__('Inventory Upload')}
|
|
72
|
+
</strong>
|
|
73
|
+
</Text>
|
|
74
|
+
</Text>
|
|
75
|
+
</Grid.Col>
|
|
76
|
+
</Grid.Row>
|
|
77
|
+
</Grid>
|
|
78
|
+
</FormGroup>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
InventoryAutoUploadSwitcher.propTypes = {
|
|
83
|
+
autoUploadEnabled: PropTypes.bool,
|
|
84
|
+
handleToggle: PropTypes.func.isRequired,
|
|
85
|
+
fetchSettings: PropTypes.func.isRequired,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
InventoryAutoUploadSwitcher.defaultProps = {
|
|
89
|
+
autoUploadEnabled: true,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default InventoryAutoUploadSwitcher;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
2
|
+
import { noop } from 'patternfly-react';
|
|
3
|
+
|
|
4
|
+
import InventoryAutoUpload from '../InventoryAutoUpload';
|
|
5
|
+
|
|
6
|
+
const fixtures = {
|
|
7
|
+
'render with props': {
|
|
8
|
+
autoUploadEnabled: true,
|
|
9
|
+
handleToggle: noop,
|
|
10
|
+
fetchSettings: noop,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
describe('InventoryAutoUpload', () => {
|
|
15
|
+
describe('rendering', () =>
|
|
16
|
+
testComponentSnapshotsWithFixtures(InventoryAutoUpload, fixtures));
|
|
17
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`InventoryAutoUpload rendering render with props 1`] = `
|
|
4
|
+
<FormGroup
|
|
5
|
+
bsClass="form-group"
|
|
6
|
+
>
|
|
7
|
+
<Grid
|
|
8
|
+
bsClass="container"
|
|
9
|
+
componentClass="div"
|
|
10
|
+
fluid={false}
|
|
11
|
+
>
|
|
12
|
+
<h3>
|
|
13
|
+
Red Hat Cloud Inventory
|
|
14
|
+
</h3>
|
|
15
|
+
<hr />
|
|
16
|
+
<Row
|
|
17
|
+
bsClass="row"
|
|
18
|
+
componentClass="div"
|
|
19
|
+
>
|
|
20
|
+
<Switcher
|
|
21
|
+
SwitchCol={2}
|
|
22
|
+
id="auto-upload"
|
|
23
|
+
isChecked={true}
|
|
24
|
+
label="Inventory Auto Upload"
|
|
25
|
+
labelCol={5}
|
|
26
|
+
onChange={[Function]}
|
|
27
|
+
tooltip="Enable automatic upload of your hosts inventory to the Red Hat cloud"
|
|
28
|
+
/>
|
|
29
|
+
<Col
|
|
30
|
+
bsClass="col"
|
|
31
|
+
componentClass="div"
|
|
32
|
+
sm={5}
|
|
33
|
+
>
|
|
34
|
+
<Popover
|
|
35
|
+
bodyContent={
|
|
36
|
+
<UNDEFINED
|
|
37
|
+
autoUploadEnabled={true}
|
|
38
|
+
handleToggle={[Function]}
|
|
39
|
+
/>
|
|
40
|
+
}
|
|
41
|
+
headerContent={
|
|
42
|
+
<strong>
|
|
43
|
+
Advanced Inventory Settings
|
|
44
|
+
</strong>
|
|
45
|
+
}
|
|
46
|
+
position="right"
|
|
47
|
+
>
|
|
48
|
+
<Button
|
|
49
|
+
style={
|
|
50
|
+
Object {
|
|
51
|
+
"fontSize": "small",
|
|
52
|
+
"marginTop": "-4px",
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
variant="secondary"
|
|
56
|
+
>
|
|
57
|
+
Show Advanced Settings
|
|
58
|
+
|
|
59
|
+
<CaretRightIcon
|
|
60
|
+
color="currentColor"
|
|
61
|
+
noVerticalAlign={false}
|
|
62
|
+
size="sm"
|
|
63
|
+
/>
|
|
64
|
+
</Button>
|
|
65
|
+
</Popover>
|
|
66
|
+
</Col>
|
|
67
|
+
</Row>
|
|
68
|
+
<br />
|
|
69
|
+
<Row
|
|
70
|
+
bsClass="row"
|
|
71
|
+
componentClass="div"
|
|
72
|
+
>
|
|
73
|
+
<Col
|
|
74
|
+
bsClass="col"
|
|
75
|
+
componentClass="div"
|
|
76
|
+
sm={12}
|
|
77
|
+
>
|
|
78
|
+
<Text
|
|
79
|
+
component="p"
|
|
80
|
+
>
|
|
81
|
+
<InfoAltIcon
|
|
82
|
+
color="currentColor"
|
|
83
|
+
noVerticalAlign={false}
|
|
84
|
+
size="sm"
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
More details can be found in
|
|
88
|
+
|
|
89
|
+
<Text
|
|
90
|
+
component="a"
|
|
91
|
+
href="/foreman_rh_cloud/inventory_upload"
|
|
92
|
+
rel="noopener noreferrer"
|
|
93
|
+
target="_blank"
|
|
94
|
+
>
|
|
95
|
+
<strong>
|
|
96
|
+
Configure
|
|
97
|
+
>
|
|
98
|
+
Inventory Upload
|
|
99
|
+
</strong>
|
|
100
|
+
</Text>
|
|
101
|
+
</Text>
|
|
102
|
+
</Col>
|
|
103
|
+
</Row>
|
|
104
|
+
</Grid>
|
|
105
|
+
</FormGroup>
|
|
106
|
+
`;
|