mirror of
https://github.com/supabase/supabase.git
synced 2026-06-17 21:23:59 +08:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
23 lines
600 B
TypeScript
23 lines
600 B
TypeScript
import type { OrgMetricsUsage } from '@/data/usage/org-usage-query'
|
|
|
|
export const getResourcesExceededLimitsOrg = (usageMetrics: OrgMetricsUsage[]): string[] => {
|
|
if (!usageMetrics.length) return []
|
|
|
|
return usageMetrics
|
|
.filter((usageMetric) => {
|
|
if (
|
|
!usageMetric.capped ||
|
|
!usageMetric.available_in_plan ||
|
|
usageMetric.unlimited ||
|
|
usageMetric.metric === 'DISK_IOPS_GP3'
|
|
) {
|
|
return false
|
|
}
|
|
|
|
const freeUnits = usageMetric.pricing_free_units || 0
|
|
|
|
return usageMetric.usage > freeUnits
|
|
})
|
|
.map((it) => it.metric)
|
|
}
|