Skip to content

Commit d55c012

Browse files
committed
feat(ExposureReport): RHINENG-20238 - Only allow selecting of the same major version
1 parent 9162b45 commit d55c012

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Components/SmartComponents/Modals/OsExposureReportModal/OsExposureReportModal.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,18 @@ const OsExposureReportModal = ({
127127
return totalCount;
128128
}, [selectedOsVersions]);
129129

130+
const isAllowedMajorVersion = (osMajorVersion) => {
131+
if (selectedOsVersions?.length > 0) {
132+
if (Object.values(selectedOsVersions[0])[0][0]?.osMajorVersion === osMajorVersion) {
133+
return true;
134+
} else {
135+
return false;
136+
}
137+
}
138+
139+
return true;
140+
};
141+
130142
const ACTIVE_FILTERS = [
131143
'impact',
132144
'advisory_available'
@@ -260,7 +272,7 @@ const OsExposureReportModal = ({
260272
{Object.entries(majorVersion).map(
261273
([, minorVersions]) => {
262274
return (
263-
minorVersions.map(({ os, isSelected }, minorIndex) => {
275+
minorVersions.map(({ os, osMajorVersion, isSelected }, minorIndex) => {
264276
return (
265277
<FlexItem style={{ paddingLeft: '16px' }} key={os}>
266278
<Checkbox
@@ -269,7 +281,7 @@ const OsExposureReportModal = ({
269281
isChecked={isSelected}
270282
isDisabled={
271283
(!isSelected && selectedTotal === 5)
272-
|| isFetchLoading
284+
|| isFetchLoading || !isAllowedMajorVersion(osMajorVersion)
273285
}
274286
onChange={(_event, checked) => toggleArrayItem(
275287
index, key, minorIndex, checked

0 commit comments

Comments
 (0)