foreman_rh_cloud 14.0.2 → 14.1.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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +61 -61
  3. data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +68 -68
  4. data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +9 -9
  5. data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +60 -60
  6. data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +60 -60
  7. data/app/controllers/concerns/insights_cloud/candlepin_proxies_extensions.rb +23 -0
  8. data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +9 -0
  9. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +1 -1
  10. data/app/controllers/foreman_inventory_upload/api/tasks_controller.rb +2 -2
  11. data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +9 -2
  12. data/app/models/concerns/rh_cloud_host.rb +35 -3
  13. data/app/models/insights_client_report_status.rb +9 -1
  14. data/app/models/inventory_sync/inventory_status.rb +16 -4
  15. data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +12 -5
  16. data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +8 -2
  17. data/lib/foreman_rh_cloud/engine.rb +1 -0
  18. data/lib/foreman_rh_cloud/version.rb +1 -1
  19. data/lib/insights_cloud/async/vmaas_reposcan_sync.rb +23 -8
  20. data/lib/inventory_sync/async/inventory_full_sync.rb +39 -3
  21. data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  22. data/locale/fr/foreman_rh_cloud.po +66 -65
  23. data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  24. data/locale/ja/foreman_rh_cloud.po +72 -70
  25. data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  26. data/locale/ka/foreman_rh_cloud.po +11 -10
  27. data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  28. data/locale/ko/foreman_rh_cloud.po +64 -63
  29. data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  30. data/locale/zh_CN/foreman_rh_cloud.po +65 -64
  31. data/package.json +1 -1
  32. data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +40 -0
  33. data/test/controllers/insights_cloud/candlepin_proxies_extensions_test.rb +70 -0
  34. data/test/jobs/insights_client_status_aging_test.rb +40 -0
  35. data/test/jobs/inventory_full_sync_test.rb +212 -0
  36. data/test/models/insights_client_report_status_test.rb +109 -0
  37. data/test/models/inventory_sync/inventory_status_test.rb +85 -0
  38. data/test/unit/lib/insights_cloud/async/vmaas_reposcan_sync_test.rb +80 -25
  39. data/test/unit/rh_cloud_host_test.rb +214 -0
  40. data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js +6 -1
  41. data/webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js +45 -6
  42. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +8 -2
  43. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +1 -0
  44. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js +1 -0
  45. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js +43 -17
  46. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/__tests__/Toast.test.js +82 -0
  47. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +7 -4
  48. data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +9 -0
  49. data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +44 -14
  50. data/webpack/InsightsHostDetailsTab/__tests__/NewHostDetailsTab.test.js +154 -0
  51. metadata +9 -2
@@ -0,0 +1,154 @@
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
+ });
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: 14.0.2
4
+ version: 14.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Red Hat Cloud team
@@ -101,6 +101,7 @@ files:
101
101
  - app/controllers/concerns/foreman_rh_cloud/iop_smart_proxy_access.rb
102
102
  - app/controllers/concerns/foreman_rh_cloud/registration_manager_extensions.rb
103
103
  - app/controllers/concerns/insights_cloud/candlepin_cache.rb
104
+ - app/controllers/concerns/insights_cloud/candlepin_proxies_extensions.rb
104
105
  - app/controllers/concerns/insights_cloud/client_authentication.rb
105
106
  - app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb
106
107
  - app/controllers/concerns/inventory_upload/report_actions.rb
@@ -248,6 +249,7 @@ files:
248
249
  - test/controllers/insights_cloud/api/advisor_engine_controller_test.rb
249
250
  - test/controllers/insights_cloud/api/cloud_request_controller_test.rb
250
251
  - test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
252
+ - test/controllers/insights_cloud/candlepin_proxies_extensions_test.rb
251
253
  - test/controllers/insights_cloud/ui_requests_controller_test.rb
252
254
  - test/controllers/insights_sync/settings_controller_test.rb
253
255
  - test/controllers/inventory_upload/api/inventory_controller_test.rb
@@ -274,6 +276,7 @@ files:
274
276
  - test/jobs/single_host_report_job_test.rb
275
277
  - test/jobs/upload_report_direct_job_test.rb
276
278
  - test/models/insights_client_report_status_test.rb
279
+ - test/models/inventory_sync/inventory_status_test.rb
277
280
  - test/test_plugin_helper.rb
278
281
  - test/unit/archived_report_generator_test.rb
279
282
  - test/unit/fact_helpers_test.rb
@@ -448,6 +451,7 @@ files:
448
451
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap
449
452
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js
450
453
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js
454
+ - webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/__tests__/Toast.test.js
451
455
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/index.js
452
456
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js
453
457
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/ToolbarButtons.test.js
@@ -586,6 +590,7 @@ files:
586
590
  - webpack/InsightsHostDetailsTab/__tests__/InsightsTabReducer.test.js
587
591
  - webpack/InsightsHostDetailsTab/__tests__/InsightsTabSelectors.test.js
588
592
  - webpack/InsightsHostDetailsTab/__tests__/InsightsTotalRiskChart.test.js
593
+ - webpack/InsightsHostDetailsTab/__tests__/NewHostDetailsTab.test.js
589
594
  - webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTab.test.js.snap
590
595
  - webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTabActions.test.js.snap
591
596
  - webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTabReducer.test.js.snap
@@ -668,7 +673,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
668
673
  - !ruby/object:Gem::Version
669
674
  version: '0'
670
675
  requirements: []
671
- rubygems_version: 4.0.3
676
+ rubygems_version: 4.0.6
672
677
  specification_version: 4
673
678
  summary: Summary of ForemanRhCloud.
674
679
  test_files:
@@ -676,6 +681,7 @@ test_files:
676
681
  - test/controllers/insights_cloud/api/advisor_engine_controller_test.rb
677
682
  - test/controllers/insights_cloud/api/cloud_request_controller_test.rb
678
683
  - test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
684
+ - test/controllers/insights_cloud/candlepin_proxies_extensions_test.rb
679
685
  - test/controllers/insights_cloud/ui_requests_controller_test.rb
680
686
  - test/controllers/insights_sync/settings_controller_test.rb
681
687
  - test/controllers/inventory_upload/api/inventory_controller_test.rb
@@ -702,6 +708,7 @@ test_files:
702
708
  - test/jobs/single_host_report_job_test.rb
703
709
  - test/jobs/upload_report_direct_job_test.rb
704
710
  - test/models/insights_client_report_status_test.rb
711
+ - test/models/inventory_sync/inventory_status_test.rb
705
712
  - test/test_plugin_helper.rb
706
713
  - test/unit/archived_report_generator_test.rb
707
714
  - test/unit/fact_helpers_test.rb