Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: add violation type to restriction banner (#36970)

Pamela Chiac0b3a860523d
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingBreakdown.constants.ts b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingBreakdown.constants.ts
index 084d2a258f8..7d3d14992b2 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingBreakdown.constants.ts
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingBreakdown.constants.ts
@@ -24,7 +24,7 @@ export const BILLING_BREAKDOWN_METRICS: Metric[] = [
anchor: 'dbSize',
category: 'Database',
unitName: 'GB',
- tip: 'Database size refers to the actual amount of space used by all your database objects, as reported by Postgres. Free Plan projects are limited to 0.5 GB Database Size each.',
+ tip: 'Database size refers to the actual amount of space used by all your database objects, as reported by Postgres. This measurement reflects your current database size at this moment. Free Plan projects are limited to 0.5 GB Database Size each and are monitored across the entire billing period.',
},
{
key: PricingMetric.EGRESS,
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Restriction.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Restriction.tsx
index eb2cb8e44be..93eaf26e1b0 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/Restriction.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/Restriction.tsx
@@ -3,6 +3,7 @@ import { ExternalLink } from 'lucide-react'
import Link from 'next/link'
import { useOrgUsageQuery } from 'data/usage/org-usage-query'
+import { VIOLATION_TYPE_LABELS } from 'data/usage/constants'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Button } from 'ui'
import { CriticalIcon, WarningIcon } from 'ui'
@@ -47,6 +48,14 @@ export const Restriction = () => {
return null
}
+ const violationLabels =
+ Array.isArray(org.restriction_data['violations']) &&
+ org.restriction_data['violations'].length > 0
+ ? `(${org.restriction_data['violations']
+ .map((violation: string) => VIOLATION_TYPE_LABELS[violation] || violation)
+ .join(', ')})`
+ : ''
+
return (
<>
{shownAlert === 'exceededLimits' && (
@@ -93,8 +102,9 @@ export const Restriction = () => {
<AlertTitle_Shadcn_>Your grace period has started.</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_>
<p className="leading-tight">
- Your organization is over its quota. You can continue with your projects until your
- grace period ends on{' '}
+ Your organization is over its quota
+ {violationLabels && ` ${violationLabels}`}. You can continue with your projects until
+ your grace period ends on{' '}
<span className="text-foreground">
{dayjs(org.restriction_data['grace_period_end']).format('DD MMM, YYYY')}
</span>
@@ -179,12 +189,9 @@ export const Restriction = () => {
<p>
Fair Use Policy applies and your service is restricted. Your projects are not able to
serve requests and will respond with a 402 status code. You have exceeded your plan’s
- quota and your grace period ended on{' '}
- <span className="text-foreground">
- {dayjs(org.restriction_data['grace_period_end']).format('DD MMM, YYYY')}
- </span>
- . {org.plan.id === 'free' ? 'Upgrade your plan' : 'Disable spend cap'} to lift
- restrictions or wait until your quota refills.
+ quota{violationLabels && ` ${violationLabels}`}.{' '}
+ {org.plan.id === 'free' ? 'Upgrade your plan' : 'Disable spend cap'} to lift
+ restrictions or wait until your quota refills on your next billing period.
</p>
<div className="flex items-center gap-x-2 mt-3">
<Button key="upgrade-button" asChild type="default">
diff --git a/apps/studio/data/usage/constants.ts b/apps/studio/data/usage/constants.ts
new file mode 100644
index 00000000000..6038ca62277
--- /dev/null
+++ b/apps/studio/data/usage/constants.ts
@@ -0,0 +1,11 @@
+export const VIOLATION_TYPE_LABELS: Record<string, string> = {
+ exceed_db_size_quota: 'DB Size Exceeded',
+ exceed_egress_quota: 'Egress Exceeded',
+ exceed_edge_functions_count_quota: 'Edge Functions Count Exceeded',
+ exceed_edge_functions_invocations_quota: 'Edge Functions Invocations Exceeded',
+ exceed_monthly_active_users_quota: 'Monthly Active Users Exceeded',
+ exceed_realtime_connection_count_quota: 'Realtime Connection Count Exceeded',
+ exceed_realtime_message_count_quota: 'Realtime Message Count Exceeded',
+ exceed_storage_size_quota: 'Storage Size Exceeded',
+ overdue_payment: 'Overdue Payment',
+}