Skip to content

Commit 32baaaa

Browse files
leSamokpatticha
authored and
kpatticha
committed
fix: Deselect all CVEs when action is completed VULN-1903
1 parent 6873d9a commit 32baaaa

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

src/Components/SmartComponents/CVEs/CVEs.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
changeCveListParameters,
1414
fetchCveListByAccount,
1515
selectCve,
16+
deselectAllCves,
1617
expandCve,
1718
clearCVEsStore
1819
} from '../../../Store/Actions/Actions';
@@ -91,14 +92,26 @@ export const CVEs = () => {
9192
const showBusinessRiskModal = cvesList => {
9293
const { meta } = cves;
9394
setBusinessRiskModal(() => () =>
94-
(<BusinessRiskModal cves={cvesList} updateRef={() => updateRef(meta, apply)} />)
95+
<BusinessRiskModal
96+
cves={cvesList}
97+
updateRef={() => {
98+
dispatch(deselectAllCves());
99+
updateRef(meta, apply);
100+
}}
101+
/>
95102
);
96103
};
97104

98105
const showStatusModal = cvesList => {
99106
const { meta } = cves;
100107
setStatusModal(() => () =>
101-
(<StatusModal cves={cvesList} updateRef={() => updateRef(meta, apply)} />)
108+
<StatusModal
109+
cves={cvesList}
110+
updateRef={() => {
111+
dispatch(deselectAllCves());
112+
updateRef(meta, apply);
113+
}}
114+
/>
102115
);
103116
};
104117

src/Store/ActionTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const CHANGE_SYSTEM_CVE_STATUS = 'CHANGE_SYSTEM_CVE_STATUS';
1111
export const CHANGE_EXPOSED_SYSTEMS_PARAMETERS = 'CHANGE_EXPOSED_SYSTEMS_PARAMETERS';
1212
export const CHANGE_CVE_LIST_PARAMETERS = 'CHANGE_CVE_LIST_PARAMETERS';
1313
export const SELECT_CVE = 'SELECT_CVE';
14+
export const DESELECT_ALL_CVES = 'DESELECT_ALL_CVES';
1415
export const SELECT_SYSTEM_CVE = 'SELECT_SYSTEM_CVE';
1516
export const EXPAND_CVE = 'EXPAND_CVE';
1617
export const EXPAND_ROW = 'EXPAND_ROW'; //TODO unify it with EXPAND_CVE action

src/Store/Actions/Actions.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ export const selectCve = apiProps => ({
9494
payload: apiProps
9595
});
9696

97+
export const deselectAllCves = () => ({
98+
type: ActionTypes.DESELECT_ALL_CVES,
99+
payload: []
100+
});
101+
97102
export const expandCve = apiProps => ({
98103
type: ActionTypes.EXPAND_CVE,
99104
payload: apiProps

src/Store/Reducers/CVEsStore.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ export const CVEsStore = (state = initialState, action) => {
8383
};
8484
}
8585

86+
case ActionTypes.DESELECT_ALL_CVES:
87+
return {
88+
...newState,
89+
selectedCves: [],
90+
selectedRowsRawData: []
91+
};
92+
8693
case ActionTypes.EXPAND_CVE: {
8794
if (Array.isArray(action.payload)) {
8895
const expandedRows = action.payload;

0 commit comments

Comments
 (0)