@@ -7,6 +7,8 @@ import { SELECTED_FILTER_PREFIX } from "../../constants"
77import { VulnerabilitiesSearchParams } from "../../routes/vulnerabilities"
88import { IssuesCountsType } from "../types"
99
10+ const DEFAULT_COUNT = 0
11+
1012export function getActiveVulnerabilityFilter ( filterSettings : FilterSettings ) {
1113 const filter : any = { }
1214 filterSettings . selectedFilters ?. forEach ( ( f : any ) => {
@@ -130,7 +132,7 @@ export function getNormalizedVulnerabilitiesResponse(
130132 earliestTargetRemediationDate : edge ?. node ?. earliestTargetRemediationDate || "" ,
131133 sourceUrl : edge ?. node ?. sourceUrl || "" ,
132134 description : edge ?. node ?. description || "" ,
133- servicesCount : edge ?. node ?. services ?. totalCount || 0 ,
135+ servicesCount : edge ?. node ?. services ?. totalCount || DEFAULT_COUNT ,
134136 services,
135137 supportGroups,
136138 }
@@ -140,16 +142,16 @@ export function getNormalizedVulnerabilitiesResponse(
140142
141143 return {
142144 vulnerabilities,
143- totalVulnerabilities : counts ?. total || 0 ,
145+ totalVulnerabilities : counts ?. total || DEFAULT_COUNT ,
144146 pages : data ?. Vulnerabilities ?. pageInfo ?. pages ?. filter ( ( edge ) => edge !== null ) || [ ] ,
145147 pageNumber : data ?. Vulnerabilities ?. pageInfo ?. pageNumber || 1 ,
146148 vulnerabilitiesCounts : {
147- critical : counts ?. critical || 0 ,
148- high : counts ?. high || 0 ,
149- medium : counts ?. medium || 0 ,
150- low : counts ?. low || 0 ,
151- none : counts ?. none || 0 ,
152- total : counts ?. total || 0 ,
149+ critical : counts ?. critical || DEFAULT_COUNT ,
150+ high : counts ?. high || DEFAULT_COUNT ,
151+ medium : counts ?. medium || DEFAULT_COUNT ,
152+ low : counts ?. low || DEFAULT_COUNT ,
153+ none : counts ?. none || DEFAULT_COUNT ,
154+ total : counts ?. total || DEFAULT_COUNT ,
153155 } ,
154156 }
155157}
0 commit comments