foreman_rh_cloud 3.0.17 → 3.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/foreman_inventory_upload/accounts_controller.rb +3 -15
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +0 -48
- data/app/controllers/foreman_inventory_upload/uploads_settings_controller.rb +26 -0
- data/app/controllers/insights_cloud/hits_controller.rb +1 -1
- data/app/services/foreman_rh_cloud/branch_info.rb +3 -14
- data/app/services/foreman_rh_cloud/cloud_connector.rb +12 -7
- data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +31 -19
- data/config/routes.rb +2 -5
- data/db/migrate/20210307000001_add_unique_to_insights_facet.foreman_rh_cloud.rb +11 -0
- data/lib/foreman_inventory_upload.rb +2 -1
- data/lib/foreman_inventory_upload/generators/json_stream.rb +1 -1
- data/lib/foreman_inventory_upload/generators/slice.rb +14 -21
- data/lib/foreman_inventory_upload/generators/tags.rb +59 -0
- data/lib/foreman_rh_cloud.rb +4 -0
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/package.json +1 -1
- data/test/controllers/accounts_controller_test.rb +1 -5
- data/test/controllers/uploads_controller_test.rb +0 -13
- data/test/controllers/uploads_settings_controller_test.rb +31 -0
- data/test/test_plugin_helper.rb +13 -0
- data/test/unit/services/foreman_rh_cloud/branch_info_test.rb +5 -5
- data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +39 -4
- data/test/unit/slice_generator_test.rb +7 -2
- data/test/unit/tags_generator_test.rb +60 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +4 -19
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +7 -7
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js +6 -6
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +0 -34
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +0 -14
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/emptyResults.scss +6 -4
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/emptyState.scss +6 -4
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/errorState.scss +14 -12
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js +10 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +7 -7
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +12 -9
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListHelper.test.js +3 -3
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +0 -30
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +1 -23
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +6 -6
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap +3 -8
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +3 -35
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +6 -18
- data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +24 -22
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.js +2 -1
- data/webpack/ForemanInventoryUpload/Components/FileDownload/fileDownload.scss +4 -2
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js +2 -1
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss +16 -14
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/ClearButton.js +2 -1
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.fixtures.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +2 -1
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js +3 -11
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilter.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterReducer.test.js +3 -3
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/AdvancedSettingActions.js +7 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/AdvancedSettingsConstants.js +26 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/__tests__/AdvancedSettingActions.test.js +9 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/__tests__/__snapshots__/AdvancedSettingActions.test.js.snap +18 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js +29 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.js +7 -8
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.scss +15 -9
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettingsActions.js +23 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettingsConstants.js +9 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettingsSelectors.js +19 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/InventorySettingsActions.test.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettings.test.js.snap +16 -4
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettingsActions.test.js.snap +26 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/index.js +16 -1
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/NavContainer/navContainer.scss +7 -5
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SettingsWarning/index.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButton.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Modal.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/modal.scss +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/index.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.fixtures.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.fixtures.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/scheduledRun.scss +8 -6
- data/webpack/ForemanInventoryUpload/Components/StatusChart/statusChart.scss +9 -7
- data/webpack/ForemanInventoryUpload/Components/TabBody/tabBody.scss +4 -2
- data/webpack/ForemanInventoryUpload/Components/TabContainer/tabContainer.scss +7 -5
- data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js +2 -1
- data/webpack/ForemanInventoryUpload/Components/TabHeader/tabHeader.scss +15 -13
- data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +27 -25
- data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +1 -1
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/InventoryAutoUpload.js +13 -8
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/InventoryAutoUpload.test.js +3 -3
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/components/AdvancedSettings/AdvancedSettings.js +21 -9
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/components/AdvancedSettings/index.js +3 -8
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/index.js +6 -4
- data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryUpload.test.js.snap +1 -1
- data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettings.test.js +1 -1
- data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/InsightsSyncSwitcher.test.js +1 -1
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/fixtures.js +1 -1
- data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +1 -1
- data/webpack/InsightsHostDetailsTab/InsightsTab.js +2 -1
- data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +1 -1
- data/webpack/common/Switcher/SwitcherPF4.scss +1 -1
- metadata +55 -56
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.fixtures.js +0 -3
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +0 -29
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +0 -29
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherConstants.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcher.test.js +0 -14
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +0 -24
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +0 -15
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcherActions.test.js.snap +0 -31
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/index.js +0 -17
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcher.fixtures.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcher.js +0 -27
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcherActions.js +0 -29
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcherConstants.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/ExcludePackagesSwitcher.test.js +0 -13
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/ExcludePackagesSwitcherActions.test.js +0 -21
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/ExcludePackagesSwitcher.test.js.snap +0 -15
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/ExcludePackagesSwitcherActions.test.js.snap +0 -31
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/integration.test.js.snap +0 -46
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js +0 -36
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/index.js +0 -20
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.fixtures.js +0 -2
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.js +0 -27
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcherActions.js +0 -29
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcherConstants.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcher.test.js +0 -14
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcherActions.test.js +0 -24
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/__snapshots__/HostObfuscationSwitcher.test.js.snap +0 -15
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/__snapshots__/HostObfuscationSwitcherActions.test.js.snap +0 -31
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/index.js +0 -20
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcher.fixtures.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcher.js +0 -27
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcherActions.js +0 -29
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcherConstants.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/IpsObfuscationSwitcher.test.js +0 -13
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/IpsObfuscationSwitcherActions.test.js +0 -21
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/__snapshots__/IpsObfuscationSwitcher.test.js.snap +0 -15
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/__snapshots__/IpsObfuscationSwitcherActions.test.js.snap +0 -31
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/index.js +0 -20
data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
import { API } from 'foremanReact/redux/API';
|
2
|
-
import { addToast } from 'foremanReact/redux/actions/toasts';
|
3
|
-
import { inventoryUrl } from '../../ForemanInventoryHelpers';
|
4
|
-
import { AUTO_UPLOAD_TOGGLE } from './AutoUploadSwitcherConstants';
|
5
|
-
|
6
|
-
export const handleToggle = currentAutoUploadEnabled => async dispatch => {
|
7
|
-
const toggledAutoUploadEnabled = !currentAutoUploadEnabled;
|
8
|
-
try {
|
9
|
-
const {
|
10
|
-
data: { autoUploadEnabled },
|
11
|
-
} = await API.post(inventoryUrl('auto_upload'), {
|
12
|
-
value: toggledAutoUploadEnabled,
|
13
|
-
});
|
14
|
-
dispatch({
|
15
|
-
type: AUTO_UPLOAD_TOGGLE,
|
16
|
-
payload: {
|
17
|
-
autoUploadEnabled,
|
18
|
-
},
|
19
|
-
});
|
20
|
-
} catch ({ message }) {
|
21
|
-
dispatch(
|
22
|
-
addToast({
|
23
|
-
sticky: true,
|
24
|
-
type: 'error',
|
25
|
-
message,
|
26
|
-
})
|
27
|
-
);
|
28
|
-
}
|
29
|
-
};
|
data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherConstants.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export const AUTO_UPLOAD_TOGGLE = 'AUTO_UPLOAD_TOGGLE';
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
2
|
-
import { noop } from 'patternfly-react';
|
3
|
-
|
4
|
-
import AutoUploadSwitcher from '../AutoUploadSwitcher';
|
5
|
-
|
6
|
-
const fixtures = {
|
7
|
-
'render with props': { autoUploadEnabled: true, handleToggle: noop },
|
8
|
-
/** fixtures, props for the component */
|
9
|
-
};
|
10
|
-
|
11
|
-
describe('AutoUploadSwitcher', () => {
|
12
|
-
describe('rendering', () =>
|
13
|
-
testComponentSnapshotsWithFixtures(AutoUploadSwitcher, fixtures));
|
14
|
-
});
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import { testActionSnapshotWithFixtures } from '@theforeman/test';
|
2
|
-
import { API } from 'foremanReact/redux/API';
|
3
|
-
import { handleToggle } from '../AutoUploadSwitcherActions';
|
4
|
-
import {
|
5
|
-
handleToggleResponse,
|
6
|
-
currentAutoUploadEnabled,
|
7
|
-
} from '../AutoUploadSwitcher.fixtures';
|
8
|
-
|
9
|
-
jest.mock('foremanReact/redux/API');
|
10
|
-
API.post.mockImplementation(async () => handleToggleResponse);
|
11
|
-
|
12
|
-
const fixtures = {
|
13
|
-
'should handleToggle': () => handleToggle(currentAutoUploadEnabled),
|
14
|
-
'should handleToggle with error': () => {
|
15
|
-
API.post.mockImplementationOnce(() =>
|
16
|
-
Promise.reject(new Error('Network error!'))
|
17
|
-
);
|
18
|
-
|
19
|
-
return handleToggle(currentAutoUploadEnabled);
|
20
|
-
},
|
21
|
-
};
|
22
|
-
|
23
|
-
describe('AutoUploadSwitcher actions', () =>
|
24
|
-
testActionSnapshotWithFixtures(fixtures));
|
@@ -1,15 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`AutoUploadSwitcher rendering render with props 1`] = `
|
4
|
-
<div
|
5
|
-
className="auto_upload_switcher"
|
6
|
-
>
|
7
|
-
<SwitcherPF4
|
8
|
-
id="auto-upload-setting-switcher"
|
9
|
-
isChecked={true}
|
10
|
-
label="Auto upload"
|
11
|
-
onChange={[Function]}
|
12
|
-
tooltip="Enable automatic upload of your hosts inventory to the Red Hat cloud"
|
13
|
-
/>
|
14
|
-
</div>
|
15
|
-
`;
|
@@ -1,31 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`AutoUploadSwitcher actions should handleToggle 1`] = `
|
4
|
-
Array [
|
5
|
-
Array [
|
6
|
-
Object {
|
7
|
-
"payload": Object {
|
8
|
-
"autoUploadEnabled": true,
|
9
|
-
},
|
10
|
-
"type": "AUTO_UPLOAD_TOGGLE",
|
11
|
-
},
|
12
|
-
],
|
13
|
-
]
|
14
|
-
`;
|
15
|
-
|
16
|
-
exports[`AutoUploadSwitcher actions should handleToggle with error 1`] = `
|
17
|
-
Array [
|
18
|
-
Array [
|
19
|
-
Object {
|
20
|
-
"payload": Object {
|
21
|
-
"message": Object {
|
22
|
-
"message": "Network error!",
|
23
|
-
"sticky": true,
|
24
|
-
"type": "error",
|
25
|
-
},
|
26
|
-
},
|
27
|
-
"type": "TOASTS_ADD",
|
28
|
-
},
|
29
|
-
],
|
30
|
-
]
|
31
|
-
`;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { bindActionCreators } from 'redux';
|
2
|
-
import { connect } from 'react-redux';
|
3
|
-
|
4
|
-
import * as actions from './AutoUploadSwitcherActions';
|
5
|
-
import AutoUploadSwitcher from './AutoUploadSwitcher';
|
6
|
-
import { selectAutoUploadEnabled } from '../AccountList/AccountListSelectors';
|
7
|
-
|
8
|
-
// map state to props
|
9
|
-
const mapStateToProps = state => ({
|
10
|
-
autoUploadEnabled: selectAutoUploadEnabled(state),
|
11
|
-
});
|
12
|
-
|
13
|
-
// map action dispatchers to props
|
14
|
-
const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
|
15
|
-
|
16
|
-
// export connected component
|
17
|
-
export default connect(mapStateToProps, mapDispatchToProps)(AutoUploadSwitcher);
|
@@ -1 +0,0 @@
|
|
1
|
-
export const handleToggleResponse = { data: { excludePackages: true } };
|
data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcher.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
4
|
-
import SwitcherPF4 from '../../../common/Switcher/SwitcherPF4';
|
5
|
-
|
6
|
-
const ExcludePackagesSwitcher = ({ excludePackages, handleToggle }) => (
|
7
|
-
<div className="exclude_packages_switcher">
|
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}
|
13
|
-
onChange={() => handleToggle(excludePackages)}
|
14
|
-
/>
|
15
|
-
</div>
|
16
|
-
);
|
17
|
-
|
18
|
-
ExcludePackagesSwitcher.propTypes = {
|
19
|
-
excludePackages: PropTypes.bool,
|
20
|
-
handleToggle: PropTypes.func.isRequired,
|
21
|
-
};
|
22
|
-
|
23
|
-
ExcludePackagesSwitcher.defaultProps = {
|
24
|
-
excludePackages: false,
|
25
|
-
};
|
26
|
-
|
27
|
-
export default ExcludePackagesSwitcher;
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { API } from 'foremanReact/redux/API';
|
2
|
-
import { addToast } from 'foremanReact/redux/actions/toasts';
|
3
|
-
import { inventoryUrl } from '../../ForemanInventoryHelpers';
|
4
|
-
import { EXCLUDE_PACKAGES_TOGGLE } from './ExcludePackagesSwitcherConstants';
|
5
|
-
|
6
|
-
export const handleToggle = currentExcludePackages => async dispatch => {
|
7
|
-
const toggledExcludePackages = !currentExcludePackages;
|
8
|
-
try {
|
9
|
-
const {
|
10
|
-
data: { excludePackages },
|
11
|
-
} = await API.post(inventoryUrl('installed_packages_inclusion'), {
|
12
|
-
value: toggledExcludePackages,
|
13
|
-
});
|
14
|
-
dispatch({
|
15
|
-
type: EXCLUDE_PACKAGES_TOGGLE,
|
16
|
-
payload: {
|
17
|
-
excludePackages,
|
18
|
-
},
|
19
|
-
});
|
20
|
-
} catch (error) {
|
21
|
-
dispatch(
|
22
|
-
addToast({
|
23
|
-
sticky: true,
|
24
|
-
type: 'error',
|
25
|
-
message: error.message,
|
26
|
-
})
|
27
|
-
);
|
28
|
-
}
|
29
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export const EXCLUDE_PACKAGES_TOGGLE = 'EXCLUDE_PACKAGES_TOGGLE';
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
2
|
-
import { noop } from 'patternfly-react';
|
3
|
-
|
4
|
-
import ExcludePackagesSwitcher from '../ExcludePackagesSwitcher';
|
5
|
-
|
6
|
-
const fixtures = {
|
7
|
-
'render with props': { excludePackages: true, handleToggle: noop },
|
8
|
-
};
|
9
|
-
|
10
|
-
describe('ExcludePackagesSwitcher', () => {
|
11
|
-
describe('rendering', () =>
|
12
|
-
testComponentSnapshotsWithFixtures(ExcludePackagesSwitcher, fixtures));
|
13
|
-
});
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { testActionSnapshotWithFixtures } from '@theforeman/test';
|
2
|
-
import { API } from 'foremanReact/redux/API';
|
3
|
-
import { handleToggle } from '../ExcludePackagesSwitcherActions';
|
4
|
-
import { handleToggleResponse } from '../ExcludePackagesSwitcher.fixtures';
|
5
|
-
|
6
|
-
jest.mock('foremanReact/redux/API');
|
7
|
-
API.post.mockImplementation(async () => handleToggleResponse);
|
8
|
-
|
9
|
-
const fixtures = {
|
10
|
-
'should handleToggle': () => handleToggle(),
|
11
|
-
'should invoke toast notification upon failure of handleToggle': () => {
|
12
|
-
API.post.mockImplementationOnce(() =>
|
13
|
-
Promise.reject(new Error('test error'))
|
14
|
-
);
|
15
|
-
|
16
|
-
return handleToggle();
|
17
|
-
},
|
18
|
-
};
|
19
|
-
|
20
|
-
describe('ExcludePackagesSwitcher actions', () =>
|
21
|
-
testActionSnapshotWithFixtures(fixtures));
|
@@ -1,15 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`ExcludePackagesSwitcher rendering render with props 1`] = `
|
4
|
-
<div
|
5
|
-
className="exclude_packages_switcher"
|
6
|
-
>
|
7
|
-
<SwitcherPF4
|
8
|
-
id="exclude-packages-setting-switcher"
|
9
|
-
isChecked={true}
|
10
|
-
label="Exclude Packages"
|
11
|
-
onChange={[Function]}
|
12
|
-
tooltip="Exclude packages from being uploaded to the Red Hat cloud"
|
13
|
-
/>
|
14
|
-
</div>
|
15
|
-
`;
|
@@ -1,31 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`ExcludePackagesSwitcher actions should handleToggle 1`] = `
|
4
|
-
Array [
|
5
|
-
Array [
|
6
|
-
Object {
|
7
|
-
"payload": Object {
|
8
|
-
"excludePackages": true,
|
9
|
-
},
|
10
|
-
"type": "EXCLUDE_PACKAGES_TOGGLE",
|
11
|
-
},
|
12
|
-
],
|
13
|
-
]
|
14
|
-
`;
|
15
|
-
|
16
|
-
exports[`ExcludePackagesSwitcher actions should invoke toast notification upon failure of handleToggle 1`] = `
|
17
|
-
Array [
|
18
|
-
Array [
|
19
|
-
Object {
|
20
|
-
"payload": Object {
|
21
|
-
"message": Object {
|
22
|
-
"message": "test error",
|
23
|
-
"sticky": true,
|
24
|
-
"type": "error",
|
25
|
-
},
|
26
|
-
},
|
27
|
-
"type": "TOASTS_ADD",
|
28
|
-
},
|
29
|
-
],
|
30
|
-
]
|
31
|
-
`;
|
@@ -1,46 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`ExcludePackagesSwitcher integration test should flow: switcher was toggled 1`] = `
|
4
|
-
Object {
|
5
|
-
"action": Array [
|
6
|
-
Array [
|
7
|
-
Object {
|
8
|
-
"payload": Object {
|
9
|
-
"excludePackages": false,
|
10
|
-
},
|
11
|
-
"type": "EXCLUDE_PACKAGES_TOGGLE",
|
12
|
-
},
|
13
|
-
],
|
14
|
-
],
|
15
|
-
"state": Object {
|
16
|
-
"ForemanRhCloud": Object {
|
17
|
-
"InsightsCloudSync": Object {
|
18
|
-
"settings": Object {
|
19
|
-
"insightsSyncEnabled": false,
|
20
|
-
},
|
21
|
-
"table": Object {
|
22
|
-
"isAllSelected": false,
|
23
|
-
"selectedIds": Object {},
|
24
|
-
"showSelectAllAlert": false,
|
25
|
-
},
|
26
|
-
},
|
27
|
-
"hostInsights": Object {
|
28
|
-
"hits": Array [],
|
29
|
-
},
|
30
|
-
"inventoryUpload": Object {
|
31
|
-
"accountsList": Object {
|
32
|
-
"accounts": Object {},
|
33
|
-
"error": null,
|
34
|
-
"excludePackages": false,
|
35
|
-
"pollingProcessID": 0,
|
36
|
-
},
|
37
|
-
"dashboard": Object {},
|
38
|
-
"inventoryFilter": Object {
|
39
|
-
"filterTerm": "",
|
40
|
-
},
|
41
|
-
"inventorySync": Object {},
|
42
|
-
},
|
43
|
-
},
|
44
|
-
},
|
45
|
-
}
|
46
|
-
`;
|
data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { IntegrationTestHelper } from '@theforeman/test';
|
3
|
-
import { API } from 'foremanReact/redux/API';
|
4
|
-
import ExcludePackagesSwitcher from '../index';
|
5
|
-
import reducers from '../../../../ForemanRhCloudReducers';
|
6
|
-
|
7
|
-
jest.mock('foremanReact/redux/API');
|
8
|
-
API.post.mockImplementation(async () => ({
|
9
|
-
data: {
|
10
|
-
excludePackages: false,
|
11
|
-
},
|
12
|
-
}));
|
13
|
-
|
14
|
-
jest.mock('../../AccountList/AccountListSelectors', () => ({
|
15
|
-
selectExcludePackages: jest.fn(() => true),
|
16
|
-
}));
|
17
|
-
|
18
|
-
describe('ExcludePackagesSwitcher integration test', () => {
|
19
|
-
it('should flow', async () => {
|
20
|
-
const integrationTestHelper = new IntegrationTestHelper(reducers);
|
21
|
-
const wrapper = integrationTestHelper.mount(<ExcludePackagesSwitcher />);
|
22
|
-
const switcher = wrapper.find('Switch').first();
|
23
|
-
switcher.props().onChange();
|
24
|
-
await IntegrationTestHelper.flushAllPromises();
|
25
|
-
wrapper.update();
|
26
|
-
integrationTestHelper.takeStoreAndLastActionSnapshot(
|
27
|
-
'switcher was toggled'
|
28
|
-
);
|
29
|
-
expect(API.post).toBeCalledWith(
|
30
|
-
'/foreman_inventory_upload/installed_packages_inclusion',
|
31
|
-
{
|
32
|
-
value: false,
|
33
|
-
}
|
34
|
-
);
|
35
|
-
});
|
36
|
-
});
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { bindActionCreators } from 'redux';
|
2
|
-
import { connect } from 'react-redux';
|
3
|
-
|
4
|
-
import * as actions from './ExcludePackagesSwitcherActions';
|
5
|
-
import ExcludePackagesSwitcher from './ExcludePackagesSwitcher';
|
6
|
-
import { selectExcludePackages } from '../AccountList/AccountListSelectors';
|
7
|
-
|
8
|
-
// map state to props
|
9
|
-
const mapStateToProps = state => ({
|
10
|
-
excludePackages: selectExcludePackages(state),
|
11
|
-
});
|
12
|
-
|
13
|
-
// map action dispatchers to props
|
14
|
-
const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
|
15
|
-
|
16
|
-
// export connected component
|
17
|
-
export default connect(
|
18
|
-
mapStateToProps,
|
19
|
-
mapDispatchToProps
|
20
|
-
)(ExcludePackagesSwitcher);
|
data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
4
|
-
import SwitcherPF4 from '../../../common/Switcher/SwitcherPF4';
|
5
|
-
|
6
|
-
const HostObfuscationSwitcher = ({ hostObfuscationEnabled, handleToggle }) => (
|
7
|
-
<div className="host_obfuscation_switcher">
|
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}
|
13
|
-
onChange={() => handleToggle(hostObfuscationEnabled)}
|
14
|
-
/>
|
15
|
-
</div>
|
16
|
-
);
|
17
|
-
|
18
|
-
HostObfuscationSwitcher.propTypes = {
|
19
|
-
hostObfuscationEnabled: PropTypes.bool,
|
20
|
-
handleToggle: PropTypes.func.isRequired,
|
21
|
-
};
|
22
|
-
|
23
|
-
HostObfuscationSwitcher.defaultProps = {
|
24
|
-
hostObfuscationEnabled: false,
|
25
|
-
};
|
26
|
-
|
27
|
-
export default HostObfuscationSwitcher;
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { API } from 'foremanReact/redux/API';
|
2
|
-
import { addToast } from 'foremanReact/redux/actions/toasts';
|
3
|
-
import { inventoryUrl } from '../../ForemanInventoryHelpers';
|
4
|
-
import { HOST_OBFUSCATION_TOGGLE } from './HostObfuscationSwitcherConstants';
|
5
|
-
|
6
|
-
export const handleToggle = currentHostObfuscationEnabled => async dispatch => {
|
7
|
-
const toggledHostObfuscationEnabled = !currentHostObfuscationEnabled;
|
8
|
-
try {
|
9
|
-
const {
|
10
|
-
data: { hostObfuscationEnabled },
|
11
|
-
} = await API.post(inventoryUrl('host_obfuscation'), {
|
12
|
-
value: toggledHostObfuscationEnabled,
|
13
|
-
});
|
14
|
-
dispatch({
|
15
|
-
type: HOST_OBFUSCATION_TOGGLE,
|
16
|
-
payload: {
|
17
|
-
hostObfuscationEnabled,
|
18
|
-
},
|
19
|
-
});
|
20
|
-
} catch ({ message }) {
|
21
|
-
dispatch(
|
22
|
-
addToast({
|
23
|
-
sticky: true,
|
24
|
-
type: 'error',
|
25
|
-
message,
|
26
|
-
})
|
27
|
-
);
|
28
|
-
}
|
29
|
-
};
|