Skip to content

Commit

Permalink
fix: Deselect all CVEs when action is completed VULN-1903
Browse files Browse the repository at this point in the history
  • Loading branch information
leSamo authored and kpatticha committed Sep 17, 2021
1 parent 6873d9a commit 32baaaa
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/Components/SmartComponents/CVEs/CVEs.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
changeCveListParameters,
fetchCveListByAccount,
selectCve,
deselectAllCves,
expandCve,
clearCVEsStore
} from '../../../Store/Actions/Actions';
Expand Down Expand Up @@ -91,14 +92,26 @@ export const CVEs = () => {
const showBusinessRiskModal = cvesList => {
const { meta } = cves;
setBusinessRiskModal(() => () =>
(<BusinessRiskModal cves={cvesList} updateRef={() => updateRef(meta, apply)} />)
<BusinessRiskModal
cves={cvesList}
updateRef={() => {
dispatch(deselectAllCves());
updateRef(meta, apply);
}}
/>
);
};

const showStatusModal = cvesList => {
const { meta } = cves;
setStatusModal(() => () =>
(<StatusModal cves={cvesList} updateRef={() => updateRef(meta, apply)} />)
<StatusModal
cves={cvesList}
updateRef={() => {
dispatch(deselectAllCves());
updateRef(meta, apply);
}}
/>
);
};

Expand Down
1 change: 1 addition & 0 deletions src/Store/ActionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const CHANGE_SYSTEM_CVE_STATUS = 'CHANGE_SYSTEM_CVE_STATUS';
export const CHANGE_EXPOSED_SYSTEMS_PARAMETERS = 'CHANGE_EXPOSED_SYSTEMS_PARAMETERS';
export const CHANGE_CVE_LIST_PARAMETERS = 'CHANGE_CVE_LIST_PARAMETERS';
export const SELECT_CVE = 'SELECT_CVE';
export const DESELECT_ALL_CVES = 'DESELECT_ALL_CVES';
export const SELECT_SYSTEM_CVE = 'SELECT_SYSTEM_CVE';
export const EXPAND_CVE = 'EXPAND_CVE';
export const EXPAND_ROW = 'EXPAND_ROW'; //TODO unify it with EXPAND_CVE action
Expand Down
5 changes: 5 additions & 0 deletions src/Store/Actions/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ export const selectCve = apiProps => ({
payload: apiProps
});

export const deselectAllCves = () => ({
type: ActionTypes.DESELECT_ALL_CVES,
payload: []
});

export const expandCve = apiProps => ({
type: ActionTypes.EXPAND_CVE,
payload: apiProps
Expand Down
7 changes: 7 additions & 0 deletions src/Store/Reducers/CVEsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ export const CVEsStore = (state = initialState, action) => {
};
}

case ActionTypes.DESELECT_ALL_CVES:
return {
...newState,
selectedCves: [],
selectedRowsRawData: []
};

case ActionTypes.EXPAND_CVE: {
if (Array.isArray(action.payload)) {
const expandedRows = action.payload;
Expand Down

0 comments on commit 32baaaa

Please sign in to comment.