diff --git a/plugins/services/src/js/components/ServicesQuotaOverviewDetail.tsx b/plugins/services/src/js/components/ServicesQuotaOverviewDetail.tsx index efbb6093bf..dab13da7dc 100644 --- a/plugins/services/src/js/components/ServicesQuotaOverviewDetail.tsx +++ b/plugins/services/src/js/components/ServicesQuotaOverviewDetail.tsx @@ -30,15 +30,9 @@ export interface ServicesQuotaOverviewDetailProps { id: string; } -function getQuotaPercentage( - group: ServiceGroup, - resource: string -): number | null { - const resourceQuota: QuotaResources | undefined = findNestedPropertyInObject( - group.quota, - resource - ); - if (!resourceQuota || !resourceQuota.limit) { +function getQuotaPercentage(group: ServiceGroup, resource): number | null { + const resourceQuota = group.quota?.[resource]; + if (typeof resourceQuota?.limit !== "number") { return null; } @@ -61,7 +55,7 @@ function getQuotaConsumedOfLimit( resource ); - if (!resourceQuota || !resourceQuota.limit) { + if (typeof resourceQuota?.limit !== "number") { return null; } const consumed = QuotaUtil.formatQuotaValueForDisplay( diff --git a/tests/_fixtures/quota-management/roles.json b/tests/_fixtures/quota-management/roles.json index cb902fac2f..548258078e 100644 --- a/tests/_fixtures/quota-management/roles.json +++ b/tests/_fixtures/quota-management/roles.json @@ -55,7 +55,6 @@ "limit": { "cpus": 2.0, "disk": 10.0, - "gpus": 0, "mem": 1024.0 }, "consumed": {