foreman_rh_cloud 3.0.18.1 → 4.0.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -5
- data/app/controllers/foreman_inventory_upload/tasks_controller.rb +14 -3
- data/app/controllers/foreman_inventory_upload/uploads_settings_controller.rb +8 -0
- data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +17 -7
- data/app/controllers/insights_cloud/hits_controller.rb +37 -0
- data/app/controllers/insights_cloud/settings_controller.rb +1 -1
- data/app/controllers/insights_cloud/tasks_controller.rb +1 -2
- data/app/models/insights_client_report_status.rb +58 -0
- data/app/models/insights_resolution.rb +1 -1
- data/app/models/inventory_sync/inventory_status.rb +6 -0
- data/app/models/setting/rh_cloud.rb +5 -5
- data/app/services/foreman_rh_cloud/cloud_connector.rb +1 -1
- data/app/services/foreman_rh_cloud/remediations_retriever.rb +78 -0
- data/app/services/foreman_rh_cloud/template_renderer_helper.rb +22 -0
- data/app/subscribers/foreman_rh_cloud/insights_subscriber.rb +9 -0
- data/app/views/job_templates/rh_cloud_remediations.erb +14 -0
- data/config/routes.rb +2 -1
- data/db/migrate/20210404000001_change_resolutions.foreman_rh_cloud.rb +10 -0
- data/db/seeds.d/179_ui_notifications.rb +11 -0
- data/db/seeds.d/50_job_templates.rb +14 -0
- data/lib/foreman_inventory_upload.rb +9 -0
- data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +8 -2
- data/lib/foreman_inventory_upload/generators/queries.rb +3 -2
- data/lib/foreman_inventory_upload/generators/slice.rb +1 -1
- data/lib/foreman_inventory_upload/generators/tags.rb +8 -6
- data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +5 -1
- data/lib/foreman_rh_cloud.rb +18 -0
- data/lib/foreman_rh_cloud/engine.rb +36 -2
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/insights_cloud.rb +12 -0
- data/lib/insights_cloud/async/insights_full_sync.rb +39 -24
- data/lib/insights_cloud/async/insights_generate_notifications.rb +58 -0
- data/lib/insights_cloud/async/insights_resolutions_sync.rb +69 -0
- data/lib/insights_cloud/async/insights_rules_sync.rb +13 -17
- data/lib/insights_cloud/async/insights_scheduled_sync.rb +1 -1
- data/lib/inventory_sync/async/host_result.rb +11 -6
- data/lib/inventory_sync/async/inventory_full_sync.rb +24 -41
- data/lib/inventory_sync/async/inventory_hosts_sync.rb +34 -0
- data/lib/inventory_sync/async/inventory_scheduled_sync.rb +17 -0
- data/lib/inventory_sync/async/query_inventory_job.rb +54 -0
- data/lib/tasks/insights.rake +4 -12
- data/lib/tasks/rh_cloud_inventory.rake +12 -4
- data/package.json +1 -1
- data/test/factories/insights_factories.rb +22 -0
- data/test/jobs/insights_full_sync_test.rb +28 -15
- data/test/jobs/insights_resolutions_sync_test.rb +77 -0
- data/test/jobs/insights_rules_sync_test.rb +8 -3
- data/test/jobs/inventory_full_sync_test.rb +185 -12
- data/test/models/insights_client_report_status_test.rb +77 -0
- data/test/unit/rh_cloud_http_proxy_test.rb +4 -4
- data/test/unit/services/foreman_rh_cloud/remediations_retriever_test.rb +49 -0
- data/test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb +28 -0
- data/test/unit/slice_generator_test.rb +11 -2
- data/test/unit/tags_generator_test.rb +10 -0
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/__snapshots__/FullScreenModal.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss +14 -16
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +0 -1
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/AdvancedSettingsConstants.js +5 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +15 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap +13 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +81 -46
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonConstants.js +3 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonSelectors.js +6 -12
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonFixtures.js +1 -9
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonSelectors.test.js +18 -27
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonSelectors.test.js.snap +1 -16
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +58 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js +51 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/index.js +2 -5
- data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/__snapshots__/Terminal.test.js.snap +2 -2
- data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +25 -27
- data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +0 -2
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +1 -1
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js +3 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +2 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js +59 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationActions.js +12 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationHelpers.js +43 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +101 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.scss +9 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModalFooter.js +43 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationTableConstants.js +38 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/Resolutions.js +55 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/index.js +34 -0
- data/webpack/InsightsCloudSync/InsightsCloudSync.js +8 -3
- data/webpack/InsightsCloudSync/InsightsCloudSync.scss +5 -0
- data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +9 -6
- data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js +4 -0
- data/webpack/{InsightsCloudSync/Components/InsightsTable/components → common/table}/EmptyState.js +0 -0
- data/webpack/common/table/helpers.js +7 -0
- metadata +56 -26
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js +0 -36
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonActions.test.js +0 -31
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonReducer.test.js +0 -26
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonActions.test.js.snap +0 -98
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonReducer.test.js.snap +0 -18
@@ -0,0 +1,12 @@
|
|
1
|
+
import { get } from 'foremanReact/redux/API';
|
2
|
+
import {
|
3
|
+
REMEDIATIONS_API_KEY,
|
4
|
+
REMEDIATIONS_PATH,
|
5
|
+
} from './RemediationTableConstants';
|
6
|
+
|
7
|
+
export const fetchRemediations = ({ selectedIds, isAllSelected, query }) =>
|
8
|
+
get({
|
9
|
+
key: REMEDIATIONS_API_KEY,
|
10
|
+
url: REMEDIATIONS_PATH,
|
11
|
+
params: { ids: Object.keys(selectedIds), isAllSelected, query },
|
12
|
+
});
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/* eslint-disable camelcase */
|
2
|
+
import React from 'react';
|
3
|
+
import { orderBy } from 'lodash';
|
4
|
+
import Resolutions from './Resolutions';
|
5
|
+
|
6
|
+
export const modifyRows = (remediations, setResolutions, setHostsIds) => {
|
7
|
+
if (remediations.length === 0) return [];
|
8
|
+
|
9
|
+
const resolutionToSubmit = [];
|
10
|
+
const hostsIdsToSubmit = new Set();
|
11
|
+
const modifiedRemediations = orderBy(
|
12
|
+
remediations.asMutable(),
|
13
|
+
[r => r.resolutions?.length || 0],
|
14
|
+
['desc']
|
15
|
+
).map(({ id, host_id, hostname, title, resolutions, reboot }) => {
|
16
|
+
hostsIdsToSubmit.add(host_id);
|
17
|
+
const selectedResolution = resolutions[0]?.id;
|
18
|
+
resolutionToSubmit.push({
|
19
|
+
hit_id: id,
|
20
|
+
resolution_id: selectedResolution /** defaults to the first resolution if many */,
|
21
|
+
});
|
22
|
+
return {
|
23
|
+
cells: [
|
24
|
+
hostname,
|
25
|
+
title,
|
26
|
+
<div>
|
27
|
+
<Resolutions
|
28
|
+
hit_id={id}
|
29
|
+
resolutions={resolutions}
|
30
|
+
setResolutions={setResolutions}
|
31
|
+
selectedResolution={selectedResolution}
|
32
|
+
/>
|
33
|
+
</div>,
|
34
|
+
reboot,
|
35
|
+
],
|
36
|
+
id,
|
37
|
+
};
|
38
|
+
});
|
39
|
+
|
40
|
+
setResolutions(resolutionToSubmit);
|
41
|
+
setHostsIds(Array.from(hostsIdsToSubmit));
|
42
|
+
return modifiedRemediations;
|
43
|
+
};
|
@@ -0,0 +1,101 @@
|
|
1
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
2
|
+
import React, { useEffect } from 'react';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import { Table, TableHeader, TableBody } from '@patternfly/react-table';
|
5
|
+
import { Modal, ModalVariant } from '@patternfly/react-core';
|
6
|
+
import { STATUS } from 'foremanReact/constants';
|
7
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
8
|
+
import { columns } from './RemediationTableConstants';
|
9
|
+
import { modifyRows } from './RemediationHelpers';
|
10
|
+
import ModalFooter from './RemediationModalFooter';
|
11
|
+
import TableEmptyState from '../../../common/table/EmptyState';
|
12
|
+
import './RemediationModal.scss';
|
13
|
+
import RemediateButton from './RemediateButton';
|
14
|
+
|
15
|
+
const RemediationModal = ({
|
16
|
+
selectedIds,
|
17
|
+
fetchRemediations,
|
18
|
+
remediations,
|
19
|
+
status,
|
20
|
+
error,
|
21
|
+
isAllSelected,
|
22
|
+
query,
|
23
|
+
isExperimentalMode,
|
24
|
+
}) => {
|
25
|
+
const [rows, setRows] = React.useState([]);
|
26
|
+
const [open, setOpen] = React.useState(false);
|
27
|
+
const [resolutions, setResolutions] = React.useState([]);
|
28
|
+
const [hostsIds, setHostsIds] = React.useState([]);
|
29
|
+
const toggleModal = () => setOpen(prevValue => !prevValue);
|
30
|
+
|
31
|
+
useEffect(() => {
|
32
|
+
if (open) fetchRemediations({ selectedIds, isAllSelected, query });
|
33
|
+
}, [open]);
|
34
|
+
|
35
|
+
useEffect(() => {
|
36
|
+
const modifiedRows =
|
37
|
+
status === STATUS.PENDING
|
38
|
+
? []
|
39
|
+
: modifyRows(remediations, setResolutions, setHostsIds);
|
40
|
+
setRows(modifiedRows);
|
41
|
+
}, [remediations, status]);
|
42
|
+
|
43
|
+
return (
|
44
|
+
<React.Fragment>
|
45
|
+
<RemediateButton
|
46
|
+
isExperimentalMode={isExperimentalMode}
|
47
|
+
selectedIds={selectedIds}
|
48
|
+
toggleModal={toggleModal}
|
49
|
+
/>{' '}
|
50
|
+
<Modal
|
51
|
+
id="remediation-modal"
|
52
|
+
appendTo={document.body}
|
53
|
+
variant={ModalVariant.large}
|
54
|
+
title={__('Remediation summary')}
|
55
|
+
isOpen={open}
|
56
|
+
onClose={toggleModal}
|
57
|
+
footer={
|
58
|
+
<ModalFooter
|
59
|
+
toggleModal={toggleModal}
|
60
|
+
resolutions={resolutions}
|
61
|
+
hostsIds={hostsIds}
|
62
|
+
/>
|
63
|
+
}
|
64
|
+
>
|
65
|
+
<Table
|
66
|
+
className="remediations-table"
|
67
|
+
aria-label="remediations Table"
|
68
|
+
cells={columns}
|
69
|
+
rows={rows}
|
70
|
+
>
|
71
|
+
<TableHeader />
|
72
|
+
<TableBody />
|
73
|
+
</Table>
|
74
|
+
<TableEmptyState status={status} error={error} />
|
75
|
+
</Modal>
|
76
|
+
</React.Fragment>
|
77
|
+
);
|
78
|
+
};
|
79
|
+
|
80
|
+
RemediationModal.propTypes = {
|
81
|
+
selectedIds: PropTypes.object,
|
82
|
+
fetchRemediations: PropTypes.func.isRequired,
|
83
|
+
remediations: PropTypes.array,
|
84
|
+
status: PropTypes.string,
|
85
|
+
error: PropTypes.string,
|
86
|
+
isAllSelected: PropTypes.bool,
|
87
|
+
query: PropTypes.string,
|
88
|
+
isExperimentalMode: PropTypes.bool,
|
89
|
+
};
|
90
|
+
|
91
|
+
RemediationModal.defaultProps = {
|
92
|
+
selectedIds: {},
|
93
|
+
remediations: [],
|
94
|
+
status: null,
|
95
|
+
error: null,
|
96
|
+
isAllSelected: false,
|
97
|
+
query: null,
|
98
|
+
isExperimentalMode: false,
|
99
|
+
};
|
100
|
+
|
101
|
+
export default RemediationModal;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { Button } from '@patternfly/react-core';
|
4
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
5
|
+
import { JOB_INVOCATION_PATH } from './RemediationTableConstants';
|
6
|
+
|
7
|
+
const ModalFooter = ({ toggleModal, resolutions, hostsIds }) => {
|
8
|
+
let token = document.querySelector('meta[name="csrf-token"]');
|
9
|
+
token = token?.content || '';
|
10
|
+
return (
|
11
|
+
<form action={JOB_INVOCATION_PATH} method="post">
|
12
|
+
<Button type="submit" key="confirm" variant="primary">
|
13
|
+
{__('Remediate')}
|
14
|
+
</Button>
|
15
|
+
<Button key="cancel" variant="link" onClick={toggleModal}>
|
16
|
+
{__('Cancel')}
|
17
|
+
</Button>
|
18
|
+
<input type="hidden" name="feature" value="rh_cloud_remediate_hosts" />
|
19
|
+
<input type="hidden" name="authenticity_token" value={token} />
|
20
|
+
<input
|
21
|
+
type="hidden"
|
22
|
+
name="inputs[hit_remediation_pairs]"
|
23
|
+
value={JSON.stringify(resolutions)}
|
24
|
+
/>
|
25
|
+
{hostsIds.map(id => (
|
26
|
+
<input type="hidden" name="host_ids[]" key={id} value={id} />
|
27
|
+
))}
|
28
|
+
</form>
|
29
|
+
);
|
30
|
+
};
|
31
|
+
|
32
|
+
ModalFooter.propTypes = {
|
33
|
+
toggleModal: PropTypes.func.isRequired,
|
34
|
+
resolutions: PropTypes.array,
|
35
|
+
hostsIds: PropTypes.array,
|
36
|
+
};
|
37
|
+
|
38
|
+
ModalFooter.defaultProps = {
|
39
|
+
resolutions: [],
|
40
|
+
hostsIds: [],
|
41
|
+
};
|
42
|
+
|
43
|
+
export default ModalFooter;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { cellWidth } from '@patternfly/react-table';
|
3
|
+
import { CheckCircleIcon } from '@patternfly/react-icons';
|
4
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
5
|
+
import { foremanUrl } from '../../../ForemanRhCloudHelpers';
|
6
|
+
|
7
|
+
export const rebootFormatter = ({ title: reboot }) => ({
|
8
|
+
children: reboot ? <CheckCircleIcon color="green" /> : __('No'),
|
9
|
+
});
|
10
|
+
|
11
|
+
export const columns = [
|
12
|
+
{
|
13
|
+
sortKey: 'hostname',
|
14
|
+
title: __('Hostname'),
|
15
|
+
transforms: [cellWidth(20)],
|
16
|
+
},
|
17
|
+
{
|
18
|
+
title: __('Recommendation'),
|
19
|
+
transforms: [cellWidth(35)],
|
20
|
+
},
|
21
|
+
{
|
22
|
+
title: __('Resolution'),
|
23
|
+
transforms: [cellWidth(30)],
|
24
|
+
},
|
25
|
+
{
|
26
|
+
title: __('Reboot Required'),
|
27
|
+
transforms: [cellWidth(15)],
|
28
|
+
cellTransforms: [rebootFormatter],
|
29
|
+
},
|
30
|
+
];
|
31
|
+
|
32
|
+
export const REMEDIATIONS_PATH = foremanUrl('/insights_cloud/hits/resolutions');
|
33
|
+
|
34
|
+
export const JOB_INVOCATION_PATH = foremanUrl('/job_invocations/new');
|
35
|
+
|
36
|
+
export const REMEDIATIONS_API_KEY = 'INSIGHTS_REMEDIATIONS';
|
37
|
+
|
38
|
+
export const SUBMIT_RESOLUTIONS = 'SUBMIT_INSIGHTS_RESOLUTIONS';
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/* eslint-disable camelcase */
|
2
|
+
import React from 'react';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import { Radio } from '@patternfly/react-core';
|
5
|
+
|
6
|
+
const Resolutions = ({
|
7
|
+
resolutions,
|
8
|
+
setResolutions,
|
9
|
+
selectedResolution,
|
10
|
+
hit_id,
|
11
|
+
}) => {
|
12
|
+
const [checkedID, setCheckedID] = React.useState(selectedResolution);
|
13
|
+
|
14
|
+
if (resolutions.length === 1) return <>{resolutions[0].description}</>;
|
15
|
+
|
16
|
+
return (
|
17
|
+
<>
|
18
|
+
{resolutions.map(({ id: resolution_id, description }) => (
|
19
|
+
<Radio
|
20
|
+
key={resolution_id}
|
21
|
+
className="resolution-radio"
|
22
|
+
id={resolution_id}
|
23
|
+
isChecked={resolution_id === checkedID}
|
24
|
+
onChange={() =>
|
25
|
+
setResolutions(stateRes =>
|
26
|
+
stateRes.map(res => {
|
27
|
+
if (hit_id === res.hit_id) {
|
28
|
+
setCheckedID(resolution_id);
|
29
|
+
return { ...res, resolution_id };
|
30
|
+
}
|
31
|
+
return res;
|
32
|
+
})
|
33
|
+
)
|
34
|
+
}
|
35
|
+
label={description}
|
36
|
+
/>
|
37
|
+
))}
|
38
|
+
</>
|
39
|
+
);
|
40
|
+
};
|
41
|
+
|
42
|
+
Resolutions.propTypes = {
|
43
|
+
setResolutions: PropTypes.func.isRequired,
|
44
|
+
resolutions: PropTypes.array,
|
45
|
+
hit_id: PropTypes.number,
|
46
|
+
selectedResolution: PropTypes.number,
|
47
|
+
};
|
48
|
+
|
49
|
+
Resolutions.defaultProps = {
|
50
|
+
resolutions: [],
|
51
|
+
hit_id: null,
|
52
|
+
selectedResolution: null,
|
53
|
+
};
|
54
|
+
|
55
|
+
export default Resolutions;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { bindActionCreators } from 'redux';
|
2
|
+
import { connect } from 'react-redux';
|
3
|
+
import {
|
4
|
+
selectAPIResponse,
|
5
|
+
selectAPIStatus,
|
6
|
+
selectAPIErrorMessage,
|
7
|
+
} from 'foremanReact/redux/API/APISelectors';
|
8
|
+
import * as actions from './RemediationActions';
|
9
|
+
import RemediationModal from './RemediationModal';
|
10
|
+
import { REMEDIATIONS_API_KEY } from './RemediationTableConstants';
|
11
|
+
import {
|
12
|
+
selectExperimental,
|
13
|
+
selectIsAllSelected,
|
14
|
+
selectSearch,
|
15
|
+
selectSelectedIds,
|
16
|
+
} from '../InsightsTable/InsightsTableSelectors';
|
17
|
+
|
18
|
+
// map state to props
|
19
|
+
const mapStateToProps = state => ({
|
20
|
+
selectedIds: selectSelectedIds(state),
|
21
|
+
remediations: selectAPIResponse(state, REMEDIATIONS_API_KEY).hits || [],
|
22
|
+
status: selectAPIStatus(state, REMEDIATIONS_API_KEY),
|
23
|
+
error: selectAPIErrorMessage(state, REMEDIATIONS_API_KEY),
|
24
|
+
itemCount: selectAPIResponse(state, REMEDIATIONS_API_KEY).itemCount || 0,
|
25
|
+
isAllSelected: selectIsAllSelected(state),
|
26
|
+
query: selectSearch(state),
|
27
|
+
isExperimentalMode: selectExperimental(state),
|
28
|
+
});
|
29
|
+
|
30
|
+
// map action dispatchers to props
|
31
|
+
const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
|
32
|
+
|
33
|
+
// export connected component
|
34
|
+
export default connect(mapStateToProps, mapDispatchToProps)(RemediationModal);
|
@@ -6,10 +6,12 @@ import PageLayout from 'foremanReact/routes/common/PageLayout/PageLayout';
|
|
6
6
|
import InsightsHeader from './Components/InsightsHeader';
|
7
7
|
import { NoTokenEmptyState } from './Components/NoTokenEmptyState';
|
8
8
|
import InsightsTable from './Components/InsightsTable';
|
9
|
+
import RemediationModal from './Components/RemediationModal';
|
9
10
|
import {
|
10
11
|
INSIGHTS_SYNC_PAGE_TITLE,
|
11
12
|
INSIGHTS_SEARCH_PROPS,
|
12
13
|
} from './InsightsCloudSyncConstants';
|
14
|
+
import './InsightsCloudSync.scss';
|
13
15
|
|
14
16
|
const InsightsCloudSync = ({
|
15
17
|
syncInsights,
|
@@ -32,9 +34,12 @@ const InsightsCloudSync = ({
|
|
32
34
|
onSearch={nextQuery => fetchInsights({ query: nextQuery, page: 1 })}
|
33
35
|
header={INSIGHTS_SYNC_PAGE_TITLE}
|
34
36
|
toolbarButtons={
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
<>
|
38
|
+
<RemediationModal />
|
39
|
+
<Button variant="secondary" onClick={syncInsights}>
|
40
|
+
{__('Start recommendations sync')}
|
41
|
+
</Button>
|
42
|
+
</>
|
38
43
|
}
|
39
44
|
searchQuery={query}
|
40
45
|
beforeToolbarComponent={<InsightsHeader />}
|
@@ -27,12 +27,15 @@ exports[`InsightsCloudSync render 1`] = `
|
|
27
27
|
searchQuery=""
|
28
28
|
searchable={true}
|
29
29
|
toolbarButtons={
|
30
|
-
<
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
<React.Fragment>
|
31
|
+
<UNDEFINED />
|
32
|
+
<Button
|
33
|
+
onClick={[Function]}
|
34
|
+
variant="secondary"
|
35
|
+
>
|
36
|
+
Start recommendations sync
|
37
|
+
</Button>
|
38
|
+
</React.Fragment>
|
36
39
|
}
|
37
40
|
>
|
38
41
|
<Connect(InsightsTable) />
|
data/webpack/{InsightsCloudSync/Components/InsightsTable/components → common/table}/EmptyState.js
RENAMED
File without changes
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export const getPerPageOptions = (urlPerPage, appPerPage) => {
|
2
|
+
const initialValues = new Set([5, 10, 15, 25, 50]);
|
3
|
+
initialValues.add(appPerPage);
|
4
|
+
urlPerPage && initialValues.add(urlPerPage);
|
5
|
+
const options = [...initialValues].sort((a, b) => a - b);
|
6
|
+
return options.map(value => ({ title: value.toString(), value }));
|
7
|
+
};
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_rh_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.21.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katello
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- app/helpers/foreman_inventory_upload_helper.rb
|
161
161
|
- app/helpers/foreman_inventory_upload_host_helper.rb
|
162
162
|
- app/models/concerns/rh_cloud_host.rb
|
163
|
+
- app/models/insights_client_report_status.rb
|
163
164
|
- app/models/insights_facet.rb
|
164
165
|
- app/models/insights_hit.rb
|
165
166
|
- app/models/insights_resolution.rb
|
@@ -172,7 +173,11 @@ files:
|
|
172
173
|
- app/services/foreman_rh_cloud/cloud_auth.rb
|
173
174
|
- app/services/foreman_rh_cloud/cloud_connector.rb
|
174
175
|
- app/services/foreman_rh_cloud/cloud_request_forwarder.rb
|
176
|
+
- app/services/foreman_rh_cloud/remediations_retriever.rb
|
177
|
+
- app/services/foreman_rh_cloud/template_renderer_helper.rb
|
178
|
+
- app/subscribers/foreman_rh_cloud/insights_subscriber.rb
|
175
179
|
- app/views/hosts/_insights_tab.html.erb
|
180
|
+
- app/views/job_templates/rh_cloud_remediations.erb
|
176
181
|
- app/views/layouts/foreman_rh_cloud/application.html.erb
|
177
182
|
- config/Gemfile.lock.gh_test
|
178
183
|
- config/database.yml.example
|
@@ -186,6 +191,9 @@ files:
|
|
186
191
|
- db/migrate/20210214000001_create_rules_and_resolutions.foreman_rh_cloud.rb
|
187
192
|
- db/migrate/20210214000002_add_rule_id_to_hits.foreman_rh_cloud.rb
|
188
193
|
- db/migrate/20210307000001_add_unique_to_insights_facet.foreman_rh_cloud.rb
|
194
|
+
- db/migrate/20210404000001_change_resolutions.foreman_rh_cloud.rb
|
195
|
+
- db/seeds.d/179_ui_notifications.rb
|
196
|
+
- db/seeds.d/50_job_templates.rb
|
189
197
|
- lib/foreman_inventory_upload.rb
|
190
198
|
- lib/foreman_inventory_upload/async/async_helpers.rb
|
191
199
|
- lib/foreman_inventory_upload/async/generate_all_reports_job.rb
|
@@ -208,11 +216,16 @@ files:
|
|
208
216
|
- lib/foreman_rh_cloud/version.rb
|
209
217
|
- lib/insights_cloud.rb
|
210
218
|
- lib/insights_cloud/async/insights_full_sync.rb
|
219
|
+
- lib/insights_cloud/async/insights_generate_notifications.rb
|
220
|
+
- lib/insights_cloud/async/insights_resolutions_sync.rb
|
211
221
|
- lib/insights_cloud/async/insights_rules_sync.rb
|
212
222
|
- lib/insights_cloud/async/insights_scheduled_sync.rb
|
213
223
|
- lib/insights_cloud/async/rules_result.rb
|
214
224
|
- lib/inventory_sync/async/host_result.rb
|
215
225
|
- lib/inventory_sync/async/inventory_full_sync.rb
|
226
|
+
- lib/inventory_sync/async/inventory_hosts_sync.rb
|
227
|
+
- lib/inventory_sync/async/inventory_scheduled_sync.rb
|
228
|
+
- lib/inventory_sync/async/query_inventory_job.rb
|
216
229
|
- lib/tasks/foreman_rh_cloud_tasks.rake
|
217
230
|
- lib/tasks/insights.rake
|
218
231
|
- lib/tasks/rh_cloud_inventory.rake
|
@@ -230,9 +243,11 @@ files:
|
|
230
243
|
- test/factories/insights_factories.rb
|
231
244
|
- test/factories/inventory_upload_factories.rb
|
232
245
|
- test/jobs/insights_full_sync_test.rb
|
246
|
+
- test/jobs/insights_resolutions_sync_test.rb
|
233
247
|
- test/jobs/insights_rules_sync_test.rb
|
234
248
|
- test/jobs/inventory_full_sync_test.rb
|
235
249
|
- test/jobs/upload_report_job_test.rb
|
250
|
+
- test/models/insights_client_report_status_test.rb
|
236
251
|
- test/test_plugin_helper.rb
|
237
252
|
- test/unit/archived_report_generator_test.rb
|
238
253
|
- test/unit/fact_helpers_test.rb
|
@@ -241,6 +256,8 @@ files:
|
|
241
256
|
- test/unit/rh_cloud_http_proxy_test.rb
|
242
257
|
- test/unit/services/foreman_rh_cloud/branch_info_test.rb
|
243
258
|
- test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb
|
259
|
+
- test/unit/services/foreman_rh_cloud/remediations_retriever_test.rb
|
260
|
+
- test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
|
244
261
|
- test/unit/shell_process_job_test.rb
|
245
262
|
- test/unit/slice_generator_test.rb
|
246
263
|
- test/unit/tags_generator_test.rb
|
@@ -397,17 +414,14 @@ files:
|
|
397
414
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js
|
398
415
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js
|
399
416
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonConstants.js
|
400
|
-
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js
|
401
417
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonSelectors.js
|
402
418
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButton.test.js
|
403
|
-
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonActions.test.js
|
404
419
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonFixtures.js
|
405
|
-
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonReducer.test.js
|
406
420
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonSelectors.test.js
|
407
421
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap
|
408
|
-
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonActions.test.js.snap
|
409
|
-
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonReducer.test.js.snap
|
410
422
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonSelectors.test.js.snap
|
423
|
+
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap
|
424
|
+
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js
|
411
425
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Modal.js
|
412
426
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js
|
413
427
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/modal.scss
|
@@ -539,15 +553,24 @@ files:
|
|
539
553
|
- webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableActions.test.js.snap
|
540
554
|
- webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableSelectors.test.js.snap
|
541
555
|
- webpack/InsightsCloudSync/Components/InsightsTable/__tests__/fixtures.js
|
542
|
-
- webpack/InsightsCloudSync/Components/InsightsTable/components/EmptyState.js
|
543
556
|
- webpack/InsightsCloudSync/Components/InsightsTable/index.js
|
544
557
|
- webpack/InsightsCloudSync/Components/InsightsTable/table.scss
|
545
558
|
- webpack/InsightsCloudSync/Components/NoTokenEmptyState.js
|
559
|
+
- webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js
|
560
|
+
- webpack/InsightsCloudSync/Components/RemediationModal/RemediationActions.js
|
561
|
+
- webpack/InsightsCloudSync/Components/RemediationModal/RemediationHelpers.js
|
562
|
+
- webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js
|
563
|
+
- webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.scss
|
564
|
+
- webpack/InsightsCloudSync/Components/RemediationModal/RemediationModalFooter.js
|
565
|
+
- webpack/InsightsCloudSync/Components/RemediationModal/RemediationTableConstants.js
|
566
|
+
- webpack/InsightsCloudSync/Components/RemediationModal/Resolutions.js
|
567
|
+
- webpack/InsightsCloudSync/Components/RemediationModal/index.js
|
546
568
|
- webpack/InsightsCloudSync/Components/__tests__/InsightsHeader.test.js
|
547
569
|
- webpack/InsightsCloudSync/Components/__tests__/NoTokenEmptyState.test.js
|
548
570
|
- webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap
|
549
571
|
- webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap
|
550
572
|
- webpack/InsightsCloudSync/InsightsCloudSync.js
|
573
|
+
- webpack/InsightsCloudSync/InsightsCloudSync.scss
|
551
574
|
- webpack/InsightsCloudSync/InsightsCloudSync.test.js
|
552
575
|
- webpack/InsightsCloudSync/InsightsCloudSyncActions.js
|
553
576
|
- webpack/InsightsCloudSync/InsightsCloudSyncConstants.js
|
@@ -588,6 +611,7 @@ files:
|
|
588
611
|
- webpack/__mocks__/foremanReact/redux/API/APISelectors.js
|
589
612
|
- webpack/__mocks__/foremanReact/redux/API/index.js
|
590
613
|
- webpack/__mocks__/foremanReact/redux/actions/toasts.js
|
614
|
+
- webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js
|
591
615
|
- webpack/__mocks__/foremanReact/routes/RouterSelector.js
|
592
616
|
- webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js
|
593
617
|
- webpack/__tests__/ForemanRhCloudHelpers.test.js
|
@@ -604,13 +628,15 @@ files:
|
|
604
628
|
- webpack/common/Switcher/__tests__/__snapshots__/HelpLabel.test.js.snap
|
605
629
|
- webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap
|
606
630
|
- webpack/common/Switcher/index.js
|
631
|
+
- webpack/common/table/EmptyState.js
|
632
|
+
- webpack/common/table/helpers.js
|
607
633
|
- webpack/global_index.js
|
608
634
|
- webpack/index.js
|
609
635
|
homepage: https://github.com/theforeman/foreman_rh_cloud
|
610
636
|
licenses:
|
611
637
|
- GPL-3.0
|
612
638
|
metadata: {}
|
613
|
-
post_install_message:
|
639
|
+
post_install_message:
|
614
640
|
rdoc_options: []
|
615
641
|
require_paths:
|
616
642
|
- lib
|
@@ -625,31 +651,35 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
625
651
|
- !ruby/object:Gem::Version
|
626
652
|
version: '0'
|
627
653
|
requirements: []
|
628
|
-
rubygems_version: 3.
|
629
|
-
signing_key:
|
654
|
+
rubygems_version: 3.2.3
|
655
|
+
signing_key:
|
630
656
|
specification_version: 4
|
631
657
|
summary: Summary of ForemanRhCloud.
|
632
658
|
test_files:
|
633
|
-
- test/controllers/uploads_controller_test.rb
|
634
|
-
- test/controllers/insights_sync/settings_controller_test.rb
|
635
659
|
- test/controllers/accounts_controller_test.rb
|
636
|
-
- test/controllers/uploads_settings_controller_test.rb
|
637
660
|
- test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
|
661
|
+
- test/controllers/insights_sync/settings_controller_test.rb
|
638
662
|
- test/controllers/reports_controller_test.rb
|
639
|
-
- test/
|
640
|
-
- test/
|
663
|
+
- test/controllers/uploads_controller_test.rb
|
664
|
+
- test/controllers/uploads_settings_controller_test.rb
|
665
|
+
- test/factories/insights_factories.rb
|
666
|
+
- test/factories/inventory_upload_factories.rb
|
641
667
|
- test/jobs/insights_full_sync_test.rb
|
668
|
+
- test/jobs/insights_resolutions_sync_test.rb
|
642
669
|
- test/jobs/insights_rules_sync_test.rb
|
643
670
|
- test/jobs/inventory_full_sync_test.rb
|
644
|
-
- test/
|
645
|
-
- test/
|
646
|
-
- test/
|
647
|
-
- test/unit/
|
648
|
-
- test/unit/
|
671
|
+
- test/jobs/upload_report_job_test.rb
|
672
|
+
- test/models/insights_client_report_status_test.rb
|
673
|
+
- test/test_plugin_helper.rb
|
674
|
+
- test/unit/archived_report_generator_test.rb
|
675
|
+
- test/unit/fact_helpers_test.rb
|
649
676
|
- test/unit/insights_facet_test.rb
|
650
|
-
- test/unit/
|
651
|
-
- test/unit/services/foreman_rh_cloud/branch_info_test.rb
|
677
|
+
- test/unit/metadata_generator_test.rb
|
652
678
|
- test/unit/rh_cloud_http_proxy_test.rb
|
653
|
-
- test/unit/
|
654
|
-
- test/unit/
|
679
|
+
- test/unit/services/foreman_rh_cloud/branch_info_test.rb
|
680
|
+
- test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb
|
681
|
+
- test/unit/services/foreman_rh_cloud/remediations_retriever_test.rb
|
682
|
+
- test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
|
683
|
+
- test/unit/shell_process_job_test.rb
|
655
684
|
- test/unit/slice_generator_test.rb
|
685
|
+
- test/unit/tags_generator_test.rb
|