foreman_rh_cloud 13.2.6 → 13.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/package.json +1 -1
- data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js +6 -1
- data/webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js +45 -6
- data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +26 -11
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 59eab13298515d3f87c52f499b2d79522b5455985ed8c2652400df1790fe7133
|
|
4
|
+
data.tar.gz: 14f62161dbd0e8b635b9d7728f41d121c6be2b76cc042b4c7168d20ca2376641
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2da9750fa293b99a458766c2b08ed045f1d39c07f5275918d8900f146764226654579a92ced0fe033666faf94e4067b8522e2991c19522be5bd067e6f705ef68
|
|
7
|
+
data.tar.gz: e3a262a6166e9c4c5901f4c57d052b24c405756ed0a71acfb3dd71d62a66e99f09d6ff5f0df904d3a932c68d58204466689a587d1c1f723a27e769b9c9789234
|
data/package.json
CHANGED
|
@@ -10,7 +10,12 @@ const CVEsHostDetailsTab = ({ systemId }) => {
|
|
|
10
10
|
const module = './SystemDetailTable';
|
|
11
11
|
return (
|
|
12
12
|
<div className="rh-cloud-insights-vulnerability-host-details-component vulnerability">
|
|
13
|
-
<ScalprumComponent
|
|
13
|
+
<ScalprumComponent
|
|
14
|
+
key={systemId}
|
|
15
|
+
scope={scope}
|
|
16
|
+
module={module}
|
|
17
|
+
systemId={systemId}
|
|
18
|
+
/>
|
|
14
19
|
</div>
|
|
15
20
|
);
|
|
16
21
|
};
|
|
@@ -11,14 +11,25 @@ jest.mock('foremanReact/Root/Context/ForemanContext', () => ({
|
|
|
11
11
|
useForemanPermissions: () => new Set(['view_vulnerability']),
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
|
-
jest.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const mockUnmountTracker = jest.fn();
|
|
15
|
+
jest.mock('@scalprum/react-core', () => {
|
|
16
|
+
const ReactMock = require('react');
|
|
17
|
+
return {
|
|
18
|
+
ScalprumComponent: jest.fn(props => {
|
|
19
|
+
ReactMock.useEffect(() => mockUnmountTracker, []);
|
|
20
|
+
return (
|
|
21
|
+
<div data-testid="mock-scalprum-component">{JSON.stringify(props)}</div>
|
|
22
|
+
);
|
|
23
|
+
}),
|
|
24
|
+
ScalprumProvider: jest.fn(({ children }) => <div>{children}</div>),
|
|
25
|
+
};
|
|
26
|
+
});
|
|
20
27
|
|
|
21
28
|
describe('CVEsHostDetailsTabWrapper', () => {
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
jest.clearAllMocks();
|
|
31
|
+
});
|
|
32
|
+
|
|
22
33
|
it('renders without crashing', () => {
|
|
23
34
|
const { container } = render(
|
|
24
35
|
<CVEsHostDetailsTabWrapper
|
|
@@ -31,4 +42,32 @@ describe('CVEsHostDetailsTabWrapper', () => {
|
|
|
31
42
|
)
|
|
32
43
|
).toBeTruthy();
|
|
33
44
|
});
|
|
45
|
+
|
|
46
|
+
it('remounts ScalprumComponent when systemId changes', () => {
|
|
47
|
+
const { ScalprumComponent } = require('@scalprum/react-core');
|
|
48
|
+
|
|
49
|
+
const { rerender } = render(
|
|
50
|
+
<CVEsHostDetailsTabWrapper
|
|
51
|
+
response={{ subscription_facet_attributes: { uuid: 'uuid-host-A' } }}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
expect(mockUnmountTracker).not.toHaveBeenCalled();
|
|
56
|
+
expect(ScalprumComponent).toHaveBeenLastCalledWith(
|
|
57
|
+
expect.objectContaining({ systemId: 'uuid-host-A' }),
|
|
58
|
+
expect.anything()
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
rerender(
|
|
62
|
+
<CVEsHostDetailsTabWrapper
|
|
63
|
+
response={{ subscription_facet_attributes: { uuid: 'uuid-host-B' } }}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
expect(mockUnmountTracker).toHaveBeenCalledTimes(1);
|
|
68
|
+
expect(ScalprumComponent).toHaveBeenLastCalledWith(
|
|
69
|
+
expect.objectContaining({ systemId: 'uuid-host-B' }),
|
|
70
|
+
expect.anything()
|
|
71
|
+
);
|
|
72
|
+
});
|
|
34
73
|
});
|
|
@@ -128,17 +128,32 @@ NewHostDetailsTab.defaultProps = {
|
|
|
128
128
|
const scope = 'advisor';
|
|
129
129
|
const module = './SystemDetailWrapped';
|
|
130
130
|
|
|
131
|
-
const IopInsightsTab = props =>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
131
|
+
const IopInsightsTab = props => {
|
|
132
|
+
// eslint-disable-next-line camelcase
|
|
133
|
+
const systemId = props.response?.subscription_facet_attributes?.uuid;
|
|
134
|
+
return (
|
|
135
|
+
<div className="advisor">
|
|
136
|
+
<ScalprumComponent
|
|
137
|
+
key={systemId || props.hostName}
|
|
138
|
+
scope={scope}
|
|
139
|
+
module={module}
|
|
140
|
+
IopRemediationModal={RemediationModal}
|
|
141
|
+
generateRuleUrl={generateRuleUrl}
|
|
142
|
+
{...props}
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
IopInsightsTab.propTypes = {
|
|
149
|
+
hostName: PropTypes.string,
|
|
150
|
+
response: PropTypes.object,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
IopInsightsTab.defaultProps = {
|
|
154
|
+
hostName: '',
|
|
155
|
+
response: {},
|
|
156
|
+
};
|
|
142
157
|
|
|
143
158
|
const IopInsightsTabWrapped = props => {
|
|
144
159
|
const permissions = useInsightsPermissions();
|