foreman_rh_cloud 3.0.14 → 3.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -0
  3. data/app/controllers/foreman_inventory_upload/uploads_controller.rb +11 -0
  4. data/app/controllers/insights_cloud/hits_controller.rb +24 -0
  5. data/app/controllers/insights_cloud/settings_controller.rb +8 -0
  6. data/app/models/insights_hit.rb +5 -1
  7. data/app/models/setting/rh_cloud.rb +8 -6
  8. data/app/overrides/layouts/base/styles.html.erb.deface +2 -0
  9. data/app/services/foreman_rh_cloud/cloud_connector.rb +59 -0
  10. data/app/views/layouts/foreman_rh_cloud/application.html.erb +0 -4
  11. data/config/Gemfile.lock.gh_test +830 -0
  12. data/config/database.yml.example +17 -0
  13. data/config/package-lock.json.gh_test +35653 -0
  14. data/config/routes.rb +12 -3
  15. data/lib/foreman_inventory_upload.rb +1 -1
  16. data/lib/foreman_inventory_upload/generators/archived_report.rb +1 -1
  17. data/lib/foreman_rh_cloud/engine.rb +15 -5
  18. data/lib/foreman_rh_cloud/version.rb +1 -1
  19. data/lib/tasks/rh_cloud_inventory.rake +23 -0
  20. data/package.json +18 -17
  21. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +3 -2
  22. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +1 -1
  23. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +33 -15
  24. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +43 -43
  25. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.js +6 -7
  26. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js +5 -4
  27. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +19 -34
  28. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +2 -2
  29. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +3 -3
  30. data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +28 -5
  31. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +6 -9
  32. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +1 -1
  33. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +2 -2
  34. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +5 -28
  35. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +1 -1
  36. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +2 -2
  37. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcher.js +6 -9
  38. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcherActions.js +1 -1
  39. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/ExcludePackagesSwitcherActions.test.js +2 -2
  40. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/ExcludePackagesSwitcher.test.js.snap +5 -28
  41. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/integration.test.js.snap +5 -0
  42. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js +2 -2
  43. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.js +6 -9
  44. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcherActions.js +1 -1
  45. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcherActions.test.js +2 -2
  46. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/__snapshots__/HostObfuscationSwitcher.test.js.snap +5 -28
  47. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js +6 -3
  48. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +5 -0
  49. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.js +2 -2
  50. data/webpack/ForemanInventoryUpload/Components/InventorySettings/{inventorySettings.scss → InventorySettings.scss} +2 -5
  51. data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettings.test.js.snap +1 -1
  52. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcher.js +6 -8
  53. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcherActions.js +1 -1
  54. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/IpsObfuscationSwitcherActions.test.js +2 -2
  55. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/__snapshots__/IpsObfuscationSwitcher.test.js.snap +5 -28
  56. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +10 -18
  57. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +19 -0
  58. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +53 -0
  59. data/webpack/ForemanInventoryUpload/Components/PageHeader/{components/DocsButton/__tests__/DocsButton.test.js → __tests__/PageTitle.test.js} +3 -3
  60. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +12 -38
  61. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +43 -0
  62. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorActions.js +27 -0
  63. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorButton.js +51 -0
  64. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorConstants.js +6 -0
  65. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorSelectors.js +14 -0
  66. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/CloudConnectorActions.test.js +9 -0
  67. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/CloudConnectorButton.test.js +22 -0
  68. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorActions.test.js.snap +11 -0
  69. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorButton.test.js.snap +48 -0
  70. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/index.js +27 -0
  71. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js +7 -9
  72. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +1 -1
  73. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonActions.test.js +2 -2
  74. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap +7 -9
  75. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +2 -4
  76. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/__snapshots__/ToolbarButtons.test.js.snap +1 -2
  77. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/toolbarButtons.scss +1 -2
  78. data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +1 -0
  79. data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +2 -2
  80. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +8 -14
  81. data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryUpload.test.js.snap +7 -10
  82. data/webpack/ForemanRhCloudPages.js +19 -0
  83. data/webpack/InsightsCloudSync/Components/InsightsHeader/InsightsHeader.scss +4 -0
  84. data/webpack/InsightsCloudSync/Components/InsightsHeader/index.js +16 -0
  85. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsActions.js +1 -1
  86. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettingsActions.test.js +2 -2
  87. data/webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss +1 -0
  88. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +121 -0
  89. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js +129 -0
  90. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +55 -0
  91. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableHelpers.js +31 -0
  92. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableReducer.js +28 -0
  93. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js +74 -0
  94. data/webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js +65 -0
  95. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js +13 -0
  96. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableSelectors.test.js +58 -0
  97. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +168 -0
  98. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableSelectors.test.js.snap +88 -0
  99. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/fixtures.js +104 -0
  100. data/webpack/InsightsCloudSync/Components/InsightsTable/components/EmptyState.js +53 -0
  101. data/webpack/InsightsCloudSync/Components/InsightsTable/index.js +45 -0
  102. data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +1 -0
  103. data/webpack/InsightsCloudSync/Components/NoTokenEmptyState.js +79 -0
  104. data/webpack/InsightsCloudSync/Components/__tests__/InsightsHeader.test.js +10 -0
  105. data/webpack/InsightsCloudSync/Components/__tests__/NoTokenEmptyState.test.js +19 -0
  106. data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap +13 -0
  107. data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap +214 -0
  108. data/webpack/InsightsCloudSync/InsightsCloudSync.js +45 -44
  109. data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +10 -2
  110. data/webpack/InsightsCloudSync/InsightsCloudSyncActions.js +1 -1
  111. data/webpack/InsightsCloudSync/InsightsCloudSyncConstants.js +15 -1
  112. data/webpack/InsightsCloudSync/InsightsCloudSyncHelpers.js +7 -0
  113. data/webpack/InsightsCloudSync/InsightsCloudSyncReducers.js +2 -0
  114. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +45 -62
  115. data/webpack/InsightsCloudSync/index.js +11 -3
  116. data/webpack/InsightsHostDetailsTab/InsightsTabActions.js +1 -1
  117. data/webpack/InsightsHostDetailsTab/__tests__/InsightsTabActions.test.js +2 -2
  118. data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +1 -0
  119. data/webpack/__mocks__/foremanReact/constants.js +19 -0
  120. data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +24 -0
  121. data/webpack/__mocks__/foremanReact/redux/API/index.js +11 -0
  122. data/webpack/__mocks__/foremanReact/routes/RouterSelector.js +2 -0
  123. data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +10 -0
  124. data/webpack/common/Switcher/HelpLabel.js +30 -0
  125. data/webpack/common/Switcher/SwitcherPF4.js +36 -0
  126. data/webpack/common/Switcher/SwitcherPF4.scss +10 -0
  127. data/webpack/common/Switcher/__tests__/HelpLabel.test.js +13 -0
  128. data/webpack/common/Switcher/__tests__/SwitcherPF4.test.js +14 -0
  129. data/webpack/common/Switcher/__tests__/__snapshots__/HelpLabel.test.js.snap +20 -0
  130. data/webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap +22 -0
  131. data/webpack/global_index.js +2 -0
  132. metadata +96 -34
  133. data/app/controllers/foreman_rh_cloud/react_controller.rb +0 -11
  134. data/app/views/foreman_rh_cloud/react/insights_cloud.html.erb +0 -1
  135. data/app/views/foreman_rh_cloud/react/inventory_upload.html.erb +0 -1
  136. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/listItem.scss +0 -0
  137. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/listItemStatus.scss +0 -16
  138. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/autoUploadSwitcher.scss +0 -3
  139. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/excludePackagesSwitcher.scss +0 -3
  140. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.scss +0 -3
  141. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/DocsButton.js +0 -18
  142. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/__tests__/__snapshots__/DocsButton.test.js.snap +0 -21
  143. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/index.js +0 -1
  144. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/HistoryButton.js +0 -19
  145. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/HistoryButton.test.js +0 -12
  146. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/__snapshots__/HistoryButton.test.js.snap +0 -22
  147. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/index.js +0 -1
  148. data/webpack/ForemanInventoryUpload/Components/PageHeader/pageHeader.scss +0 -3
  149. data/webpack/__mocks__/foremanReact/API.js +0 -7
@@ -1,15 +1,12 @@
1
- .inventory_settings {
1
+ .inventory-settings {
2
2
  border: 1px solid #ededed;
3
3
  border-radius: 4px;
4
4
  padding: 10px;
5
5
  margin-bottom: 15px;
6
+ float: right;
6
7
 
7
8
  h3 {
8
9
  margin-top: 0;
9
10
  font-weight: 600;
10
11
  }
11
-
12
- .bootstrap-switch {
13
- float: right;
14
- }
15
12
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  exports[`InventorySettings rendering render without Props 1`] = `
4
4
  <div
5
- className="inventory_settings"
5
+ className="inventory-settings"
6
6
  >
7
7
  <h3>
8
8
  Settings
@@ -1,17 +1,15 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Switch, FieldLevelHelp } from 'patternfly-react';
4
3
  import { translate as __ } from 'foremanReact/common/I18n';
4
+ import SwitcherPF4 from '../../../common/Switcher/SwitcherPF4';
5
5
 
6
6
  const IpsObfuscationSwitcher = ({ ipsObfuscationEnabled, handleToggle }) => (
7
7
  <div className="ips_obfuscation_switcher">
8
- <span>Obfuscate host ipv4 addresses</span>
9
- <FieldLevelHelp
10
- content={__('Obfuscate ipv4 addresses sent to the Red Hat cloud')}
11
- />
12
- <Switch
13
- size="mini"
14
- value={ipsObfuscationEnabled}
8
+ <SwitcherPF4
9
+ id="ips-obfuscation-settings-switcher"
10
+ label={__('Obfuscate host ipv4 addresses')}
11
+ tooltip={__('Obfuscate ipv4 addresses sent to the Red Hat cloud')}
12
+ isChecked={ipsObfuscationEnabled}
15
13
  onChange={() => handleToggle(ipsObfuscationEnabled)}
16
14
  />
17
15
  </div>
@@ -1,4 +1,4 @@
1
- import API from 'foremanReact/API';
1
+ import { API } from 'foremanReact/redux/API';
2
2
  import { addToast } from 'foremanReact/redux/actions/toasts';
3
3
  import { inventoryUrl } from '../../ForemanInventoryHelpers';
4
4
  import { IPS_OBFUSCATION_TOGGLE } from './IpsObfuscationSwitcherConstants';
@@ -1,9 +1,9 @@
1
1
  import { testActionSnapshotWithFixtures } from '@theforeman/test';
2
- import API from 'foremanReact/API';
2
+ import { API } from 'foremanReact/redux/API';
3
3
  import { handleToggle } from '../IpsObfuscationSwitcherActions';
4
4
  import { handleToggleResponse } from '../IpsObfuscationSwitcher.fixtures';
5
5
 
6
- jest.mock('foremanReact/API');
6
+ jest.mock('foremanReact/redux/API');
7
7
  API.post.mockImplementation(async () => handleToggleResponse);
8
8
 
9
9
  const fixtures = {
@@ -4,35 +4,12 @@ exports[`IpsObfuscationSwitcher rendering render with props 1`] = `
4
4
  <div
5
5
  className="ips_obfuscation_switcher"
6
6
  >
7
- <span>
8
- Obfuscate host ipv4 addresses
9
- </span>
10
- <FieldLevelHelp
11
- buttonClass=""
12
- content="Obfuscate ipv4 addresses sent to the Red Hat cloud"
13
- placement="top"
14
- rootClose={true}
15
- />
16
- <Switch
17
- animate={true}
18
- baseClass="bootstrap-switch"
19
- bsSize={null}
20
- defaultValue={true}
21
- disabled={false}
22
- handleWidth="auto"
23
- inverse={false}
24
- labelText=" "
25
- labelWidth="auto"
26
- offColor="default"
27
- offText="OFF"
7
+ <SwitcherPF4
8
+ id="ips-obfuscation-settings-switcher"
9
+ isChecked={true}
10
+ label="Obfuscate host ipv4 addresses"
28
11
  onChange={[Function]}
29
- onColor="primary"
30
- onText="ON"
31
- readonly={false}
32
- size="mini"
33
- tristate={false}
34
- value={true}
35
- wrapperClass="wrapper"
12
+ tooltip="Obfuscate ipv4 addresses sent to the Red Hat cloud"
36
13
  />
37
14
  </div>
38
15
  `;
@@ -4,33 +4,25 @@ import InventorySettings from '../InventorySettings';
4
4
  import PageDescription from './components/PageDescription';
5
5
  import InventoryFilter from '../InventoryFilter';
6
6
  import ToolbarButtons from './components/ToolbarButtons';
7
- import { INVENTORY_PAGE_TITLE } from '../../ForemanInventoryConstants';
8
- import './pageHeader.scss';
7
+ import PageTitle from './PageTitle';
8
+ import './PageHeader.scss';
9
9
 
10
10
  const PageHeader = () => (
11
- <React.Fragment>
12
- <Grid.Row>
13
- <Grid.Col xs={6}>
14
- <h1 className="inventory_title">{INVENTORY_PAGE_TITLE}</h1>
15
- </Grid.Col>
16
- </Grid.Row>
17
- <Grid.Row>
18
- <Grid.Col xs={9}>
19
- <PageDescription />
20
- </Grid.Col>
21
- <Grid.Col xs={3}>
22
- <InventorySettings />
23
- </Grid.Col>
24
- </Grid.Row>
11
+ <div className="inventory-upload-header">
12
+ <PageTitle />
13
+ <div className="inventory-upload-header-description">
14
+ <InventorySettings />
15
+ <PageDescription />
16
+ </div>
25
17
  <Grid.Row>
26
18
  <Grid.Col xs={4}>
27
19
  <InventoryFilter />
28
20
  </Grid.Col>
29
- <Grid.Col xs={6} xsOffset={2}>
21
+ <Grid.Col xs={7} xsOffset={1}>
30
22
  <ToolbarButtons />
31
23
  </Grid.Col>
32
24
  </Grid.Row>
33
- </React.Fragment>
25
+ </div>
34
26
  );
35
27
 
36
28
  PageHeader.propTypes = {};
@@ -0,0 +1,19 @@
1
+ .rh-cloud-page {
2
+ .inventory-upload-header {
3
+ .inventory-upload-header-description {
4
+ overflow: auto;
5
+ }
6
+
7
+ .inventory-upload-header-title {
8
+ margin-top: -15px;
9
+
10
+ h1 {
11
+ margin: 0;
12
+ }
13
+ }
14
+
15
+ .title-dropdown {
16
+ float: right;
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,53 @@
1
+ import React, { useState } from 'react';
2
+ import {
3
+ Dropdown,
4
+ DropdownItem,
5
+ KebabToggle,
6
+ DropdownPosition,
7
+ } from '@patternfly/react-core';
8
+ import {
9
+ INVENTORY_PAGE_TITLE,
10
+ ACTIONS_HISTORY_BUTTON_TEXT,
11
+ DOCS_BUTTON_TEXT,
12
+ } from '../../ForemanInventoryConstants';
13
+ import {
14
+ getActionsHistoryUrl,
15
+ getInventoryDocsUrl,
16
+ } from '../../ForemanInventoryHelpers';
17
+
18
+ const PageTitle = () => {
19
+ const [isDropdownOpen, setIsDropdownOpen] = useState(false);
20
+ const dropdownItems = [
21
+ <DropdownItem
22
+ key="tasks-history-button"
23
+ href={getActionsHistoryUrl()}
24
+ target="_blank"
25
+ rel="noopener noreferrer"
26
+ >
27
+ {ACTIONS_HISTORY_BUTTON_TEXT}
28
+ </DropdownItem>,
29
+ <DropdownItem
30
+ key="inventory-documentation-button"
31
+ href={getInventoryDocsUrl()}
32
+ target="_blank"
33
+ rel="noopener noreferrer"
34
+ >
35
+ {DOCS_BUTTON_TEXT}
36
+ </DropdownItem>,
37
+ ];
38
+ return (
39
+ <div className="row form-group inventory-upload-header-title">
40
+ <h1 className="col-md-8">{INVENTORY_PAGE_TITLE}</h1>
41
+ <Dropdown
42
+ className="title-dropdown"
43
+ onSelect={() => setIsDropdownOpen(false)}
44
+ toggle={<KebabToggle onToggle={isOpen => setIsDropdownOpen(isOpen)} />}
45
+ isOpen={isDropdownOpen}
46
+ isPlain
47
+ dropdownItems={dropdownItems}
48
+ position={DropdownPosition.right}
49
+ />
50
+ </div>
51
+ );
52
+ };
53
+ export default PageTitle;
@@ -1,12 +1,12 @@
1
1
  import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
- import DocsButton from '../DocsButton';
3
+ import PageTitle from '../PageTitle';
4
4
 
5
5
  const fixtures = {
6
6
  'render without Props': {},
7
7
  };
8
8
 
9
- describe('DocsButton', () => {
9
+ describe('PageTitle', () => {
10
10
  describe('rendering', () =>
11
- testComponentSnapshotsWithFixtures(DocsButton, fixtures));
11
+ testComponentSnapshotsWithFixtures(PageTitle, fixtures));
12
12
  });
@@ -1,42 +1,16 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`PageHeader rendering render without Props 1`] = `
4
- <Fragment>
5
- <Row
6
- bsClass="row"
7
- componentClass="div"
8
- >
9
- <Col
10
- bsClass="col"
11
- componentClass="div"
12
- xs={6}
13
- >
14
- <h1
15
- className="inventory_title"
16
- >
17
- Red Hat Inventory
18
- </h1>
19
- </Col>
20
- </Row>
21
- <Row
22
- bsClass="row"
23
- componentClass="div"
4
+ <div
5
+ className="inventory-upload-header"
6
+ >
7
+ <PageTitle />
8
+ <div
9
+ className="inventory-upload-header-description"
24
10
  >
25
- <Col
26
- bsClass="col"
27
- componentClass="div"
28
- xs={9}
29
- >
30
- <PageDescription />
31
- </Col>
32
- <Col
33
- bsClass="col"
34
- componentClass="div"
35
- xs={3}
36
- >
37
- <InventorySettings />
38
- </Col>
39
- </Row>
11
+ <InventorySettings />
12
+ <PageDescription />
13
+ </div>
40
14
  <Row
41
15
  bsClass="row"
42
16
  componentClass="div"
@@ -51,11 +25,11 @@ exports[`PageHeader rendering render without Props 1`] = `
51
25
  <Col
52
26
  bsClass="col"
53
27
  componentClass="div"
54
- xs={6}
55
- xsOffset={2}
28
+ xs={7}
29
+ xsOffset={1}
56
30
  >
57
31
  <ToolbarButtons />
58
32
  </Col>
59
33
  </Row>
60
- </Fragment>
34
+ </div>
61
35
  `;
@@ -0,0 +1,43 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`PageTitle rendering render without Props 1`] = `
4
+ <div
5
+ className="row form-group inventory-upload-header-title"
6
+ >
7
+ <h1
8
+ className="col-md-8"
9
+ >
10
+ Red Hat Inventory
11
+ </h1>
12
+ <Dropdown
13
+ className="title-dropdown"
14
+ dropdownItems={
15
+ Array [
16
+ <DropdownItem
17
+ href="/foreman_tasks/tasks?search=action++%3D++ForemanInventoryUpload%3A%3AAsync%3A%3AGenerateReportJob+or+action++%3D++ForemanInventoryUpload%3A%3AAsync%3A%3AGenerateAllReportsJob&page=1"
18
+ rel="noopener noreferrer"
19
+ target="_blank"
20
+ >
21
+ Actions history
22
+ </DropdownItem>,
23
+ <DropdownItem
24
+ href="/links/manual/+?root_url=https%3A%2F%2Faccess.redhat.com%2Fproducts%2Fsubscription-central"
25
+ rel="noopener noreferrer"
26
+ target="_blank"
27
+ >
28
+ Documentation
29
+ </DropdownItem>,
30
+ ]
31
+ }
32
+ isOpen={false}
33
+ isPlain={true}
34
+ onSelect={[Function]}
35
+ position="right"
36
+ toggle={
37
+ <KebabToggle
38
+ onToggle={[Function]}
39
+ />
40
+ }
41
+ />
42
+ </div>
43
+ `;
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { translate as __ } from 'foremanReact/common/I18n';
3
+ import { get, post } from 'foremanReact/redux/API';
4
+ import { CONFIGURE_CLOUD_CONNECTOR } from './CloudConnectorConstants';
5
+ import { inventoryUrl } from '../../../../ForemanInventoryHelpers';
6
+ import { foremanUrl } from '../../../../../ForemanRhCloudHelpers';
7
+
8
+ export const configureCloudConnector = () =>
9
+ post({
10
+ key: CONFIGURE_CLOUD_CONNECTOR,
11
+ url: inventoryUrl('cloud_connector'),
12
+ successToast: response => (
13
+ <span>
14
+ {__('Cloud connector setup is in progress now: ')}
15
+ <a href={foremanUrl(`/job_invocations/${response.data.id}`)}>
16
+ {__('Cloud connector job link')}
17
+ </a>
18
+ </span>
19
+ ),
20
+ errorToast: error => `${__('Cloud connector setup has failed: ')} ${error}`,
21
+ });
22
+
23
+ export const getCloudConnector = () =>
24
+ get({
25
+ key: CONFIGURE_CLOUD_CONNECTOR,
26
+ url: inventoryUrl('cloud_connector'),
27
+ });
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Spinner, Button, Popover } from '@patternfly/react-core';
4
+ import { translate as __ } from 'foremanReact/common/I18n';
5
+ import { CONNECTOR_STATUS } from './CloudConnectorConstants';
6
+
7
+ export const CloudConnectorButton = ({ status, onClick, jobLink }) => {
8
+ if (status === CONNECTOR_STATUS.PENDING) {
9
+ return (
10
+ <Popover
11
+ bodyContent={
12
+ <div>
13
+ {__('Cloud connector job is still running, you can view it here:')}
14
+ <a href={jobLink} target="_blank" rel="noopener noreferrer">
15
+ {__('Open job')}
16
+ </a>
17
+ </div>
18
+ }
19
+ aria-label="Popover with Link to cloud connector job"
20
+ closeBtnAriaLabel="Close cloud connector Popover"
21
+ >
22
+ <Button variant="secondary">
23
+ <Spinner size="sm" /> {__('Cloud Connector in progress')}
24
+ </Button>
25
+ </Popover>
26
+ );
27
+ }
28
+
29
+ if (status === CONNECTOR_STATUS.RESOLVED) {
30
+ return (
31
+ <Button variant="secondary" isDisabled>
32
+ {__('Cloud Connector is configured')}
33
+ </Button>
34
+ );
35
+ }
36
+
37
+ return (
38
+ <Button variant="secondary" onClick={onClick}>
39
+ {__('Configure Cloud Connector')}
40
+ </Button>
41
+ );
42
+ };
43
+
44
+ CloudConnectorButton.propTypes = {
45
+ status: PropTypes.string.isRequired,
46
+ onClick: PropTypes.func.isRequired,
47
+ jobLink: PropTypes.string,
48
+ };
49
+ CloudConnectorButton.defaultProps = {
50
+ jobLink: '',
51
+ };