foreman_rh_cloud 14.2.0 → 14.3.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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/concerns/rh_cloud_host.rb +36 -1
  3. data/config/routes.rb +1 -0
  4. data/lib/foreman_inventory_upload/async/upload_report_direct_job.rb +2 -0
  5. data/lib/foreman_rh_cloud/version.rb +1 -1
  6. data/package.json +1 -1
  7. data/test/jobs/upload_report_direct_job_test.rb +29 -0
  8. data/test/unit/insights_facet_test.rb +5 -0
  9. data/test/unit/rh_cloud_host_test.rb +68 -0
  10. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +5 -1
  11. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListConstants.js +5 -0
  12. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/EmptyResults.js +15 -6
  13. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/emptyResults.scss +1 -5
  14. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.js +15 -7
  15. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +1 -3
  16. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/emptyState.scss +1 -5
  17. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorState.js +2 -2
  18. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +0 -1
  19. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +2 -6
  20. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/ClearButton.js +13 -10
  21. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +30 -11
  22. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/integration.test.js +3 -1
  23. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/inventoryFilter.scss +28 -22
  24. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.js +4 -4
  25. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.scss +16 -3
  26. data/webpack/ForemanInventoryUpload/Components/InventorySettings/MinimalInventoryDropdown.js +13 -14
  27. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +7 -7
  28. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +3 -2
  29. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +63 -46
  30. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js +4 -7
  31. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageTitle.test.js +83 -12
  32. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js +31 -38
  33. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButton.test.js +3 -1
  34. data/webpack/ForemanInventoryUpload/Components/TaskConstants.js +6 -0
  35. data/webpack/ForemanInventoryUpload/Components/TaskHistory/TaskHistory.js +3 -2
  36. data/webpack/ForemanInventoryUpload/Components/TaskProgress/TaskProgress.js +4 -3
  37. data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +1 -1
  38. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/InventoryAutoUpload.js +29 -22
  39. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/InventoryAutoUpload.test.js +6 -2
  40. data/webpack/ForemanInventoryUpload/__tests__/ForemanInventoryHelpers.test.js +9 -6
  41. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +90 -23
  42. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js +1 -2
  43. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +24 -30
  44. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableHelpers.js +5 -6
  45. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js +193 -8
  46. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableActions.test.js +4 -1
  47. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationHelpers.js +8 -9
  48. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +26 -13
  49. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModalFooter.js +5 -2
  50. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationTableConstants.js +16 -10
  51. data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +21 -9
  52. data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +12 -19
  53. data/webpack/InsightsCloudSync/__tests__/InsightsCloudSyncActions.test.js +0 -1
  54. data/webpack/IopRecommendationDetails/IopRecommendationDetails.js +19 -0
  55. data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js +5 -1
  56. data/webpack/common/DropdownToggle.js +20 -6
  57. metadata +3 -45
  58. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.fixtures.js +0 -0
  59. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.js +0 -25
  60. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownloadHelper.js +0 -0
  61. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +0 -17
  62. data/webpack/ForemanInventoryUpload/Components/FileDownload/fileDownload.scss +0 -5
  63. data/webpack/ForemanInventoryUpload/Components/FileDownload/index.js +0 -1
  64. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +0 -20
  65. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js +0 -66
  66. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainerHelper.js +0 -0
  67. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +0 -69
  68. data/webpack/ForemanInventoryUpload/Components/NavContainer/index.js +0 -1
  69. data/webpack/ForemanInventoryUpload/Components/NavContainer/navContainer.scss +0 -9
  70. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.fixtures.js +0 -4
  71. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.js +0 -29
  72. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRunHelper.js +0 -0
  73. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +0 -33
  74. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js +0 -12
  75. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/scheduledRun.scss +0 -13
  76. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.fixtures.js +0 -0
  77. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js +0 -57
  78. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChartHelper.js +0 -0
  79. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +0 -30
  80. data/webpack/ForemanInventoryUpload/Components/StatusChart/index.js +0 -1
  81. data/webpack/ForemanInventoryUpload/Components/StatusChart/statusChart.scss +0 -10
  82. data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.fixtures.js +0 -0
  83. data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.js +0 -24
  84. data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainerHelper.js +0 -0
  85. data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +0 -15
  86. data/webpack/ForemanInventoryUpload/Components/TabContainer/index.js +0 -1
  87. data/webpack/ForemanInventoryUpload/Components/TabContainer/tabContainer.scss +0 -10
  88. data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.fixtures.js +0 -0
  89. data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.js +0 -19
  90. data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooterHelper.js +0 -0
  91. data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +0 -15
  92. data/webpack/ForemanInventoryUpload/Components/TabFooter/index.js +0 -1
  93. data/webpack/ForemanInventoryUpload/Components/TabFooter/tabFooter.scss +0 -0
  94. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.fixtures.js +0 -0
  95. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js +0 -85
  96. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeaderHelper.js +0 -0
  97. data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +0 -114
  98. data/webpack/ForemanInventoryUpload/Components/TabHeader/index.js +0 -1
  99. data/webpack/ForemanInventoryUpload/Components/TabHeader/tabHeader.scss +0 -23
  100. data/webpack/common/Switcher/index.js +0 -80
@@ -1,38 +1,40 @@
1
1
  import React from 'react';
2
- import { cellWidth } from '@patternfly/react-table';
3
2
  import { Icon } from '@patternfly/react-core';
4
3
  import { CheckCircleIcon } from '@patternfly/react-icons';
5
4
  import { translate as __ } from 'foremanReact/common/I18n';
6
5
  import { foremanUrl } from '../../../ForemanRhCloudHelpers';
7
6
 
8
- export const rebootFormatter = ({ title: reboot }) => ({
9
- children: reboot ? (
7
+ export const rebootFormatter = reboot =>
8
+ reboot ? (
10
9
  <Icon color="green">
11
10
  <CheckCircleIcon />
12
11
  </Icon>
13
12
  ) : (
14
13
  __('No')
15
- ),
16
- });
14
+ );
17
15
 
18
16
  export const columns = [
19
17
  {
18
+ id: 'hostname',
20
19
  sortKey: 'hostname',
21
20
  title: __('Hostname'),
22
- transforms: [cellWidth(20)],
21
+ width: 20,
23
22
  },
24
23
  {
24
+ id: 'recommendation',
25
25
  title: __('Recommendation'),
26
- transforms: [cellWidth(35)],
26
+ width: 35,
27
27
  },
28
28
  {
29
+ id: 'resolution',
29
30
  title: __('Resolution'),
30
- transforms: [cellWidth(30)],
31
+ width: 30,
31
32
  },
32
33
  {
34
+ id: 'reboot',
33
35
  title: __('Reboot Required'),
34
- transforms: [cellWidth(15)],
35
- cellTransforms: [rebootFormatter],
36
+ width: 15,
37
+ formatter: rebootFormatter,
36
38
  },
37
39
  ];
38
40
 
@@ -43,3 +45,7 @@ export const JOB_INVOCATION_PATH = foremanUrl('/job_invocations/new');
43
45
  export const REMEDIATIONS_API_KEY = 'INSIGHTS_REMEDIATIONS';
44
46
 
45
47
  export const SUBMIT_RESOLUTIONS = 'SUBMIT_INSIGHTS_RESOLUTIONS';
48
+
49
+ // Brief delay before the (non-React) form submit/navigation fires, so the
50
+ // button's isLoading spinner has a chance to render first.
51
+ export const FORM_SUBMIT_DELAY_MS = 100;
@@ -4,9 +4,10 @@ import { translate as __ } from 'foremanReact/common/I18n';
4
4
  import {
5
5
  Dropdown,
6
6
  DropdownItem,
7
- KebabToggle,
8
- } from '@patternfly/react-core/deprecated';
9
- import { ExternalLinkAltIcon } from '@patternfly/react-icons';
7
+ DropdownList,
8
+ MenuToggle,
9
+ } from '@patternfly/react-core';
10
+ import { EllipsisVIcon, ExternalLinkAltIcon } from '@patternfly/react-icons';
10
11
  import { redHatAdvisorSystems } from '../InsightsCloudSyncHelpers';
11
12
  import { useIopConfig } from '../../common/Hooks/ConfigHooks';
12
13
 
@@ -44,13 +45,24 @@ const ToolbarDropdown = ({ onRecommendationSync }) => {
44
45
  className="title-dropdown"
45
46
  ouiaId="title-dropdown"
46
47
  onSelect={() => setIsDropdownOpen(false)}
47
- toggle={
48
- <KebabToggle onToggle={(_event, isOpen) => setIsDropdownOpen(isOpen)} />
49
- }
48
+ onOpenChange={setIsDropdownOpen}
49
+ toggle={toggleRef => (
50
+ <MenuToggle
51
+ ref={toggleRef}
52
+ variant="plain"
53
+ aria-label={__('Recommendations actions')}
54
+ onClick={() => setIsDropdownOpen(prev => !prev)}
55
+ isExpanded={isDropdownOpen}
56
+ >
57
+ <EllipsisVIcon />
58
+ </MenuToggle>
59
+ )}
50
60
  isOpen={isDropdownOpen}
51
- isPlain
52
- dropdownItems={dropdownItems}
53
- />
61
+ shouldFocusToggleOnSelect
62
+ popperProps={{ position: 'right' }}
63
+ >
64
+ <DropdownList>{dropdownItems}</DropdownList>
65
+ </Dropdown>
54
66
  );
55
67
  };
56
68
 
@@ -15,16 +15,15 @@ jest.mock('./Components/InsightsTable', () => () => null);
15
15
  jest.mock('./Components/RemediationModal', () => () => null);
16
16
  jest.mock('./Components/InsightsTable/Pagination', () => () => null);
17
17
  jest.mock('./Components/InsightsSettings', () => () => null);
18
- jest.mock('foremanReact/routes/common/PageLayout/PageLayout', () => ({
19
- children,
20
- header,
21
- toolbarButtons,
22
- }) => (
23
- <div data-testid="page-layout" data-header={header}>
24
- {toolbarButtons}
25
- {children}
26
- </div>
27
- ));
18
+ jest.mock(
19
+ 'foremanReact/routes/common/PageLayout/PageLayout',
20
+ () => ({ children, header, toolbarButtons }) => (
21
+ <div data-testid="page-layout" data-header={header}>
22
+ {toolbarButtons}
23
+ {children}
24
+ </div>
25
+ )
26
+ );
28
27
  jest.mock('@scalprum/react-core', () => ({
29
28
  ScalprumComponent: () => <div data-testid="scalprum-component" />,
30
29
  ScalprumProvider: ({ children }) => <div>{children}</div>,
@@ -47,9 +46,7 @@ describe('RecommendationsPage', () => {
47
46
 
48
47
  describe('non-IOP mode', () => {
49
48
  it('renders with rh-cloud-insights class and correct header', () => {
50
- const { container } = render(
51
- <RecommendationsPage {...defaultProps} />
52
- );
49
+ const { container } = render(<RecommendationsPage {...defaultProps} />);
53
50
 
54
51
  expect(container.querySelector('.rh-cloud-insights')).toBeTruthy();
55
52
  expect(
@@ -58,9 +55,7 @@ describe('RecommendationsPage', () => {
58
55
  });
59
56
 
60
57
  it('does not render IOP advisor view', () => {
61
- const { container } = render(
62
- <RecommendationsPage {...defaultProps} />
63
- );
58
+ const { container } = render(<RecommendationsPage {...defaultProps} />);
64
59
 
65
60
  expect(container.querySelector('.advisor')).toBeNull();
66
61
  });
@@ -72,9 +67,7 @@ describe('RecommendationsPage', () => {
72
67
  });
73
68
 
74
69
  it('renders advisor view instead of insights page', () => {
75
- const { container } = render(
76
- <RecommendationsPage {...defaultProps} />
77
- );
70
+ const { container } = render(<RecommendationsPage {...defaultProps} />);
78
71
 
79
72
  expect(container.querySelector('.advisor')).toBeTruthy();
80
73
  expect(container.querySelector('.rh-cloud-insights')).toBeNull();
@@ -1,7 +1,6 @@
1
1
  import { syncInsights } from '../InsightsCloudSyncActions';
2
2
  import { INSIGHTS_CLOUD_SYNC } from '../InsightsCloudSyncConstants';
3
3
 
4
-
5
4
  jest.mock('../../common/ForemanTasks');
6
5
 
7
6
  describe('InsightsCloudSync actions', () => {
@@ -8,11 +8,30 @@ import { useInsightsPermissions } from '../common/Hooks/PermissionsHooks';
8
8
 
9
9
  const scope = 'advisor';
10
10
  const module = './RecommendationDetailsWrapped';
11
+ const pathwayModule = './PathwayDetailsWrapped';
11
12
 
12
13
  const IopRecommendationDetails = props => {
14
+ const pathwayMatch = useRouteMatch(
15
+ '/foreman_rh_cloud/recommendations/pathways/:slug'
16
+ );
13
17
  const urlParams = useRouteMatch('/foreman_rh_cloud/recommendations/:rule_id');
14
18
  // eslint-disable-next-line camelcase
15
19
  const ruleId = urlParams?.params?.rule_id;
20
+
21
+ if (pathwayMatch) {
22
+ return (
23
+ <div className="iop-pathway-details-scalprum advisor">
24
+ <ScalprumComponent
25
+ scope={scope}
26
+ module={pathwayModule}
27
+ pathwayId={pathwayMatch.params.slug}
28
+ IopRemediationModal={RemediationModal}
29
+ {...props}
30
+ />
31
+ </div>
32
+ );
33
+ }
34
+
16
35
  return (
17
36
  <div className="iop-recommendation-details-scalprum advisor">
18
37
  <ScalprumComponent
@@ -1,4 +1,8 @@
1
- export const withInterval = (action, interval = 3000) => ({
1
+ // Arbitrary fallback for this test double only; the real foremanReact
2
+ // default lives in IntervalMiddleware/IntervalConstants.js.
3
+ const DEFAULT_INTERVAL_MS = 3000;
4
+
5
+ export const withInterval = (action, interval = DEFAULT_INTERVAL_MS) => ({
2
6
  ...action,
3
7
  interval,
4
8
  });
@@ -1,6 +1,8 @@
1
1
  import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Dropdown, KebabToggle } from '@patternfly/react-core/deprecated';
3
+ import { Dropdown, DropdownList, MenuToggle } from '@patternfly/react-core';
4
+ import { EllipsisVIcon } from '@patternfly/react-icons';
5
+ import { translate as __ } from 'foremanReact/common/I18n';
4
6
 
5
7
  const DropdownToggle = ({ items, ...props }) => {
6
8
  const [isOpen, setOpen] = useState(false);
@@ -8,13 +10,25 @@ const DropdownToggle = ({ items, ...props }) => {
8
10
  <Dropdown
9
11
  ouiaId="toggle-dropdown"
10
12
  onSelect={() => setOpen(false)}
11
- toggle={<KebabToggle onToggle={(_event, value) => setOpen(value)} />}
13
+ onOpenChange={setOpen}
14
+ toggle={toggleRef => (
15
+ <MenuToggle
16
+ ref={toggleRef}
17
+ variant="plain"
18
+ aria-label={__('Table actions')}
19
+ onClick={() => setOpen(prev => !prev)}
20
+ isExpanded={isOpen}
21
+ >
22
+ <EllipsisVIcon />
23
+ </MenuToggle>
24
+ )}
12
25
  isOpen={isOpen}
13
- isPlain
14
- dropdownItems={items}
15
- position="right"
26
+ shouldFocusToggleOnSelect
27
+ popperProps={{ position: 'right' }}
16
28
  {...props}
17
- />
29
+ >
30
+ <DropdownList>{items}</DropdownList>
31
+ </Dropdown>
18
32
  );
19
33
  };
20
34
 
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.2.0
4
+ version: 14.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Red Hat Cloud team
@@ -334,12 +334,6 @@ files:
334
334
  - webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js
335
335
  - webpack/ForemanInventoryUpload/Components/Dashboard/dashboard.scss
336
336
  - webpack/ForemanInventoryUpload/Components/Dashboard/index.js
337
- - webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.fixtures.js
338
- - webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.js
339
- - webpack/ForemanInventoryUpload/Components/FileDownload/FileDownloadHelper.js
340
- - webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js
341
- - webpack/ForemanInventoryUpload/Components/FileDownload/fileDownload.scss
342
- - webpack/ForemanInventoryUpload/Components/FileDownload/index.js
343
337
  - webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/ClearButton.js
344
338
  - webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/index.js
345
339
  - webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.fixtures.js
@@ -362,12 +356,6 @@ files:
362
356
  - webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettingsSelectors.js
363
357
  - webpack/ForemanInventoryUpload/Components/InventorySettings/MinimalInventoryDropdown.js
364
358
  - webpack/ForemanInventoryUpload/Components/InventorySettings/index.js
365
- - webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js
366
- - webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
367
- - webpack/ForemanInventoryUpload/Components/NavContainer/NavContainerHelper.js
368
- - webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js
369
- - webpack/ForemanInventoryUpload/Components/NavContainer/index.js
370
- - webpack/ForemanInventoryUpload/Components/NavContainer/navContainer.scss
371
359
  - webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js
372
360
  - webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss
373
361
  - webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js
@@ -393,36 +381,7 @@ files:
393
381
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/index.js
394
382
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/toolbarButtons.scss
395
383
  - webpack/ForemanInventoryUpload/Components/PageHeader/index.js
396
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.fixtures.js
397
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.js
398
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRunHelper.js
399
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js
400
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js
401
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/scheduledRun.scss
402
- - webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.fixtures.js
403
- - webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
404
- - webpack/ForemanInventoryUpload/Components/StatusChart/StatusChartHelper.js
405
- - webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js
406
- - webpack/ForemanInventoryUpload/Components/StatusChart/index.js
407
- - webpack/ForemanInventoryUpload/Components/StatusChart/statusChart.scss
408
- - webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.fixtures.js
409
- - webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.js
410
- - webpack/ForemanInventoryUpload/Components/TabContainer/TabContainerHelper.js
411
- - webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js
412
- - webpack/ForemanInventoryUpload/Components/TabContainer/index.js
413
- - webpack/ForemanInventoryUpload/Components/TabContainer/tabContainer.scss
414
- - webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.fixtures.js
415
- - webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.js
416
- - webpack/ForemanInventoryUpload/Components/TabFooter/TabFooterHelper.js
417
- - webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js
418
- - webpack/ForemanInventoryUpload/Components/TabFooter/index.js
419
- - webpack/ForemanInventoryUpload/Components/TabFooter/tabFooter.scss
420
- - webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.fixtures.js
421
- - webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js
422
- - webpack/ForemanInventoryUpload/Components/TabHeader/TabHeaderHelper.js
423
- - webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js
424
- - webpack/ForemanInventoryUpload/Components/TabHeader/index.js
425
- - webpack/ForemanInventoryUpload/Components/TabHeader/tabHeader.scss
384
+ - webpack/ForemanInventoryUpload/Components/TaskConstants.js
426
385
  - webpack/ForemanInventoryUpload/Components/TaskHistory/TaskHistory.js
427
386
  - webpack/ForemanInventoryUpload/Components/TaskHistory/index.js
428
387
  - webpack/ForemanInventoryUpload/Components/TaskHistory/taskHistory.scss
@@ -548,7 +507,6 @@ files:
548
507
  - webpack/common/Switcher/SwitcherPF4.scss
549
508
  - webpack/common/Switcher/__tests__/HelpLabel.test.js
550
509
  - webpack/common/Switcher/__tests__/SwitcherPF4.test.js
551
- - webpack/common/Switcher/index.js
552
510
  - webpack/common/styles.scss
553
511
  - webpack/common/table/EmptyState.js
554
512
  - webpack/common/table/helpers.js
@@ -575,7 +533,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
575
533
  - !ruby/object:Gem::Version
576
534
  version: '0'
577
535
  requirements: []
578
- rubygems_version: 4.0.10
536
+ rubygems_version: 4.0.16
579
537
  specification_version: 4
580
538
  summary: Summary of ForemanRhCloud.
581
539
  test_files:
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Grid, Button, Icon } from 'patternfly-react';
4
- import { noop } from 'foremanReact/common/helpers';
5
- import { translate as __ } from 'foremanReact/common/I18n';
6
-
7
- import './fileDownload.scss';
8
-
9
- const FileDownload = ({ onClick }) => (
10
- <Grid.Col sm={12}>
11
- <Button onClick={onClick} className="download-button">
12
- {__('Download Report')} <Icon name="download" />
13
- </Button>
14
- </Grid.Col>
15
- );
16
-
17
- FileDownload.propTypes = {
18
- onClick: PropTypes.func,
19
- };
20
-
21
- FileDownload.defaultProps = {
22
- onClick: noop,
23
- };
24
-
25
- export default FileDownload;
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { render, screen, fireEvent } from '@testing-library/react';
3
- import FileDownload from '../FileDownload';
4
-
5
- describe('FileDownload', () => {
6
- it('renders the download button', () => {
7
- render(<FileDownload />);
8
- expect(screen.getByRole('button', { name: /Download Report/ })).toBeTruthy();
9
- });
10
-
11
- it('calls onClick when button is clicked', () => {
12
- const onClick = jest.fn();
13
- render(<FileDownload onClick={onClick} />);
14
- fireEvent.click(screen.getByRole('button', { name: /Download Report/ }));
15
- expect(onClick).toHaveBeenCalledTimes(1);
16
- });
17
- });
@@ -1,5 +0,0 @@
1
- .rh-cloud-inventory-page {
2
- button {
3
- float: right;
4
- }
5
- }
@@ -1 +0,0 @@
1
- export { default } from './FileDownload';
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { noop } from 'foremanReact/common/helpers';
3
- import { translate as __ } from 'foremanReact/common/I18n';
4
-
5
- export const props = {
6
- items: [
7
- {
8
- icon: 'some-icon',
9
- name: __('Generating'),
10
- component: () => <p>test1</p>,
11
- onClick: noop,
12
- },
13
- {
14
- icon: 'other-icon',
15
- name: __('Uploading'),
16
- component: () => <p>test2</p>,
17
- onClick: noop,
18
- },
19
- ],
20
- };
@@ -1,66 +0,0 @@
1
- import React from 'react';
2
- import { useSelector } from 'react-redux';
3
- import PropTypes from 'prop-types';
4
- import {
5
- TabContainer,
6
- Nav,
7
- NavItem,
8
- TabContent,
9
- TabPane,
10
- Icon,
11
- } from 'patternfly-react';
12
- import { translate as __ } from 'foremanReact/common/I18n';
13
- import './navContainer.scss';
14
- import { selectSubscriptionConnectionEnabled } from '../InventorySettings/InventorySettingsSelectors';
15
-
16
- const NavContainer = ({ items }) => {
17
- const subscriptionConnectionEnabled = useSelector(
18
- selectSubscriptionConnectionEnabled
19
- );
20
- const navItems = items.map((item, index) => {
21
- const { name, icon, onClick } = item;
22
- if (name === __('Uploading') && !subscriptionConnectionEnabled) return null;
23
-
24
- return (
25
- <NavItem
26
- key={index}
27
- eventKey={index}
28
- onClick={onClick}
29
- className="nav_item"
30
- >
31
- <Icon name={icon} size="2x" />
32
- <p>{name}</p>
33
- </NavItem>
34
- );
35
- });
36
- const tabComponents = items.map(({ component: Component, props }, index) => (
37
- <TabPane key={index} eventKey={index}>
38
- <Component {...props} />
39
- </TabPane>
40
- ));
41
- return (
42
- <TabContainer id="basic-tabs-pf" defaultActiveKey={0}>
43
- <div className="dashboard">
44
- <Nav bsClass="nav nav-tabs nav-tabs-pf">{navItems}</Nav>
45
- <TabContent animation>{tabComponents}</TabContent>
46
- </div>
47
- </TabContainer>
48
- );
49
- };
50
-
51
- NavContainer.propTypes = {
52
- items: PropTypes.arrayOf(
53
- PropTypes.shape({
54
- icon: PropTypes.string,
55
- name: PropTypes.string,
56
- component: PropTypes.func,
57
- onClick: PropTypes.func,
58
- })
59
- ),
60
- };
61
-
62
- NavContainer.defaultProps = {
63
- items: [],
64
- };
65
-
66
- export default NavContainer;
@@ -1,69 +0,0 @@
1
- import React from 'react';
2
- import { Provider } from 'react-redux';
3
- import configureMockStore from 'redux-mock-store';
4
- import thunk from 'redux-thunk';
5
- import { screen, render } from '@testing-library/react';
6
- import { mount } from '@theforeman/test';
7
- import NavContainer from '../NavContainer';
8
- import { props } from '../NavContainer.fixtures';
9
-
10
- const middlewares = [thunk];
11
- const mockStore = configureMockStore(middlewares);
12
-
13
- describe('NavContainer', () => {
14
- const renderOptions = {
15
- API: {
16
- INVENTORY_SETTINGS: {
17
- response: { subscriptionConnectionEnabled: false },
18
- },
19
- },
20
- };
21
-
22
- test('click should call onTabClick prop', () => {
23
- const onTabClick = jest.fn();
24
- const modifiedProps = {
25
- ...props,
26
- };
27
- modifiedProps.items[0].onClick = onTabClick;
28
- const store = mockStore(renderOptions);
29
-
30
- const wrapper = mount(
31
- <Provider store={store}>
32
- <NavContainer {...modifiedProps} />
33
- </Provider>
34
- );
35
- wrapper.find('NavItem a').simulate('click');
36
- expect(onTabClick).toBeCalled();
37
- });
38
-
39
- test('when subscription connection is enabled', () => {
40
- const options = {
41
- API: {
42
- INVENTORY_SETTINGS: {
43
- response: { subscriptionConnectionEnabled: true },
44
- },
45
- },
46
- };
47
- const store = mockStore(options);
48
- render(
49
- <Provider store={store}>
50
- <NavContainer {...props} />
51
- </Provider>
52
- );
53
-
54
- expect(screen.queryAllByText('Generating')).toHaveLength(1);
55
- expect(screen.queryAllByText('Uploading')).toHaveLength(1);
56
- });
57
-
58
- test('when subscription connection is not enabled', () => {
59
- const store = mockStore(renderOptions);
60
- render(
61
- <Provider store={store}>
62
- <NavContainer {...props} />
63
- </Provider>
64
- );
65
-
66
- expect(screen.queryAllByText('Generating')).toHaveLength(1);
67
- expect(screen.queryAllByText('Uploading')).toHaveLength(0);
68
- });
69
- });
@@ -1 +0,0 @@
1
- export { default } from './NavContainer';
@@ -1,9 +0,0 @@
1
- .rh-cloud-inventory-page {
2
- .dashboard {
3
- .nav_item {
4
- font-size: 12px;
5
- text-align: center;
6
- width: 130px;
7
- }
8
- }
9
- }
@@ -1,4 +0,0 @@
1
- export const props = {
2
- date: '2019-08-21T16:14:16.520+03:00',
3
- autoUploadEnabled: true,
4
- };
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Icon, Grid } from 'patternfly-react';
4
- import { FormattedRelative } from 'react-intl';
5
- import { translate as __ } from 'foremanReact/common/I18n';
6
- import './scheduledRun.scss';
7
-
8
- const ScheduledRun = ({ date, autoUploadEnabled }) =>
9
- autoUploadEnabled && date ? (
10
- <Grid.Col sm={12} className="scheduled_run">
11
- <p>
12
- <Icon name="calendar" />
13
- {__('Next run: ')}
14
- <FormattedRelative value={date} />.
15
- </p>
16
- </Grid.Col>
17
- ) : null;
18
-
19
- ScheduledRun.propTypes = {
20
- date: PropTypes.string,
21
- autoUploadEnabled: PropTypes.bool,
22
- };
23
-
24
- ScheduledRun.defaultProps = {
25
- date: null,
26
- autoUploadEnabled: true,
27
- };
28
-
29
- export default ScheduledRun;
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import { IntlProvider } from 'react-intl';
4
- import ScheduledRun from '../ScheduledRun';
5
-
6
- const renderWithIntl = ui =>
7
- render(<IntlProvider locale="en">{ui}</IntlProvider>);
8
-
9
- describe('ScheduledRun', () => {
10
- it('renders next run info when autoUploadEnabled and date are set', () => {
11
- renderWithIntl(
12
- <ScheduledRun date="2019-08-21T16:14:16.520+03:00" autoUploadEnabled />
13
- );
14
- expect(screen.getByText(/Next run:/)).toBeTruthy();
15
- });
16
-
17
- it('renders nothing when autoUploadEnabled is false', () => {
18
- renderWithIntl(
19
- <ScheduledRun
20
- date="2019-08-21T16:14:16.520+03:00"
21
- autoUploadEnabled={false}
22
- />
23
- );
24
- expect(screen.queryByText(/Next run:/)).toBeNull();
25
- });
26
-
27
- it('renders nothing when date is null', () => {
28
- renderWithIntl(
29
- <ScheduledRun date={null} autoUploadEnabled />
30
- );
31
- expect(screen.queryByText(/Next run:/)).toBeNull();
32
- });
33
- });
@@ -1,12 +0,0 @@
1
- import { connect } from 'react-redux';
2
-
3
- import ScheduledRun from './ScheduledRun';
4
- import { selectAutoUploadEnabled } from '../InventorySettings/InventorySettingsSelectors';
5
-
6
- // map state to props
7
- const mapStateToProps = state => ({
8
- autoUploadEnabled: selectAutoUploadEnabled(state),
9
- });
10
-
11
- // export connected component
12
- export default connect(mapStateToProps)(ScheduledRun);