foreman_rh_cloud 11.4.0 → 12.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 (78) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/rh_cloud/inventory_controller.rb +2 -2
  3. data/app/controllers/concerns/inventory_upload/report_actions.rb +1 -1
  4. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +2 -0
  5. data/app/controllers/foreman_inventory_upload/uploads_settings_controller.rb +2 -0
  6. data/app/services/foreman_rh_cloud/cloud_request.rb +4 -0
  7. data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +7 -1
  8. data/app/services/foreman_rh_cloud/rules_ingester.rb +12 -1
  9. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +3 -3
  10. data/lib/foreman_inventory_upload/async/upload_report_job.rb +4 -4
  11. data/lib/foreman_inventory_upload/generators/queries.rb +2 -0
  12. data/lib/foreman_inventory_upload/generators/slice.rb +83 -42
  13. data/lib/foreman_inventory_upload.rb +5 -0
  14. data/lib/foreman_rh_cloud/engine.rb +15 -3
  15. data/lib/foreman_rh_cloud/version.rb +1 -1
  16. data/lib/foreman_rh_cloud.rb +2 -0
  17. data/package.json +5 -5
  18. data/test/controllers/inventory_upload/api/inventory_controller_test.rb +1 -1
  19. data/test/jobs/upload_report_job_test.rb +1 -1
  20. data/test/unit/slice_generator_test.rb +212 -4
  21. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +1 -7
  22. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +1 -5
  23. data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +3 -3
  24. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +5 -1
  25. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/Dashboard.test.js.snap +2 -1
  26. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +1 -1
  27. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/inventoryFilter.scss +1 -1
  28. data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/AdvancedSettingsConstants.js +27 -8
  29. data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js +11 -3
  30. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.js +71 -10
  31. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettingsSelectors.js +13 -1
  32. data/webpack/ForemanInventoryUpload/Components/InventorySettings/MinimalInventoryDropdown.js +107 -0
  33. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +9 -2
  34. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js +8 -0
  35. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +53 -9
  36. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +5 -5
  37. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +5 -4
  38. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js +18 -3
  39. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +72 -58
  40. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/PageDescription.test.js +61 -6
  41. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js +0 -1
  42. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap +0 -1
  43. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +18 -6
  44. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/ToolbarButtons.test.js +54 -6
  45. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.fixtures.js +2 -0
  46. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.js +8 -0
  47. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/__snapshots__/ReportGenerate.test.js.snap +4 -2
  48. data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.js +1 -8
  49. data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/__snapshots__/ReportUpload.test.js.snap +4 -2
  50. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js +47 -28
  51. data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +46 -8
  52. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/InventoryAutoUpload.js +2 -7
  53. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/__snapshots__/InventoryAutoUpload.test.js.snap +3 -16
  54. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +5 -1
  55. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +1 -1
  56. data/webpack/InsightsCloudSync/Components/InsightsTable/Pagination.js +7 -7
  57. data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +1 -1
  58. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +5 -1
  59. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationTableConstants.js +8 -1
  60. data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +8 -2
  61. data/webpack/InsightsCloudSync/InsightsCloudSync.scss +1 -1
  62. data/webpack/InsightsHostDetailsTab/InsightsTotalRiskChart.js +11 -2
  63. data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +5 -4
  64. data/webpack/common/DropdownToggle.js +2 -2
  65. data/webpack/common/Switcher/HelpLabel.js +1 -1
  66. data/webpack/common/Switcher/SwitcherPF4.js +11 -1
  67. data/webpack/common/Switcher/SwitcherPF4.scss +1 -1
  68. data/webpack/common/Switcher/__tests__/__snapshots__/HelpLabel.test.js.snap +2 -6
  69. data/webpack/common/table/EmptyState.js +25 -18
  70. metadata +4 -43
  71. data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/InventorySettings.test.js +0 -13
  72. data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettings.test.js.snap +0 -31
  73. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +0 -89
  74. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap +0 -62
  75. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/__snapshots__/ToolbarButtons.test.js.snap +0 -10
  76. data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/__snapshots__/TabHeader.test.js.snap +0 -43
  77. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/components/AdvancedSettings/AdvancedSettings.js +0 -72
  78. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/components/AdvancedSettings/index.js +0 -23
@@ -4,6 +4,7 @@ export const exitCode = 'exit 0';
4
4
  export const logs = ['No running process'];
5
5
  export const completed = 0;
6
6
  export const restartProcess = noop;
7
+ export const downloadReports = noop;
7
8
  export const error = null;
8
9
  export const scheduled = '2019-08-21T16:14:16.520+03:00';
9
10
  export const props = {
@@ -11,6 +12,7 @@ export const props = {
11
12
  logs,
12
13
  completed,
13
14
  restartProcess,
15
+ downloadReports,
14
16
  error,
15
17
  scheduled,
16
18
  };
@@ -12,6 +12,8 @@ const ReportGenerate = ({
12
12
  completed,
13
13
  error,
14
14
  restartProcess,
15
+ downloadReports,
16
+ downloadButtonDisabled,
15
17
  toggleFullScreen,
16
18
  scheduled,
17
19
  }) => (
@@ -19,6 +21,8 @@ const ReportGenerate = ({
19
21
  <TabHeader
20
22
  exitCode={exitCode}
21
23
  onRestart={restartProcess}
24
+ onDownload={downloadReports}
25
+ downloadButtonDisabled={downloadButtonDisabled}
22
26
  toggleFullScreen={toggleFullScreen}
23
27
  />
24
28
  <TabBody
@@ -40,6 +44,8 @@ ReportGenerate.propTypes = {
40
44
  completed: PropTypes.number,
41
45
  error: PropTypes.string,
42
46
  restartProcess: PropTypes.func,
47
+ downloadReports: PropTypes.func,
48
+ downloadButtonDisabled: PropTypes.func,
43
49
  toggleFullScreen: PropTypes.func,
44
50
  scheduled: PropTypes.string,
45
51
  };
@@ -50,6 +56,8 @@ ReportGenerate.defaultProps = {
50
56
  completed: 0,
51
57
  error: null,
52
58
  restartProcess: noop,
59
+ downloadReports: noop,
60
+ downloadButtonDisabled: noop,
53
61
  toggleFullScreen: noop,
54
62
  scheduled: null,
55
63
  };
@@ -5,8 +5,9 @@ exports[`ReportGenerate rendering render with Props 1`] = `
5
5
  className="report-generate"
6
6
  >
7
7
  <TabHeader
8
+ downloadButtonDisabled={[Function]}
8
9
  exitCode="exit 0"
9
- onDownload={null}
10
+ onDownload={[Function]}
10
11
  onRestart={[Function]}
11
12
  toggleFullScreen={[Function]}
12
13
  />
@@ -29,8 +30,9 @@ exports[`ReportGenerate rendering render without Props 1`] = `
29
30
  className="report-generate"
30
31
  >
31
32
  <TabHeader
33
+ downloadButtonDisabled={[Function]}
32
34
  exitCode=""
33
- onDownload={null}
35
+ onDownload={[Function]}
34
36
  onRestart={[Function]}
35
37
  toggleFullScreen={[Function]}
36
38
  />
@@ -10,16 +10,11 @@ const ReportUpload = ({
10
10
  exitCode,
11
11
  logs,
12
12
  completed,
13
- downloadReports,
14
13
  error,
15
14
  toggleFullScreen,
16
15
  }) => (
17
16
  <TabContainer className="report-upload">
18
- <TabHeader
19
- exitCode={exitCode}
20
- onDownload={downloadReports}
21
- toggleFullScreen={toggleFullScreen}
22
- />
17
+ <TabHeader exitCode={exitCode} toggleFullScreen={toggleFullScreen} />
23
18
  <TabBody
24
19
  exitCode={exitCode}
25
20
  logs={logs}
@@ -36,7 +31,6 @@ ReportUpload.propTypes = {
36
31
  PropTypes.string,
37
32
  ]),
38
33
  completed: PropTypes.number,
39
- downloadReports: PropTypes.func,
40
34
  error: PropTypes.string,
41
35
  toggleFullScreen: PropTypes.func,
42
36
  };
@@ -45,7 +39,6 @@ ReportUpload.defaultProps = {
45
39
  exitCode: '',
46
40
  logs: null,
47
41
  completed: 0,
48
- downloadReports: noop,
49
42
  error: null,
50
43
  toggleFullScreen: noop,
51
44
  };
@@ -5,8 +5,9 @@ exports[`ReportUpload rendering render with Props 1`] = `
5
5
  className="report-upload"
6
6
  >
7
7
  <TabHeader
8
+ downloadButtonDisabled={[Function]}
8
9
  exitCode="exit 0"
9
- onDownload={[Function]}
10
+ onDownload={null}
10
11
  onRestart={null}
11
12
  toggleFullScreen={[Function]}
12
13
  />
@@ -29,8 +30,9 @@ exports[`ReportUpload rendering render without Props 1`] = `
29
30
  className="report-upload"
30
31
  >
31
32
  <TabHeader
33
+ downloadButtonDisabled={[Function]}
32
34
  exitCode=""
33
- onDownload={[Function]}
35
+ onDownload={null}
34
36
  onRestart={null}
35
37
  toggleFullScreen={[Function]}
36
38
  />
@@ -1,45 +1,63 @@
1
1
  import React from 'react';
2
+ import { useSelector } from 'react-redux';
2
3
  import PropTypes from 'prop-types';
3
4
  import { Grid, Button, Icon } from 'patternfly-react';
4
5
  import { noop } from 'foremanReact/common/helpers';
5
6
  import { sprintf, translate as __ } from 'foremanReact/common/I18n';
7
+ import { selectSubscriptionConnectionEnabled } from '../InventorySettings/InventorySettingsSelectors';
6
8
  import { isExitCodeLoading } from '../../ForemanInventoryHelpers';
7
9
  import './tabHeader.scss';
8
10
 
9
- const TabHeader = ({ exitCode, onRestart, onDownload, toggleFullScreen }) => (
10
- <Grid.Row className="tab-header">
11
- <Grid.Col sm={6}>
12
- <p>{sprintf(__('Exit Code: %s'), exitCode)}</p>
13
- </Grid.Col>
14
- <Grid.Col sm={6}>
15
- <div className="tab-action-buttons">
16
- {onRestart ? (
17
- <Button
18
- bsStyle="primary"
19
- onClick={onRestart}
20
- disabled={isExitCodeLoading(exitCode)}
21
- >
22
- {__('Generate and upload report')}
23
- </Button>
24
- ) : null}
25
- {onDownload ? (
26
- <Button onClick={onDownload}>
27
- {__('Download Report')} <Icon name="download" />
11
+ const TabHeader = ({
12
+ exitCode,
13
+ onRestart,
14
+ onDownload,
15
+ downloadButtonDisabled,
16
+ toggleFullScreen,
17
+ }) => {
18
+ const subscriptionConnectionEnabled = useSelector(
19
+ selectSubscriptionConnectionEnabled
20
+ );
21
+ const buttonGenerateLabel = subscriptionConnectionEnabled
22
+ ? __('Generate and upload report')
23
+ : __('Generate report');
24
+
25
+ return (
26
+ <Grid.Row className="tab-header">
27
+ <Grid.Col sm={6}>
28
+ <p>{sprintf(__('Exit Code: %s'), exitCode)}</p>
29
+ </Grid.Col>
30
+ <Grid.Col sm={6}>
31
+ <div className="tab-action-buttons">
32
+ {onRestart ? (
33
+ <Button
34
+ bsStyle="primary"
35
+ onClick={onRestart}
36
+ disabled={isExitCodeLoading(exitCode)}
37
+ >
38
+ {buttonGenerateLabel}
39
+ </Button>
40
+ ) : null}
41
+ {onDownload ? (
42
+ <Button onClick={onDownload} disabled={downloadButtonDisabled()}>
43
+ {__('Download Report')} <Icon name="download" />
44
+ </Button>
45
+ ) : null}
46
+ <Button onClick={toggleFullScreen}>
47
+ {__('Full Screen')}
48
+ <Icon name="arrows-alt" />
28
49
  </Button>
29
- ) : null}
30
- <Button onClick={toggleFullScreen}>
31
- {__('Full Screen')}
32
- <Icon name="arrows-alt" />
33
- </Button>
34
- </div>
35
- </Grid.Col>
36
- </Grid.Row>
37
- );
50
+ </div>
51
+ </Grid.Col>
52
+ </Grid.Row>
53
+ );
54
+ };
38
55
 
39
56
  TabHeader.propTypes = {
40
57
  onRestart: PropTypes.func,
41
58
  onDownload: PropTypes.func,
42
59
  exitCode: PropTypes.string,
60
+ downloadButtonDisabled: PropTypes.func,
43
61
  toggleFullScreen: PropTypes.func,
44
62
  };
45
63
 
@@ -47,6 +65,7 @@ TabHeader.defaultProps = {
47
65
  onRestart: null,
48
66
  exitCode: '',
49
67
  onDownload: null,
68
+ downloadButtonDisabled: noop,
50
69
  toggleFullScreen: noop,
51
70
  };
52
71
 
@@ -1,13 +1,51 @@
1
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
-
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 { noop } from 'foremanReact/common/helpers';
3
7
  import TabHeader from '../TabHeader';
4
8
 
5
- const fixtures = {
6
- 'render without Props': {},
7
- /** fixtures, props for the component */
8
- };
9
+ const middlewares = [thunk];
10
+ const mockStore = configureMockStore(middlewares);
9
11
 
10
12
  describe('TabHeader', () => {
11
- describe('rendering', () =>
12
- testComponentSnapshotsWithFixtures(TabHeader, fixtures));
13
+ test('when subscription connection is enabled', () => {
14
+ const renderOptions = {
15
+ API: {
16
+ INVENTORY_SETTINGS: {
17
+ response: { subscriptionConnectionEnabled: true },
18
+ },
19
+ },
20
+ };
21
+ const store = mockStore(renderOptions);
22
+
23
+ render(
24
+ <Provider store={store}>
25
+ <TabHeader exitCode="exit 0" onRestart={noop} toggleFullScreen={noop} />
26
+ </Provider>
27
+ );
28
+ expect(screen.queryAllByText('Generate and upload report')).toHaveLength(1);
29
+ expect(screen.queryAllByText('Full Screen')).toHaveLength(1);
30
+ });
31
+
32
+ test('when subscription connection is not enabled', () => {
33
+ const renderOptions = {
34
+ API: {
35
+ INVENTORY_SETTINGS: {
36
+ response: { subscriptionConnectionEnabled: false },
37
+ },
38
+ },
39
+ };
40
+ const store = mockStore(renderOptions);
41
+
42
+ render(
43
+ <Provider store={store}>
44
+ <TabHeader exitCode="exit 0" onRestart={noop} toggleFullScreen={noop} />
45
+ </Provider>
46
+ );
47
+
48
+ expect(screen.queryAllByText('Generate report')).toHaveLength(1);
49
+ expect(screen.queryAllByText('Full Screen')).toHaveLength(1);
50
+ });
13
51
  });
@@ -6,8 +6,8 @@ import { FormGroup, Grid } from 'patternfly-react';
6
6
  import { translate as __ } from 'foremanReact/common/I18n';
7
7
  import { foremanUrl } from '../../../ForemanRhCloudHelpers';
8
8
  import Switcher from '../../../common/Switcher';
9
- import AdvancedSettings from './components/AdvancedSettings';
10
9
  import { settingsDict } from '../../Components/InventorySettings/AdvancedSetting/AdvancedSettingsConstants';
10
+ import InventorySettings from '../../Components/InventorySettings/InventorySettings';
11
11
 
12
12
  const InventoryAutoUploadSwitcher = ({
13
13
  autoUploadEnabled,
@@ -44,12 +44,7 @@ const InventoryAutoUploadSwitcher = ({
44
44
  headerContent={
45
45
  <strong>{__('Advanced Inventory Settings')}</strong>
46
46
  }
47
- bodyContent={
48
- <AdvancedSettings
49
- autoUploadEnabled={autoUploadEnabled}
50
- handleToggle={handleToggle}
51
- />
52
- }
47
+ bodyContent={<InventorySettings />}
53
48
  position="right"
54
49
  >
55
50
  <Button
@@ -32,12 +32,7 @@ exports[`InventoryAutoUpload rendering render with props 1`] = `
32
32
  sm={5}
33
33
  >
34
34
  <Popover
35
- bodyContent={
36
- <Memo(Connect(AdvancedSettings))
37
- autoUploadEnabled={true}
38
- handleToggle={[Function]}
39
- />
40
- }
35
+ bodyContent={<InventorySettings />}
41
36
  headerContent={
42
37
  <strong>
43
38
  Advanced Inventory Settings
@@ -56,11 +51,7 @@ exports[`InventoryAutoUpload rendering render with props 1`] = `
56
51
  >
57
52
  Show Advanced Settings
58
53
 
59
- <CaretRightIcon
60
- color="currentColor"
61
- noVerticalAlign={false}
62
- size="sm"
63
- />
54
+ <CaretRightIcon />
64
55
  </Button>
65
56
  </Popover>
66
57
  </Col>
@@ -78,11 +69,7 @@ exports[`InventoryAutoUpload rendering render with props 1`] = `
78
69
  <Text
79
70
  component="p"
80
71
  >
81
- <InfoAltIcon
82
- color="currentColor"
83
- noVerticalAlign={false}
84
- size="sm"
85
- />
72
+ <InfoAltIcon />
86
73
 
87
74
  More details can be found in
88
75
 
@@ -1,7 +1,11 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
2
  import React, { useEffect } from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { Table, TableHeader, TableBody } from '@patternfly/react-table';
4
+ import {
5
+ Table,
6
+ TableHeader,
7
+ TableBody,
8
+ } from '@patternfly/react-table/deprecated';
5
9
  import { useForemanSettings } from 'foremanReact/Root/Context/ForemanContext';
6
10
  import SelectAllAlert from './SelectAllAlert';
7
11
  import {
@@ -4,7 +4,7 @@ import {
4
4
  InsightsLabel,
5
5
  Section,
6
6
  } from '@redhat-cloud-services/frontend-components';
7
- import { DropdownItem } from '@patternfly/react-core';
7
+ import { DropdownItem } from '@patternfly/react-core/deprecated';
8
8
  import { sortable, cellWidth } from '@patternfly/react-table';
9
9
  import { AnsibeTowerIcon, ExternalLinkAltIcon } from '@patternfly/react-icons';
10
10
  import { translate as __ } from 'foremanReact/common/I18n';
@@ -20,13 +20,13 @@ const paginationTitles = {
20
20
  page: '', // doesn't work well with translations as it adds 's' for plural, see: https://github.com/patternfly/patternfly-react/issues/6707
21
21
  itemsPerPage: __('Items per page'),
22
22
  perPageSuffix: __('per page'),
23
- toFirstPage: __('Go to first page'),
24
- toPreviousPage: __('Go to previous page'),
25
- toLastPage: __('Go to last page'),
26
- toNextPage: __('Go to next page'),
27
- optionsToggle: __('Items per page'),
28
- currPage: __('Current page'),
29
- paginationTitle: __('Pagination'),
23
+ toFirstPageAriaLabel: __('Go to first page'),
24
+ toPreviousPageAriaLabel: __('Go to previous page'),
25
+ toLastPageAriaLabel: __('Go to last page'),
26
+ toNextPageAriaLabel: __('Go to next page'),
27
+ optionsToggleAriaLabel: __('Items per page'),
28
+ currPageAriaLabel: __('Current page'),
29
+ paginationAriaLabel: __('Pagination'),
30
30
  };
31
31
 
32
32
  const Pagination = ({ variant, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  .rh-cloud-recommendations-table {
2
- .pf-c-table__check {
2
+ .pf-v5-c-table__check {
3
3
  input:disabled {
4
4
  display: none;
5
5
  }
@@ -1,7 +1,11 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
2
  import React, { useEffect } from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { Table, TableHeader, TableBody } from '@patternfly/react-table';
4
+ import {
5
+ Table,
6
+ TableHeader,
7
+ TableBody,
8
+ } from '@patternfly/react-table/deprecated';
5
9
  import { Modal, ModalVariant, Button } from '@patternfly/react-core';
6
10
  import { isEmpty } from 'lodash';
7
11
  import { STATUS } from 'foremanReact/constants';
@@ -1,11 +1,18 @@
1
1
  import React from 'react';
2
2
  import { cellWidth } from '@patternfly/react-table';
3
+ import { Icon } from '@patternfly/react-core';
3
4
  import { CheckCircleIcon } from '@patternfly/react-icons';
4
5
  import { translate as __ } from 'foremanReact/common/I18n';
5
6
  import { foremanUrl } from '../../../ForemanRhCloudHelpers';
6
7
 
7
8
  export const rebootFormatter = ({ title: reboot }) => ({
8
- children: reboot ? <CheckCircleIcon color="green" /> : __('No'),
9
+ children: reboot ? (
10
+ <Icon color="green">
11
+ <CheckCircleIcon />
12
+ </Icon>
13
+ ) : (
14
+ __('No')
15
+ ),
9
16
  });
10
17
 
11
18
  export const columns = [
@@ -1,7 +1,11 @@
1
1
  import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { translate as __ } from 'foremanReact/common/I18n';
4
- import { Dropdown, DropdownItem, KebabToggle } from '@patternfly/react-core';
4
+ import {
5
+ Dropdown,
6
+ DropdownItem,
7
+ KebabToggle,
8
+ } from '@patternfly/react-core/deprecated';
5
9
  import { ExternalLinkAltIcon } from '@patternfly/react-icons';
6
10
  import { redHatAdvisorSystems } from '../InsightsCloudSyncHelpers';
7
11
  import { useAdvisorEngineConfig } from '../../common/Hooks/ConfigHooks';
@@ -35,7 +39,9 @@ const ToolbarDropdown = ({ onRecommendationSync }) => {
35
39
  <Dropdown
36
40
  className="title-dropdown"
37
41
  onSelect={() => setIsDropdownOpen(false)}
38
- toggle={<KebabToggle onToggle={isOpen => setIsDropdownOpen(isOpen)} />}
42
+ toggle={
43
+ <KebabToggle onToggle={(_event, isOpen) => setIsDropdownOpen(isOpen)} />
44
+ }
39
45
  isOpen={isDropdownOpen}
40
46
  isPlain
41
47
  dropdownItems={dropdownItems}
@@ -78,7 +78,7 @@
78
78
  width: 100%;
79
79
  }
80
80
 
81
- .pf-c-pagination {
81
+ .pf-v5-c-pagination {
82
82
  padding-right: 0;
83
83
  }
84
84
  }
@@ -3,8 +3,14 @@ import PropTypes from 'prop-types';
3
3
  import { useDispatch } from 'react-redux';
4
4
  import { push } from 'connected-react-router';
5
5
  import { useHistory } from 'react-router-dom';
6
- import { DropdownItem, Bullseye, Title } from '@patternfly/react-core';
7
- import { ChartDonut, ChartLegend, ChartLabel } from '@patternfly/react-charts';
6
+ import { Bullseye, Title } from '@patternfly/react-core';
7
+ import { DropdownItem } from '@patternfly/react-core/deprecated';
8
+ import {
9
+ ChartDonut,
10
+ ChartLegend,
11
+ ChartLabel,
12
+ ChartTooltip,
13
+ } from '@patternfly/react-charts';
8
14
  import { STATUS } from 'foremanReact/constants';
9
15
  import { useAPI } from 'foremanReact/common/hooks/API/APIHooks';
10
16
  import CardTemplate from 'foremanReact/components/HostDetails/Templates/CardItem/CardTemplate';
@@ -90,6 +96,9 @@ const InsightsTotalRiskCard = ({ hostDetails: { id } }) => {
90
96
  { x: critical.title, y: critical.value },
91
97
  ]}
92
98
  labels={({ datum: { x, y } }) => `${x}: ${y}`}
99
+ labelComponent={
100
+ <ChartTooltip constrainToVisibleArea renderInPortal={false} />
101
+ }
93
102
  legendComponent={legend}
94
103
  legendPosition="right"
95
104
  subTitle="Recommendations"
@@ -3,13 +3,12 @@ import PropTypes from 'prop-types';
3
3
  import { useDispatch, useSelector } from 'react-redux';
4
4
  import SearchBar from 'foremanReact/components/SearchBar';
5
5
  import { translate as __ } from 'foremanReact/common/I18n';
6
+ import { Grid, GridItem } from '@patternfly/react-core';
6
7
  import {
7
- Grid,
8
- GridItem,
9
8
  Dropdown,
10
9
  DropdownItem,
11
10
  KebabToggle,
12
- } from '@patternfly/react-core';
11
+ } from '@patternfly/react-core/deprecated';
13
12
  import { ExternalLinkAltIcon } from '@patternfly/react-icons';
14
13
  import InsightsTable from '../InsightsCloudSync/Components/InsightsTable';
15
14
  import RemediationModal from '../InsightsCloudSync/Components/RemediationModal';
@@ -76,7 +75,9 @@ const NewHostDetailsTab = ({ hostName, router }) => {
76
75
  ouiaId="insights-dropdown"
77
76
  onSelect={() => setIsDropdownOpen(false)}
78
77
  toggle={
79
- <KebabToggle onToggle={isOpen => setIsDropdownOpen(isOpen)} />
78
+ <KebabToggle
79
+ onToggle={(_event, isOpen) => setIsDropdownOpen(isOpen)}
80
+ />
80
81
  }
81
82
  isOpen={isDropdownOpen}
82
83
  isPlain
@@ -1,13 +1,13 @@
1
1
  import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Dropdown, KebabToggle } from '@patternfly/react-core';
3
+ import { Dropdown, KebabToggle } from '@patternfly/react-core/deprecated';
4
4
 
5
5
  const DropdownToggle = ({ items, ...props }) => {
6
6
  const [isOpen, setOpen] = useState(false);
7
7
  return (
8
8
  <Dropdown
9
9
  onSelect={() => setOpen(false)}
10
- toggle={<KebabToggle onToggle={value => setOpen(value)} />}
10
+ toggle={<KebabToggle onToggle={(_event, value) => setOpen(value)} />}
11
11
  isOpen={isOpen}
12
12
  isPlain
13
13
  dropdownItems={items}
@@ -9,7 +9,7 @@ export const HelpLabel = ({ text, id, className }) => {
9
9
  <Popover id={`${id}-help`} bodyContent={text} aria-label="help-text">
10
10
  <button
11
11
  onClick={e => e.preventDefault()}
12
- className={`pf-c-form__group-label-help ${className}`}
12
+ className={`pf-v5-c-form__group-label-help ${className}`}
13
13
  >
14
14
  <HelpIcon />
15
15
  </button>
@@ -4,11 +4,19 @@ import { Switch } from '@patternfly/react-core';
4
4
  import { HelpLabel } from './HelpLabel';
5
5
  import './SwitcherPF4.scss';
6
6
 
7
- const SwitcherPF4 = ({ id, label, tooltip, isChecked, onChange }) => (
7
+ const SwitcherPF4 = ({
8
+ id,
9
+ label,
10
+ tooltip,
11
+ isChecked,
12
+ onChange,
13
+ isDisabled,
14
+ }) => (
8
15
  <Switch
9
16
  className="foreman-rh-cloud-switcher"
10
17
  id={`rh-cloud-switcher-${id}`}
11
18
  isChecked={isChecked}
19
+ isDisabled={isDisabled}
12
20
  onChange={onChange}
13
21
  label={
14
22
  <div>
@@ -24,6 +32,7 @@ SwitcherPF4.propTypes = {
24
32
  label: PropTypes.string,
25
33
  tooltip: PropTypes.string,
26
34
  isChecked: PropTypes.bool,
35
+ isDisabled: PropTypes.bool,
27
36
  onChange: PropTypes.func.isRequired,
28
37
  };
29
38
 
@@ -31,6 +40,7 @@ SwitcherPF4.defaultProps = {
31
40
  label: null,
32
41
  tooltip: null,
33
42
  isChecked: true,
43
+ isDisabled: false,
34
44
  };
35
45
 
36
46
  export default SwitcherPF4;
@@ -7,7 +7,7 @@ label.foreman-rh-cloud-switcher {
7
7
  padding-left: 5px;
8
8
  }
9
9
 
10
- .pf-c-switch__toggle {
10
+ .pf-v5-c-switch__toggle {
11
11
  margin-right: 5px;
12
12
  }
13
13
  }
@@ -7,14 +7,10 @@ exports[`InsightsCloudSync helpers should return insights cloud Url 1`] = `
7
7
  id="some-id-help"
8
8
  >
9
9
  <button
10
- className="pf-c-form__group-label-help some-class"
10
+ className="pf-v5-c-form__group-label-help some-class"
11
11
  onClick={[Function]}
12
12
  >
13
- <HelpIcon
14
- color="currentColor"
15
- noVerticalAlign={false}
16
- size="sm"
17
- />
13
+ <HelpIcon />
18
14
  </button>
19
15
  </Popover>
20
16
  `;