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.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +11 -0
- data/app/controllers/insights_cloud/hits_controller.rb +24 -0
- data/app/controllers/insights_cloud/settings_controller.rb +8 -0
- data/app/models/insights_hit.rb +5 -1
- data/app/models/setting/rh_cloud.rb +8 -6
- data/app/overrides/layouts/base/styles.html.erb.deface +2 -0
- data/app/services/foreman_rh_cloud/cloud_connector.rb +59 -0
- data/app/views/layouts/foreman_rh_cloud/application.html.erb +0 -4
- data/config/Gemfile.lock.gh_test +830 -0
- data/config/database.yml.example +17 -0
- data/config/package-lock.json.gh_test +35653 -0
- data/config/routes.rb +12 -3
- data/lib/foreman_inventory_upload.rb +1 -1
- data/lib/foreman_inventory_upload/generators/archived_report.rb +1 -1
- data/lib/foreman_rh_cloud/engine.rb +15 -5
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/tasks/rh_cloud_inventory.rake +23 -0
- data/package.json +18 -17
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +3 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +33 -15
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +43 -43
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.js +6 -7
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js +5 -4
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +19 -34
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +3 -3
- data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +28 -5
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +6 -9
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +5 -28
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcher.js +6 -9
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcherActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/ExcludePackagesSwitcherActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/ExcludePackagesSwitcher.test.js.snap +5 -28
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/integration.test.js.snap +5 -0
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.js +6 -9
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcherActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcherActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/__snapshots__/HostObfuscationSwitcher.test.js.snap +5 -28
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js +6 -3
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +5 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/{inventorySettings.scss → InventorySettings.scss} +2 -5
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettings.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcher.js +6 -8
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcherActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/IpsObfuscationSwitcherActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/__snapshots__/IpsObfuscationSwitcher.test.js.snap +5 -28
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +10 -18
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +19 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +53 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/{components/DocsButton/__tests__/DocsButton.test.js → __tests__/PageTitle.test.js} +3 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +12 -38
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +43 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorActions.js +27 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorButton.js +51 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorConstants.js +6 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorSelectors.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/CloudConnectorActions.test.js +9 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/CloudConnectorButton.test.js +22 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorActions.test.js.snap +11 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorButton.test.js.snap +48 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/index.js +27 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js +7 -9
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap +7 -9
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +2 -4
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/__snapshots__/ToolbarButtons.test.js.snap +1 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/toolbarButtons.scss +1 -2
- data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +1 -0
- data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +2 -2
- data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +8 -14
- data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryUpload.test.js.snap +7 -10
- data/webpack/ForemanRhCloudPages.js +19 -0
- data/webpack/InsightsCloudSync/Components/InsightsHeader/InsightsHeader.scss +4 -0
- data/webpack/InsightsCloudSync/Components/InsightsHeader/index.js +16 -0
- data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsActions.js +1 -1
- data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettingsActions.test.js +2 -2
- data/webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss +1 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +121 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js +129 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +55 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableHelpers.js +31 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableReducer.js +28 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js +74 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js +65 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js +13 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableSelectors.test.js +58 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +168 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableSelectors.test.js.snap +88 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/fixtures.js +104 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/components/EmptyState.js +53 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/index.js +45 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +1 -0
- data/webpack/InsightsCloudSync/Components/NoTokenEmptyState.js +79 -0
- data/webpack/InsightsCloudSync/Components/__tests__/InsightsHeader.test.js +10 -0
- data/webpack/InsightsCloudSync/Components/__tests__/NoTokenEmptyState.test.js +19 -0
- data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap +13 -0
- data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap +214 -0
- data/webpack/InsightsCloudSync/InsightsCloudSync.js +45 -44
- data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +10 -2
- data/webpack/InsightsCloudSync/InsightsCloudSyncActions.js +1 -1
- data/webpack/InsightsCloudSync/InsightsCloudSyncConstants.js +15 -1
- data/webpack/InsightsCloudSync/InsightsCloudSyncHelpers.js +7 -0
- data/webpack/InsightsCloudSync/InsightsCloudSyncReducers.js +2 -0
- data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +45 -62
- data/webpack/InsightsCloudSync/index.js +11 -3
- data/webpack/InsightsHostDetailsTab/InsightsTabActions.js +1 -1
- data/webpack/InsightsHostDetailsTab/__tests__/InsightsTabActions.test.js +2 -2
- data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +1 -0
- data/webpack/__mocks__/foremanReact/constants.js +19 -0
- data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +24 -0
- data/webpack/__mocks__/foremanReact/redux/API/index.js +11 -0
- data/webpack/__mocks__/foremanReact/routes/RouterSelector.js +2 -0
- data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +10 -0
- data/webpack/common/Switcher/HelpLabel.js +30 -0
- data/webpack/common/Switcher/SwitcherPF4.js +36 -0
- data/webpack/common/Switcher/SwitcherPF4.scss +10 -0
- data/webpack/common/Switcher/__tests__/HelpLabel.test.js +13 -0
- data/webpack/common/Switcher/__tests__/SwitcherPF4.test.js +14 -0
- data/webpack/common/Switcher/__tests__/__snapshots__/HelpLabel.test.js.snap +20 -0
- data/webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap +22 -0
- data/webpack/global_index.js +2 -0
- metadata +96 -34
- data/app/controllers/foreman_rh_cloud/react_controller.rb +0 -11
- data/app/views/foreman_rh_cloud/react/insights_cloud.html.erb +0 -1
- data/app/views/foreman_rh_cloud/react/inventory_upload.html.erb +0 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/listItem.scss +0 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/listItemStatus.scss +0 -16
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/autoUploadSwitcher.scss +0 -3
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/excludePackagesSwitcher.scss +0 -3
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.scss +0 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/DocsButton.js +0 -18
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/__tests__/__snapshots__/DocsButton.test.js.snap +0 -21
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/HistoryButton.js +0 -19
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/HistoryButton.test.js +0 -12
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/__snapshots__/HistoryButton.test.js.snap +0 -22
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/pageHeader.scss +0 -3
- data/webpack/__mocks__/foremanReact/API.js +0 -7
data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { testActionSnapshotWithFixtures } from '@theforeman/test';
|
2
|
-
import API from 'foremanReact/API';
|
2
|
+
import { API } from 'foremanReact/redux/API';
|
3
3
|
import {
|
4
4
|
fetchAccountsStatus,
|
5
5
|
startAccountStatusPolling,
|
@@ -12,7 +12,7 @@ import {
|
|
12
12
|
} from '../AccountList.fixtures';
|
13
13
|
import { accountID, activeTab } from '../../Dashboard/Dashboard.fixtures';
|
14
14
|
|
15
|
-
jest.mock('foremanReact/API');
|
15
|
+
jest.mock('foremanReact/redux/API');
|
16
16
|
API.get.mockImplementation(async () => fetchAccountsStatusResponse);
|
17
17
|
|
18
18
|
const fixtures = {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
2
|
|
3
3
|
exports[`AccountList rendering render with props 1`] = `
|
4
|
-
<
|
5
|
-
className="
|
4
|
+
<Accordion
|
5
|
+
className="account-list"
|
6
6
|
>
|
7
7
|
<ListItem
|
8
8
|
account={
|
@@ -37,7 +37,7 @@ exports[`AccountList rendering render with props 1`] = `
|
|
37
37
|
accountID="Account3"
|
38
38
|
key="2"
|
39
39
|
/>
|
40
|
-
</
|
40
|
+
</Accordion>
|
41
41
|
`;
|
42
42
|
|
43
43
|
exports[`AccountList rendering show empty results 1`] = `<inventoryEmptyResults />`;
|
@@ -1,9 +1,32 @@
|
|
1
|
-
.
|
2
|
-
.
|
3
|
-
margin-top:
|
1
|
+
.account-list {
|
2
|
+
.pf-c-accordion__toggle {
|
3
|
+
margin-top: 10px;
|
4
4
|
}
|
5
5
|
|
6
|
-
.
|
7
|
-
|
6
|
+
.pf-c-accordion__toggle-text {
|
7
|
+
font-size: 16px;
|
8
|
+
display: flex;
|
9
|
+
justify-content: space-between;
|
10
|
+
width: 100%;
|
11
|
+
|
12
|
+
.account-icon {
|
13
|
+
margin-right: 5px;
|
14
|
+
|
15
|
+
.pf-c-label__icon {
|
16
|
+
margin: 0;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
span {
|
21
|
+
align-self: center;
|
22
|
+
}
|
23
|
+
|
24
|
+
.status {
|
25
|
+
margin: 0;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
.list-item-status > span {
|
30
|
+
margin-left: 7px;
|
8
31
|
}
|
9
32
|
}
|
@@ -1,20 +1,17 @@
|
|
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';
|
5
|
-
import '
|
4
|
+
import SwitcherPF4 from '../../../common/Switcher/SwitcherPF4';
|
6
5
|
|
7
6
|
const AutoUploadSwitcher = ({ autoUploadEnabled, handleToggle }) => (
|
8
7
|
<div className="auto_upload_switcher">
|
9
|
-
<
|
10
|
-
|
11
|
-
|
8
|
+
<SwitcherPF4
|
9
|
+
id="auto-upload-setting-switcher"
|
10
|
+
label={__('Auto upload')}
|
11
|
+
tooltip={__(
|
12
12
|
'Enable automatic upload of your hosts inventory to the Red Hat cloud'
|
13
13
|
)}
|
14
|
-
|
15
|
-
<Switch
|
16
|
-
size="mini"
|
17
|
-
value={autoUploadEnabled}
|
14
|
+
isChecked={autoUploadEnabled}
|
18
15
|
onChange={() => handleToggle(autoUploadEnabled)}
|
19
16
|
/>
|
20
17
|
</div>
|
data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js
CHANGED
@@ -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 { AUTO_UPLOAD_TOGGLE } from './AutoUploadSwitcherConstants';
|
@@ -1,12 +1,12 @@
|
|
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 '../AutoUploadSwitcherActions';
|
4
4
|
import {
|
5
5
|
handleToggleResponse,
|
6
6
|
currentAutoUploadEnabled,
|
7
7
|
} from '../AutoUploadSwitcher.fixtures';
|
8
8
|
|
9
|
-
jest.mock('foremanReact/API');
|
9
|
+
jest.mock('foremanReact/redux/API');
|
10
10
|
API.post.mockImplementation(async () => handleToggleResponse);
|
11
11
|
|
12
12
|
const fixtures = {
|
@@ -4,35 +4,12 @@ exports[`AutoUploadSwitcher rendering render with props 1`] = `
|
|
4
4
|
<div
|
5
5
|
className="auto_upload_switcher"
|
6
6
|
>
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
buttonClass=""
|
12
|
-
content="Enable automatic upload of your hosts inventory 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="auto-upload-setting-switcher"
|
9
|
+
isChecked={true}
|
10
|
+
label="Auto upload"
|
28
11
|
onChange={[Function]}
|
29
|
-
|
30
|
-
onText="ON"
|
31
|
-
readonly={false}
|
32
|
-
size="mini"
|
33
|
-
tristate={false}
|
34
|
-
value={true}
|
35
|
-
wrapperClass="wrapper"
|
12
|
+
tooltip="Enable automatic upload of your hosts inventory to the Red Hat cloud"
|
36
13
|
/>
|
37
14
|
</div>
|
38
15
|
`;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { testActionSnapshotWithFixtures } from '@theforeman/test';
|
2
|
-
import API from 'foremanReact/API';
|
2
|
+
import { API } from 'foremanReact/redux/API';
|
3
3
|
import {
|
4
4
|
startPolling,
|
5
5
|
stopPolling,
|
@@ -16,7 +16,7 @@ import {
|
|
16
16
|
} from '../Dashboard.fixtures';
|
17
17
|
import { rhCloudStateWrapper } from '../../../../ForemanRhCloudTestHelpers';
|
18
18
|
|
19
|
-
jest.mock('foremanReact/API');
|
19
|
+
jest.mock('foremanReact/redux/API');
|
20
20
|
API.get.mockImplementation(() => serverMock);
|
21
21
|
|
22
22
|
const runWithGetState = (state, action, params) => dispatch => {
|
data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcher.js
CHANGED
@@ -1,18 +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';
|
5
|
-
import '
|
4
|
+
import SwitcherPF4 from '../../../common/Switcher/SwitcherPF4';
|
6
5
|
|
7
6
|
const ExcludePackagesSwitcher = ({ excludePackages, handleToggle }) => (
|
8
7
|
<div className="exclude_packages_switcher">
|
9
|
-
<
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
size="mini"
|
15
|
-
value={excludePackages}
|
8
|
+
<SwitcherPF4
|
9
|
+
id="exclude-packages-setting-switcher"
|
10
|
+
label={__('Exclude Packages')}
|
11
|
+
tooltip={__('Exclude packages from being uploaded to the Red Hat cloud')}
|
12
|
+
isChecked={excludePackages}
|
16
13
|
onChange={() => handleToggle(excludePackages)}
|
17
14
|
/>
|
18
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 { EXCLUDE_PACKAGES_TOGGLE } from './ExcludePackagesSwitcherConstants';
|
@@ -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 '../ExcludePackagesSwitcherActions';
|
4
4
|
import { handleToggleResponse } from '../ExcludePackagesSwitcher.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[`ExcludePackagesSwitcher rendering render with props 1`] = `
|
|
4
4
|
<div
|
5
5
|
className="exclude_packages_switcher"
|
6
6
|
>
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
buttonClass=""
|
12
|
-
content="Exclude packages from being uploaded 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="exclude-packages-setting-switcher"
|
9
|
+
isChecked={true}
|
10
|
+
label="Exclude Packages"
|
28
11
|
onChange={[Function]}
|
29
|
-
|
30
|
-
onText="ON"
|
31
|
-
readonly={false}
|
32
|
-
size="mini"
|
33
|
-
tristate={false}
|
34
|
-
value={true}
|
35
|
-
wrapperClass="wrapper"
|
12
|
+
tooltip="Exclude packages from being uploaded to the Red Hat cloud"
|
36
13
|
/>
|
37
14
|
</div>
|
38
15
|
`;
|
data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { IntegrationTestHelper } from '@theforeman/test';
|
3
|
-
import API from 'foremanReact/API';
|
3
|
+
import { API } from 'foremanReact/redux/API';
|
4
4
|
import ExcludePackagesSwitcher from '../index';
|
5
5
|
import reducers from '../../../../ForemanRhCloudReducers';
|
6
6
|
|
7
|
-
jest.mock('foremanReact/API');
|
7
|
+
jest.mock('foremanReact/redux/API');
|
8
8
|
API.post.mockImplementation(async () => ({
|
9
9
|
data: {
|
10
10
|
excludePackages: false,
|
data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.js
CHANGED
@@ -1,18 +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';
|
5
|
-
import '
|
4
|
+
import SwitcherPF4 from '../../../common/Switcher/SwitcherPF4';
|
6
5
|
|
7
6
|
const HostObfuscationSwitcher = ({ hostObfuscationEnabled, handleToggle }) => (
|
8
7
|
<div className="host_obfuscation_switcher">
|
9
|
-
<
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
size="mini"
|
15
|
-
value={hostObfuscationEnabled}
|
8
|
+
<SwitcherPF4
|
9
|
+
id="host-obfuscation-setting-switcher"
|
10
|
+
label={__('Obfuscate host names')}
|
11
|
+
tooltip={__('Obfuscate host names sent to the Red Hat cloud')}
|
12
|
+
isChecked={hostObfuscationEnabled}
|
16
13
|
onChange={() => handleToggle(hostObfuscationEnabled)}
|
17
14
|
/>
|
18
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 { HOST_OBFUSCATION_TOGGLE } from './HostObfuscationSwitcherConstants';
|
@@ -1,12 +1,12 @@
|
|
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 '../HostObfuscationSwitcherActions';
|
4
4
|
import {
|
5
5
|
handleToggleResponse,
|
6
6
|
currentHostObfuscationEnabled,
|
7
7
|
} from '../HostObfuscationSwitcher.fixtures';
|
8
8
|
|
9
|
-
jest.mock('foremanReact/API');
|
9
|
+
jest.mock('foremanReact/redux/API');
|
10
10
|
API.post.mockImplementation(async () => handleToggleResponse);
|
11
11
|
|
12
12
|
const fixtures = {
|
@@ -4,35 +4,12 @@ exports[`HostObfuscationSwitcher rendering render with props 1`] = `
|
|
4
4
|
<div
|
5
5
|
className="host_obfuscation_switcher"
|
6
6
|
>
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
buttonClass=""
|
12
|
-
content="Obfuscate host names 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="host-obfuscation-setting-switcher"
|
9
|
+
isChecked={true}
|
10
|
+
label="Obfuscate host names"
|
28
11
|
onChange={[Function]}
|
29
|
-
|
30
|
-
onText="ON"
|
31
|
-
readonly={false}
|
32
|
-
size="mini"
|
33
|
-
tristate={false}
|
34
|
-
value={true}
|
35
|
-
wrapperClass="wrapper"
|
12
|
+
tooltip="Obfuscate host names sent to the Red Hat cloud"
|
36
13
|
/>
|
37
14
|
</div>
|
38
15
|
`;
|
@@ -3,6 +3,7 @@ import {
|
|
3
3
|
LAYOUT_CHANGE_ORG,
|
4
4
|
LAYOUT_INITIALIZE,
|
5
5
|
} from 'foremanReact/components/Layout/LayoutConstants';
|
6
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
6
7
|
import {
|
7
8
|
INVENTORY_FILTER_UPDATE,
|
8
9
|
INVENTORY_FILTER_CLEAR,
|
@@ -28,15 +29,17 @@ export default (
|
|
28
29
|
});
|
29
30
|
case LAYOUT_CHANGE_ORG: {
|
30
31
|
const { title } = org;
|
31
|
-
|
32
|
+
// Any org is used only in it's translated form in the redux
|
33
|
+
const term = title === __(ANY_ORGANIZATION) ? '' : title;
|
32
34
|
return state.merge({
|
33
35
|
filterTerm: term,
|
34
36
|
});
|
35
37
|
}
|
36
38
|
case LAYOUT_INITIALIZE: {
|
37
39
|
// Layout action changed in Jul 20 2020 - https://github.com/theforeman/foreman/commit/e4c39a7d8f8b50ba45ef63e46f6f6914b69f247a
|
38
|
-
const { title } = organization; // org was renamed
|
39
|
-
|
40
|
+
const { title } = organization || {}; // org was renamed
|
41
|
+
// Any org is used only in it's translated form in the redux
|
42
|
+
const term = title === __(ANY_ORGANIZATION) ? '' : title;
|
40
43
|
return state.merge({
|
41
44
|
filterTerm: term,
|
42
45
|
});
|
@@ -4,10 +4,10 @@ import AutoUploadSwitcher from '../AutoUploadSwitcher';
|
|
4
4
|
import HostObfuscationSwitcher from '../HostObfuscationSwitcher';
|
5
5
|
import ExcludePackagesSwitcher from '../ExcludePackagesSwitcher';
|
6
6
|
import IpsObfuscationSwitcher from '../IpsObfuscationSwitcher';
|
7
|
-
import './
|
7
|
+
import './InventorySettings.scss';
|
8
8
|
|
9
9
|
const InventorySettings = () => (
|
10
|
-
<div className="
|
10
|
+
<div className="inventory-settings">
|
11
11
|
<h3>{__('Settings')}</h3>
|
12
12
|
<AutoUploadSwitcher />
|
13
13
|
<ExcludePackagesSwitcher />
|