diff --git a/frontend/src/pages/Risk/VulnerabilityBarChart.tsx b/frontend/src/pages/Risk/VulnerabilityBarChart.tsx index 3cafd97d..5089bd4d 100644 --- a/frontend/src/pages/Risk/VulnerabilityBarChart.tsx +++ b/frontend/src/pages/Risk/VulnerabilityBarChart.tsx @@ -95,14 +95,7 @@ const VulnerabilityBarChart = (props: { if (severityLevels.includes(d.id)) { return d; } - if ( - d.id === null || - d.id === undefined || - d.id === 'Null' || - d.id === 'N/a' || - d.id === 'undefined' || - d.id === '' - ) { + if (!d.id || ['Null', 'N/a', 'undefined', ''].includes(d.id)) { return { id: 'N/A', value: d.value }; } else { return { id: 'Other', value: d.value }; @@ -125,6 +118,9 @@ const VulnerabilityBarChart = (props: { return order.indexOf(a.id) - order.indexOf(b.id); }); + console.log('severities', data); + console.log('groupedData', groupedData); + useEffect(() => { const label = `${title} bar chart. ` + diff --git a/frontend/src/pages/Vulnerabilities/Vulnerabilities.tsx b/frontend/src/pages/Vulnerabilities/Vulnerabilities.tsx index 1f41b052..879bb5b5 100644 --- a/frontend/src/pages/Vulnerabilities/Vulnerabilities.tsx +++ b/frontend/src/pages/Vulnerabilities/Vulnerabilities.tsx @@ -321,21 +321,14 @@ export const Vulnerabilities: React.FC<{ groupBy?: string }> = ({ 'Other' ]; - // To-Do: Create array(s) to handle permutations of null and N/A values - const formatSeverity = (severity?: any) => { const titleCaseSev = titleCase(severity); if (severityLevels.includes(titleCaseSev)) { return titleCaseSev; } - if ( - titleCaseSev === null || - titleCaseSev === undefined || - titleCaseSev === 'Null' || - titleCaseSev === 'N/a' || - titleCaseSev === 'undefined' || - titleCaseSev === '' + !titleCaseSev || + ['Null', 'N/a', 'undefined', ''].includes(titleCaseSev) ) { return 'N/A'; } else { @@ -369,6 +362,10 @@ export const Vulnerabilities: React.FC<{ groupBy?: string }> = ({ state: vuln.state + (vuln.substate ? ` (${vuln.substate})` : '') }; }); + const vulnSev = vulnerabilities.map((vuln) => vuln.severity); + console.log('vulnSev', vulnSev); + const vulRowsSev = vulRows.map((vuln) => vuln.severity); + console.log('vulRows', vulRowsSev); const vulCols: GridColDef[] = [ {