foreman_rh_cloud 12.2.17 → 13.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 +4 -4
- data/app/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +24 -78
- data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +24 -78
- data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +23 -77
- data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +23 -77
- data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +23 -77
- data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +3 -5
- data/app/controllers/foreman_inventory_upload/accounts_controller.rb +1 -1
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +1 -1
- data/app/controllers/insights_cloud/ui_requests_controller.rb +3 -2
- data/app/models/concerns/rh_cloud_host.rb +1 -45
- data/app/models/foreman_rh_cloud/ping.rb +1 -2
- data/app/models/insights_hit.rb +1 -1
- data/app/services/foreman_rh_cloud/cert_auth.rb +3 -13
- data/app/services/foreman_rh_cloud/gateway_request.rb +26 -0
- data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +1 -3
- data/app/services/foreman_rh_cloud/tags_auth.rb +4 -15
- data/app/views/api/v2/advisor_engine/host_details.json.rabl +3 -1
- data/app/views/api/v2/hosts/insights/base.rabl +2 -3
- data/lib/foreman_inventory_upload/async/generate_report_job.rb +8 -13
- data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +26 -4
- data/lib/foreman_inventory_upload/async/upload_report_job.rb +96 -0
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +2 -2
- data/lib/foreman_inventory_upload/generators/slice.rb +3 -3
- data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +49 -0
- data/lib/foreman_inventory_upload.rb +6 -6
- data/lib/foreman_rh_cloud/engine.rb +15 -34
- data/lib/foreman_rh_cloud/plugin.rb +13 -20
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/foreman_rh_cloud.rb +3 -3
- data/lib/insights_cloud/async/connector_playbook_execution_reporter_task.rb +3 -3
- data/lib/inventory_sync/async/inventory_hosts_sync.rb +2 -0
- data/lib/tasks/rh_cloud_inventory.rake +31 -14
- data/locale/foreman_rh_cloud.pot +157 -261
- data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/fr/foreman_rh_cloud.po +26 -79
- data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ja/foreman_rh_cloud.po +26 -79
- data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ka/foreman_rh_cloud.po +24 -77
- data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ko/foreman_rh_cloud.po +25 -78
- data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/zh_CN/foreman_rh_cloud.po +25 -78
- data/package.json +1 -1
- data/test/controllers/accounts_controller_test.rb +1 -1
- data/test/controllers/insights_cloud/api/advisor_engine_controller_test.rb +1 -28
- data/test/controllers/insights_cloud/ui_requests_controller_test.rb +0 -26
- data/test/controllers/uploads_controller_test.rb +1 -1
- data/test/factories/insights_factories.rb +0 -29
- data/test/jobs/cloud_connector_announce_task_test.rb +2 -3
- data/test/jobs/connector_playbook_execution_reporter_task_test.rb +20 -32
- data/test/jobs/exponential_backoff_test.rb +8 -9
- data/test/jobs/insights_client_status_aging_test.rb +2 -3
- data/test/jobs/insights_full_sync_test.rb +7 -13
- data/test/jobs/insights_resolutions_sync_test.rb +5 -9
- data/test/jobs/insights_rules_sync_test.rb +3 -5
- data/test/jobs/inventory_full_sync_test.rb +5 -9
- data/test/jobs/inventory_hosts_sync_test.rb +6 -11
- data/test/jobs/inventory_scheduled_sync_test.rb +6 -10
- data/test/jobs/inventory_self_host_sync_test.rb +1 -1
- data/test/jobs/remove_insights_hosts_job_test.rb +15 -14
- data/test/jobs/upload_report_job_test.rb +36 -0
- data/test/unit/fact_helpers_test.rb +0 -47
- data/test/unit/services/foreman_rh_cloud/tags_auth_test.rb +0 -14
- data/test/unit/slice_generator_test.rb +0 -57
- data/webpack/ForemanColumnExtensions/index.js +0 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +17 -24
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js +8 -178
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +36 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +1 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/ToolbarButtons.test.js +51 -69
- data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +1 -1
- data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryHelpers.test.js.snap +1 -1
- data/webpack/ForemanRhCloudFills.js +2 -6
- data/webpack/ForemanRhCloudHelpers.js +0 -4
- data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettings.js +3 -3
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +9 -3
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js +4 -24
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +112 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +2 -2
- data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +3 -3
- data/webpack/InsightsCloudSync/InsightsCloudSync.js +3 -3
- data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +0 -10
- data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +1 -1
- data/webpack/InsightsHostDetailsTab/InsightsTab.scss +0 -4
- data/webpack/InsightsHostDetailsTab/InsightsTotalRiskChart.js +23 -59
- data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +23 -25
- data/webpack/InsightsVulnerabilityHostIndexExtensions/CVECountCell.js +2 -8
- data/webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js +4 -105
- data/webpack/__mocks__/foremanReact/common/hooks/API/APIHooks.js +3 -0
- data/webpack/__tests__/ForemanRhCloudHelpers.test.js +1 -16
- data/webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap +0 -6
- data/webpack/common/Hooks/ConfigHooks.js +16 -3
- metadata +12 -32
- data/app/controllers/concerns/foreman_rh_cloud/registration_manager_extensions.rb +0 -39
- data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +0 -36
- data/lib/foreman_inventory_upload/async/generate_host_report.rb +0 -20
- data/lib/foreman_inventory_upload/async/host_inventory_report_job.rb +0 -39
- data/lib/foreman_inventory_upload/async/single_host_report_job.rb +0 -20
- data/lib/foreman_inventory_upload/async/upload_report_direct_job.rb +0 -200
- data/test/jobs/create_missing_insights_facets_test.rb +0 -151
- data/test/jobs/generate_host_report_test.rb +0 -100
- data/test/jobs/generate_report_job_test.rb +0 -146
- data/test/jobs/host_inventory_report_job_test.rb +0 -244
- data/test/jobs/queue_for_upload_job_test.rb +0 -54
- data/test/jobs/single_host_report_job_test.rb +0 -155
- data/test/jobs/upload_report_direct_job_test.rb +0 -399
- data/test/unit/foreman_rh_cloud_iop_metadata_test.rb +0 -200
- data/test/unit/lib/foreman_rh_cloud/registration_manager_extensions_test.rb +0 -154
- data/test/unit/rh_cloud_host_test.rb +0 -345
- data/webpack/InsightsHostDetailsTab/__tests__/InsightsTotalRiskChart.test.js +0 -194
- data/webpack/InsightsHostDetailsTab/__tests__/NewHostDetailsTab.test.js +0 -154
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
import { Provider } from 'react-redux';
|
|
5
|
-
import configureMockStore from 'redux-mock-store';
|
|
6
|
-
import thunk from 'redux-thunk';
|
|
7
|
-
import NewHostDetailsTab from '../NewHostDetailsTab';
|
|
8
|
-
|
|
9
|
-
jest.mock('../../common/Hooks/ConfigHooks', () => ({
|
|
10
|
-
useIopConfig: jest.fn(() => false),
|
|
11
|
-
}));
|
|
12
|
-
|
|
13
|
-
jest.mock('foremanReact/common/I18n', () => ({
|
|
14
|
-
translate: jest.fn(str => str),
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
|
-
const mockStore = configureMockStore([thunk]);
|
|
18
|
-
|
|
19
|
-
describe('NewHostDetailsTab', () => {
|
|
20
|
-
let store;
|
|
21
|
-
let mockRouter;
|
|
22
|
-
|
|
23
|
-
beforeEach(() => {
|
|
24
|
-
mockRouter = {
|
|
25
|
-
push: jest.fn(),
|
|
26
|
-
replace: jest.fn(),
|
|
27
|
-
location: {
|
|
28
|
-
pathname: '/new/hosts/test-host.example.com',
|
|
29
|
-
search: '?page=1&per_page=20',
|
|
30
|
-
hash: '#/Insights',
|
|
31
|
-
query: { page: '1', per_page: '20' },
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
store = mockStore({
|
|
36
|
-
API: {},
|
|
37
|
-
ForemanRhCloud: {
|
|
38
|
-
InsightsCloudSync: {
|
|
39
|
-
table: {
|
|
40
|
-
selectedIds: {},
|
|
41
|
-
isAllSelected: false,
|
|
42
|
-
showSelectAllAlert: false,
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
insightsHostDetailsTab: {
|
|
47
|
-
query: '',
|
|
48
|
-
hits: [],
|
|
49
|
-
selectedIds: {},
|
|
50
|
-
error: null,
|
|
51
|
-
},
|
|
52
|
-
router: {
|
|
53
|
-
location: {
|
|
54
|
-
pathname: '/new/hosts/test-host.example.com',
|
|
55
|
-
search: '?page=1&per_page=20',
|
|
56
|
-
hash: '#/Insights',
|
|
57
|
-
query: { page: '1', per_page: '20' },
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
afterEach(() => {
|
|
64
|
-
jest.clearAllMocks();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
describe('cleanup effect', () => {
|
|
68
|
-
it('should preserve hash when clearing search params on unmount', () => {
|
|
69
|
-
const { unmount } = render(
|
|
70
|
-
<Provider store={store}>
|
|
71
|
-
<NewHostDetailsTab
|
|
72
|
-
hostName="test-host.example.com"
|
|
73
|
-
router={mockRouter}
|
|
74
|
-
/>
|
|
75
|
-
</Provider>
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
// Unmount the component to trigger cleanup
|
|
79
|
-
unmount();
|
|
80
|
-
|
|
81
|
-
// Verify router.replace was called with both search: null AND the existing hash
|
|
82
|
-
expect(mockRouter.replace).toHaveBeenCalledWith({
|
|
83
|
-
search: null,
|
|
84
|
-
hash: '#/Insights',
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('should only clear search params when no hash exists', () => {
|
|
89
|
-
mockRouter.location.hash = '';
|
|
90
|
-
|
|
91
|
-
const { unmount } = render(
|
|
92
|
-
<Provider store={store}>
|
|
93
|
-
<NewHostDetailsTab
|
|
94
|
-
hostName="test-host.example.com"
|
|
95
|
-
router={mockRouter}
|
|
96
|
-
/>
|
|
97
|
-
</Provider>
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
unmount();
|
|
101
|
-
|
|
102
|
-
// When there's no hash, should only pass search: null
|
|
103
|
-
expect(mockRouter.replace).toHaveBeenCalledWith({
|
|
104
|
-
search: null,
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('should handle router.location being undefined gracefully', () => {
|
|
109
|
-
const routerWithoutLocation = {
|
|
110
|
-
push: jest.fn(),
|
|
111
|
-
replace: jest.fn(),
|
|
112
|
-
location: undefined,
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const { unmount } = render(
|
|
116
|
-
<Provider store={store}>
|
|
117
|
-
<NewHostDetailsTab
|
|
118
|
-
hostName="test-host.example.com"
|
|
119
|
-
router={routerWithoutLocation}
|
|
120
|
-
/>
|
|
121
|
-
</Provider>
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
unmount();
|
|
125
|
-
|
|
126
|
-
// Should still call replace with search: null even if location is undefined
|
|
127
|
-
expect(routerWithoutLocation.replace).toHaveBeenCalledWith({
|
|
128
|
-
search: null,
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('should use the latest hash value at unmount time, not a stale captured value', () => {
|
|
133
|
-
const { unmount } = render(
|
|
134
|
-
<Provider store={store}>
|
|
135
|
-
<NewHostDetailsTab
|
|
136
|
-
hostName="test-host.example.com"
|
|
137
|
-
router={mockRouter}
|
|
138
|
-
/>
|
|
139
|
-
</Provider>
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
// Change the hash after mount, before unmount
|
|
143
|
-
mockRouter.location.hash = '#/Overview';
|
|
144
|
-
|
|
145
|
-
unmount();
|
|
146
|
-
|
|
147
|
-
// Verify router.replace was called with the UPDATED hash, not the initial '#/Insights'
|
|
148
|
-
expect(mockRouter.replace).toHaveBeenCalledWith({
|
|
149
|
-
search: null,
|
|
150
|
-
hash: '#/Overview',
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
});
|