foreman_rh_cloud 12.1.4 → 12.2.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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +1 -2
  3. data/app/controllers/insights_cloud/ui_requests_controller.rb +99 -0
  4. data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +7 -13
  5. data/app/services/foreman_rh_cloud/gateway_request.rb +26 -0
  6. data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +116 -0
  7. data/app/services/foreman_rh_cloud/tags_auth.rb +55 -0
  8. data/config/routes.rb +7 -0
  9. data/lib/foreman_rh_cloud/engine.rb +7 -1
  10. data/lib/foreman_rh_cloud/version.rb +1 -1
  11. data/lib/insights_cloud.rb +8 -0
  12. data/package.json +5 -1
  13. data/test/controllers/insights_cloud/ui_requests_controller_test.rb +169 -0
  14. data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +3 -3
  15. data/test/unit/services/foreman_rh_cloud/insights_api_forwarder_test.rb +176 -0
  16. data/test/unit/services/foreman_rh_cloud/tags_auth_test.rb +29 -0
  17. data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js +30 -10
  18. data/webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js +18 -11
  19. data/webpack/CVEsHostDetailsTab/index.js +2 -2
  20. data/webpack/CveDetailsPage/CveDetailsPage.js +20 -0
  21. data/webpack/CveDetailsPage/CveDetailsPage.test.js +31 -0
  22. data/webpack/CveDetailsPage/index.js +1 -0
  23. data/webpack/ForemanColumnExtensions/index.js +49 -14
  24. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +1 -0
  25. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilter.test.js.snap +1 -0
  26. data/webpack/ForemanInventoryUpload/Components/InventorySettings/MinimalInventoryDropdown.js +2 -0
  27. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +8 -1
  28. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +4 -0
  29. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorButton.js +3 -3
  30. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorButton.test.js.snap +3 -0
  31. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js +10 -4
  32. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +6 -6
  33. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SettingsWarning/SettingsWarning.js +2 -0
  34. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SettingsWarning/__snapshots__/SettingsWarning.test.js.snap +2 -0
  35. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js +1 -0
  36. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap +1 -0
  37. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/InventoryAutoUpload.js +3 -1
  38. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/__snapshots__/InventoryAutoUpload.test.js.snap +3 -0
  39. data/webpack/ForemanRhCloudFills.js +6 -3
  40. data/webpack/ForemanRhCloudPages.js +21 -3
  41. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +1 -0
  42. data/webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js +2 -0
  43. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +1 -0
  44. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +3 -0
  45. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModalFooter.js +12 -2
  46. data/webpack/InsightsCloudSync/Components/RemediationModal/Resolutions.js +1 -0
  47. data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +6 -1
  48. data/webpack/InsightsCloudSync/InsightsCloudSync.js +39 -1
  49. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +6 -50
  50. data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +51 -1
  51. data/webpack/InsightsVulnerability/InsightsVulnerabilityListPage.js +21 -0
  52. data/webpack/InsightsVulnerability/InsightsVulnerabilityListPage.test.js +20 -0
  53. data/webpack/InsightsVulnerabilityHostIndexExtensions/CVECountCell.js +45 -0
  54. data/webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js +28 -0
  55. data/webpack/IopRecommendationDetails/IopRecommendationDetails.js +44 -0
  56. data/webpack/common/DropdownToggle.js +1 -0
  57. data/webpack/common/ScalprumModule/ScalprumContext.js +73 -0
  58. data/webpack/common/Switcher/SwitcherPF4.js +1 -0
  59. data/webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap +1 -0
  60. data/webpack/common/Switcher/index.js +1 -0
  61. metadata +21 -4
  62. data/webpack/InsightsVulnerability/InsightsVulnerability.js +0 -13
  63. data/webpack/InsightsVulnerability/InsightsVulnerability.test.js +0 -18
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { useRouteMatch } from 'react-router-dom';
3
+ import { ScalprumComponent, ScalprumProvider } from '@scalprum/react-core';
4
+
5
+ import RemediationModal from '../InsightsCloudSync/Components/RemediationModal';
6
+ import { providerOptions } from '../common/ScalprumModule/ScalprumContext';
7
+
8
+ const scope = 'advisor';
9
+ const module = './RecommendationDetailsWrapped';
10
+
11
+ const invScope = 'inventory';
12
+ const invModule = './HybridInventoryTabs';
13
+
14
+ const IopRecommendationDetails = props => {
15
+ const urlParams = useRouteMatch('/foreman_rh_cloud/recommendations/:rule_id');
16
+ // eslint-disable-next-line camelcase
17
+ const ruleId = urlParams?.params?.rule_id;
18
+ return (
19
+ <div className="rh-cloud-recommendation-details-cell">
20
+ <ScalprumComponent
21
+ scope={scope}
22
+ module={module}
23
+ IopRemediationModal={RemediationModal}
24
+ ruleId={ruleId}
25
+ {...props}
26
+ />
27
+ <ScalprumComponent
28
+ scope={invScope}
29
+ module={invModule}
30
+ IopRemediationModal={RemediationModal}
31
+ ruleId={ruleId}
32
+ {...props}
33
+ />
34
+ </div>
35
+ );
36
+ };
37
+
38
+ const IopRecommendationDetailsWrapped = props => (
39
+ <ScalprumProvider {...providerOptions}>
40
+ <IopRecommendationDetails {...props} />
41
+ </ScalprumProvider>
42
+ );
43
+
44
+ export default IopRecommendationDetailsWrapped;
@@ -6,6 +6,7 @@ const DropdownToggle = ({ items, ...props }) => {
6
6
  const [isOpen, setOpen] = useState(false);
7
7
  return (
8
8
  <Dropdown
9
+ ouiaId="toggle-dropdown"
9
10
  onSelect={() => setOpen(false)}
10
11
  toggle={<KebabToggle onToggle={(_event, value) => setOpen(value)} />}
11
12
  isOpen={isOpen}
@@ -0,0 +1,73 @@
1
+ export const modulesConfig = {
2
+ vulnerability: {
3
+ name: 'vulnerability',
4
+ manifestLocation: `${window.location.origin}/assets/apps/vulnerability/fed-mods.json`,
5
+ cdnPath: `${window.location.origin}/assets/apps/vulnerability/`,
6
+ },
7
+ advisor: {
8
+ name: 'advisor',
9
+ manifestLocation: `${window.location.origin}/assets/apps/advisor/fed-mods.json`,
10
+ cdnPath: `${window.location.origin}/assets/apps/advisor/`,
11
+ },
12
+ inventory: {
13
+ name: 'inventory',
14
+ manifestLocation: `${window.location.origin}/assets/apps/inventory/fed-mods.json`,
15
+ cdnPath: `${window.location.origin}/assets/apps/inventory/`,
16
+ },
17
+ };
18
+
19
+ export const mockUser = {
20
+ entitlements: {},
21
+ identity: {
22
+ account_number: 'string',
23
+ org_id: 'FOREMAN',
24
+ internal: {
25
+ org_id: 'string',
26
+ account_id: 'string',
27
+ },
28
+ type: 'string',
29
+ user: {
30
+ username: 'string',
31
+ email: 'string',
32
+ first_name: 'string',
33
+ last_name: 'string',
34
+ is_active: 'boolean',
35
+ is_internal: 'boolean',
36
+ is_org_admin: 'boolean',
37
+ locale: 'string',
38
+ },
39
+ },
40
+ };
41
+
42
+ export const providerOptions = {
43
+ pluginSDKOptions: {
44
+ pluginLoaderOptions: {
45
+ transformPluginManifest: manifest => {
46
+ if (
47
+ manifest.baseURL === 'auto' &&
48
+ modulesConfig[manifest.name]?.cdnPath
49
+ ) {
50
+ const _cdnPath = modulesConfig[manifest.name]?.cdnPath;
51
+ return {
52
+ ...manifest,
53
+ baseURL: _cdnPath,
54
+ loadScripts: manifest.loadScripts.map(
55
+ script => `${_cdnPath}${script}`
56
+ ),
57
+ };
58
+ }
59
+ return manifest;
60
+ },
61
+ },
62
+ },
63
+ api: {
64
+ chrome: {
65
+ isBeta: () => false,
66
+ on: () => {},
67
+ auth: {
68
+ getUser: () => Promise.resolve(mockUser),
69
+ },
70
+ },
71
+ },
72
+ config: modulesConfig,
73
+ };
@@ -14,6 +14,7 @@ const SwitcherPF4 = ({
14
14
  }) => (
15
15
  <Switch
16
16
  className="foreman-rh-cloud-switcher"
17
+ ouiaId="foreman-rh-cloud-switcher"
17
18
  id={`rh-cloud-switcher-${id}`}
18
19
  isChecked={isChecked}
19
20
  isDisabled={isDisabled}
@@ -19,5 +19,6 @@ exports[`InsightsCloudSync helpers should return insights cloud Url 1`] = `
19
19
  </div>
20
20
  }
21
21
  onChange={[MockFunction]}
22
+ ouiaId="foreman-rh-cloud-switcher"
22
23
  />
23
24
  `;
@@ -49,6 +49,7 @@ const Switcher = ({
49
49
  <Grid.Col sm={SwitchCol} style={{ marginBottom: '5px' }}>
50
50
  <Switch
51
51
  id={`rh-cloud-switcher-${id}`}
52
+ ouiaId={`rh-cloud-switcher-${id}`}
52
53
  isChecked={isChecked}
53
54
  onChange={onChange}
54
55
  label=" "
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_rh_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.1.4
4
+ version: 12.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Red Hat Cloud team
@@ -114,6 +114,7 @@ files:
114
114
  - app/controllers/insights_cloud/hits_controller.rb
115
115
  - app/controllers/insights_cloud/settings_controller.rb
116
116
  - app/controllers/insights_cloud/tasks_controller.rb
117
+ - app/controllers/insights_cloud/ui_requests_controller.rb
117
118
  - app/helpers/foreman_insights_host_helper.rb
118
119
  - app/helpers/foreman_inventory_upload_helper.rb
119
120
  - app/helpers/foreman_inventory_upload_host_helper.rb
@@ -135,11 +136,14 @@ files:
135
136
  - app/services/foreman_rh_cloud/cloud_presence.rb
136
137
  - app/services/foreman_rh_cloud/cloud_request.rb
137
138
  - app/services/foreman_rh_cloud/cloud_request_forwarder.rb
139
+ - app/services/foreman_rh_cloud/gateway_request.rb
138
140
  - app/services/foreman_rh_cloud/hit_remediations_retriever.rb
139
141
  - app/services/foreman_rh_cloud/hits_uploader.rb
142
+ - app/services/foreman_rh_cloud/insights_api_forwarder.rb
140
143
  - app/services/foreman_rh_cloud/insights_status_cleaner.rb
141
144
  - app/services/foreman_rh_cloud/remediations_retriever.rb
142
145
  - app/services/foreman_rh_cloud/rules_ingester.rb
146
+ - app/services/foreman_rh_cloud/tags_auth.rb
143
147
  - app/services/foreman_rh_cloud/template_renderer_helper.rb
144
148
  - app/services/foreman_rh_cloud/url_remediations_retriever.rb
145
149
  - app/views/api/v2/advisor_engine/host_details.json.rabl
@@ -239,6 +243,7 @@ files:
239
243
  - test/controllers/insights_cloud/api/advisor_engine_controller_test.rb
240
244
  - test/controllers/insights_cloud/api/cloud_request_controller_test.rb
241
245
  - test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
246
+ - test/controllers/insights_cloud/ui_requests_controller_test.rb
242
247
  - test/controllers/insights_sync/settings_controller_test.rb
243
248
  - test/controllers/inventory_upload/api/inventory_controller_test.rb
244
249
  - test/controllers/inventory_upload/cloud_status_controller_test.rb
@@ -275,8 +280,10 @@ files:
275
280
  - test/unit/services/foreman_rh_cloud/cloud_status_service_test.rb
276
281
  - test/unit/services/foreman_rh_cloud/hit_remediations_retriever_test.rb
277
282
  - test/unit/services/foreman_rh_cloud/hits_uploader_test.rb
283
+ - test/unit/services/foreman_rh_cloud/insights_api_forwarder_test.rb
278
284
  - test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb
279
285
  - test/unit/services/foreman_rh_cloud/rules_ingester_test.rb
286
+ - test/unit/services/foreman_rh_cloud/tags_auth_test.rb
280
287
  - test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
281
288
  - test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb
282
289
  - test/unit/shell_process_job_test.rb
@@ -285,6 +292,9 @@ files:
285
292
  - webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js
286
293
  - webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js
287
294
  - webpack/CVEsHostDetailsTab/index.js
295
+ - webpack/CveDetailsPage/CveDetailsPage.js
296
+ - webpack/CveDetailsPage/CveDetailsPage.test.js
297
+ - webpack/CveDetailsPage/index.js
288
298
  - webpack/ForemanColumnExtensions/index.js
289
299
  - webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js
290
300
  - webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js
@@ -610,8 +620,11 @@ files:
610
620
  - webpack/InsightsHostDetailsTab/components/ListItem/ListItem.js
611
621
  - webpack/InsightsHostDetailsTab/components/ListItem/index.js
612
622
  - webpack/InsightsHostDetailsTab/index.js
613
- - webpack/InsightsVulnerability/InsightsVulnerability.js
614
- - webpack/InsightsVulnerability/InsightsVulnerability.test.js
623
+ - webpack/InsightsVulnerability/InsightsVulnerabilityListPage.js
624
+ - webpack/InsightsVulnerability/InsightsVulnerabilityListPage.test.js
625
+ - webpack/InsightsVulnerabilityHostIndexExtensions/CVECountCell.js
626
+ - webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js
627
+ - webpack/IopRecommendationDetails/IopRecommendationDetails.js
615
628
  - webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js
616
629
  - webpack/__mocks__/foremanReact/common/I18n.js
617
630
  - webpack/__mocks__/foremanReact/common/MountingService.js
@@ -638,6 +651,7 @@ files:
638
651
  - webpack/common/ForemanTasks/ForemanTasksHelpers.js
639
652
  - webpack/common/ForemanTasks/index.js
640
653
  - webpack/common/Hooks/ConfigHooks.js
654
+ - webpack/common/ScalprumModule/ScalprumContext.js
641
655
  - webpack/common/Switcher/HelpLabel.js
642
656
  - webpack/common/Switcher/SwitcherPF4.js
643
657
  - webpack/common/Switcher/SwitcherPF4.scss
@@ -671,7 +685,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
671
685
  - !ruby/object:Gem::Version
672
686
  version: '0'
673
687
  requirements: []
674
- rubygems_version: 3.6.7
688
+ rubygems_version: 3.6.9
675
689
  specification_version: 4
676
690
  summary: Summary of ForemanRhCloud.
677
691
  test_files:
@@ -679,6 +693,7 @@ test_files:
679
693
  - test/controllers/insights_cloud/api/advisor_engine_controller_test.rb
680
694
  - test/controllers/insights_cloud/api/cloud_request_controller_test.rb
681
695
  - test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
696
+ - test/controllers/insights_cloud/ui_requests_controller_test.rb
682
697
  - test/controllers/insights_sync/settings_controller_test.rb
683
698
  - test/controllers/inventory_upload/api/inventory_controller_test.rb
684
699
  - test/controllers/inventory_upload/cloud_status_controller_test.rb
@@ -715,8 +730,10 @@ test_files:
715
730
  - test/unit/services/foreman_rh_cloud/cloud_status_service_test.rb
716
731
  - test/unit/services/foreman_rh_cloud/hit_remediations_retriever_test.rb
717
732
  - test/unit/services/foreman_rh_cloud/hits_uploader_test.rb
733
+ - test/unit/services/foreman_rh_cloud/insights_api_forwarder_test.rb
718
734
  - test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb
719
735
  - test/unit/services/foreman_rh_cloud/rules_ingester_test.rb
736
+ - test/unit/services/foreman_rh_cloud/tags_auth_test.rb
720
737
  - test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
721
738
  - test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb
722
739
  - test/unit/shell_process_job_test.rb
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import PageLayout from 'foremanReact/routes/common/PageLayout/PageLayout';
3
- import { translate as __ } from 'foremanReact/common/I18n';
4
-
5
- const InsightsVulnerability = () => (
6
- <PageLayout searchable={false} header={__('Vulnerability')}>
7
- <div className="insights-vulnerability">
8
- <p>This page is under development. Please check back soon for updates.</p>
9
- </div>
10
- </PageLayout>
11
- );
12
-
13
- export default InsightsVulnerability;
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import '@testing-library/jest-dom';
4
- import InsightsVulnerability from './InsightsVulnerability';
5
-
6
- describe('InsightsVulnerability component', () => {
7
- it('renders the "under development" message', () => {
8
- render(<InsightsVulnerability />);
9
- expect(
10
- screen.getByText(/this page is under development/i)
11
- ).toBeInTheDocument();
12
- });
13
-
14
- it('renders the container with correct class', () => {
15
- const { container } = render(<InsightsVulnerability />);
16
- expect(container.querySelector('.insights-vulnerability')).toBeTruthy();
17
- });
18
- });