The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Scaffold warnings in usage project usage page for CPU and RAM
Joshen Lim1daa80e15c7b
diff --git a/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx b/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsxindex f4314f551be..60d929e28fb 100644--- a/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx+++ b/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx@@ -1,18 +1,19 @@+import dayjs from 'dayjs'+import { IconBarChart2 } from 'ui'++import Panel from 'components/ui/Panel'import ShimmeringLoader from 'components/ui/ShimmeringLoader'import { DataPoint } from 'data/analytics/constants'import { useInfraMonitoringQuery } from 'data/analytics/infra-monitoring-query'-import dayjs from 'dayjs'-import Link from 'next/link'-import { Alert, Button, IconBarChart2 } from 'ui'+import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'+import { useProjectSubscriptionV2Query } from 'data/subscriptions/project-subscription-v2-query'+import { getAddons } from '../Subscription/Subscription.utils'import SectionContent from './SectionContent'import SectionHeader from './SectionHeader'import { USAGE_CATEGORIES } from './Usage.constants'import { getUpgradeUrl } from './Usage.utils'import UsageBarChart from './UsageBarChart'-import Panel from 'components/ui/Panel'-import { useProjectSubscriptionV2Query } from 'data/subscriptions/project-subscription-v2-query'-import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'-import { getAddons } from '../Subscription/Subscription.utils'+import { CPUWarnings, DiskIOBandwidthWarnings, RAMWarnings } from './UsageWarningAlerts'export interface InfrastructureProps {projectRef: string@@ -28,7 +29,6 @@ const Infrastructure = ({currentBillingCycleSelected,}: InfrastructureProps) => {const { data: subscription } = useProjectSubscriptionV2Query({ projectRef })-const categoryMeta = USAGE_CATEGORIES.find((category) => category.key === 'infra')const upgradeUrl = getUpgradeUrl(projectRef, subscription)@@ -125,81 +125,14 @@ const Infrastructure = ({<SectionContent section={attribute}>{attribute.key === 'disk_io_consumption' && (<>- {hasLatest && latestIoBudgetConsumption >= 100 ? (- <Alert withIcon variant="danger" title="Your Disk IO Budget has been used up">- <p className="mb-4">- Your workload has used up all your Disk IO Budget and is now running at the- baseline performance. If you need consistent disk performance, consider- upgrading to a larger compute add-on.- </p>- <Link href={upgradeUrl}>- <a>- <Button type="danger">- {isFreeTier ? 'Upgrade project' : 'Change compute add-on'}- </Button>- </a>- </Link>- </Alert>- ) : hasLatest && latestIoBudgetConsumption >= 80 ? (- <Alert- withIcon- variant="danger"- title="You are close to running out of Disk IO Budget"- >- <p className="mb-4">- Your workload has consumed {latestIoBudgetConsumption}% of your Disk IO- Budget. If you use up all your Disk IO Budget, your instance will reverted- to baseline performance. If you need consistent disk performance, consider- upgrading to a larger compute add-on.- </p>- <Link href={upgradeUrl}>- <a>- <Button type="danger">- {isFreeTier ? 'Upgrade project' : 'Change compute add-on'}- </Button>- </a>- </Link>- </Alert>- ) : currentBillingCycleSelected && highestIoBudgetConsumption >= 100 ? (- <Alert- withIcon- variant="warning"- title="You ran out of IO Budget at least once"- >- <p className="mb-4">- Your workload has used up all your Disk IO Budget and reverted to baseline- performance at least once during this billing cycle. If you need consistent- disk performance, consider upgrading to a larger compute add-on.- </p>- <Link href={upgradeUrl}>- <a>- <Button type="warning">- {isFreeTier ? 'Upgrade project' : 'Change compute add-on'}- </Button>- </a>- </Link>- </Alert>- ) : currentBillingCycleSelected && highestIoBudgetConsumption >= 80 ? (- <Alert- withIcon- variant="warning"- title="You were close to using all your IO Budget at least once"- >- <p className="mb-4">- Your workload has consumed {highestIoBudgetConsumption}% of your Disk IO- budget during this billing cycle. If you use up all your Disk IO Budget,- your instance will reverted to baseline performance. If you need consistent- disk performance, consider upgrading to a larger compute add-on.- </p>- <Link href={upgradeUrl}>- <a>- <Button type="warning">- {isFreeTier ? 'Upgrade project' : 'Change compute add-on'}- </Button>- </a>- </Link>- </Alert>- ) : null}+ <DiskIOBandwidthWarnings+ upgradeUrl={upgradeUrl}+ isFreeTier={isFreeTier}+ hasLatest={hasLatest}+ currentBillingCycleSelected={currentBillingCycleSelected}+ latestIoBudgetConsumption={latestIoBudgetConsumption}+ highestIoBudgetConsumption={highestIoBudgetConsumption}+ /><div className="space-y-1"><p>Disk IO Bandwidth</p>@@ -246,7 +179,13 @@ const Infrastructure = ({</div></>)}- {/* [Joshen TODO] Add the necessary alert warnings for CPU and RAM here as well */}+ {attribute.key === 'max_cpu_usage' && (+ <CPUWarnings isFreeTier={isFreeTier} upgradeUrl={upgradeUrl} />+ )}+ {attribute.key === 'ram_usage' && (+ <RAMWarnings isFreeTier={isFreeTier} upgradeUrl={upgradeUrl} />+ )}+<div className="space-y-1"><div className="flex flex-row justify-between">{attribute.key === 'disk_io_consumption' ? (diff --git a/studio/components/interfaces/BillingV2/Usage/Usage.tsx b/studio/components/interfaces/BillingV2/Usage/Usage.tsxindex cd61a2d5889..456e3de8db6 100644--- a/studio/components/interfaces/BillingV2/Usage/Usage.tsx+++ b/studio/components/interfaces/BillingV2/Usage/Usage.tsx@@ -1,15 +1,16 @@import clsx from 'clsx'import { useParams } from 'common'+import dayjs from 'dayjs'+import { useMemo, useRef, useState } from 'react'+import { InView } from 'react-intersection-observer'+import { IconAlertCircle, IconLoader, cn } from 'ui'+import DateRangePicker from 'components/to-be-cleaned/DateRangePicker'import { useInfraMonitoringQuery } from 'data/analytics/infra-monitoring-query'import { useProjectSubscriptionV2Query } from 'data/subscriptions/project-subscription-v2-query'import { useProjectUsageQuery } from 'data/usage/project-usage-query'-import dayjs from 'dayjs'import { useSelectedOrganization } from 'hooks'import { TIME_PERIODS_BILLING, TIME_PERIODS_REPORTS } from 'lib/constants'-import { useMemo, useRef, useState } from 'react'-import { InView } from 'react-intersection-observer'-import { IconAlertCircle, IconLoader, cn } from 'ui'import Activity from './Activity'import Bandwidth from './Bandwidth'import Infrastructure from './Infrastructure'diff --git a/studio/components/interfaces/BillingV2/Usage/UsageWarningAlerts/CPUWarnings.tsx b/studio/components/interfaces/BillingV2/Usage/UsageWarningAlerts/CPUWarnings.tsxnew file mode 100644index 00000000000..fe6a94f102d--- /dev/null+++ b/studio/components/interfaces/BillingV2/Usage/UsageWarningAlerts/CPUWarnings.tsx@@ -0,0 +1,74 @@+import { AlertTitle } from '@ui/components/shadcn/ui/alert'+import Link from 'next/link'+import { AlertDescription_Shadcn_, Alert_Shadcn_, Button, IconAlertCircle } from 'ui'++interface CPUWarningsProps {+ isFreeTier: boolean+ upgradeUrl: string+}++const CPUWarnings = ({ isFreeTier, upgradeUrl }: CPUWarningsProps) => {+ // [Joshen TODO] Need to implement the necessary conditionals for rendering the warnings+ const isApproaching = false+ const isExceeded = false++ if (isApproaching) {+ return (+ <Alert_Shadcn_ variant="warning">+ <IconAlertCircle />+ <AlertTitle>Your max CPU usage has exceeded 80%</AlertTitle>+ <AlertDescription_Shadcn_>+ High CPU usage could result in slower queries, disruption of daily back routines, and in+ rare cases, your instance may become unresponsive. If you need more resources, consider+ upgrading to a larger compute add-on.+ </AlertDescription_Shadcn_>+ <div className="mt-3 flex items-center space-x-2">+ <Link href="https://supabase.com/docs/guides/platform/exhaust-cpu">+ <a>+ <Button type="default">Learn more</Button>+ </a>+ </Link>+ <Link href={upgradeUrl}>+ <a>+ <Button type="warning">+ {isFreeTier ? 'Upgrade project' : 'Change compute add-on'}+ </Button>+ </a>+ </Link>+ </div>+ </Alert_Shadcn_>+ )+ }++ if (isExceeded) {+ return (+ <Alert_Shadcn_ variant="destructive">+ <IconAlertCircle />+ <AlertTitle>Your max CPU usage has reached 100%</AlertTitle>+ <AlertDescription_Shadcn_>+ High CPU usage could result in slower queries, disruption of daily back routines, and in+ rare cases, your instance may become unresponsive. If you need more resources, consider+ upgrading to a larger compute add-on.+ </AlertDescription_Shadcn_>+ <div className="mt-3 flex items-center space-x-2">+ <Link href="https://supabase.com/docs/guides/platform/exhaust-cpu">+ <a>+ <Button type="default">Learn more</Button>+ </a>+ </Link>+ <Link href={upgradeUrl}>+ <a>+ <Button type="danger">+ {isFreeTier ? 'Upgrade project' : 'Change compute add-on'}+ </Button>+ </a>+ </Link>+ </div>+ </Alert_Shadcn_>+ )+ }++ return null+}++export default CPUWarningsdiff --git a/studio/components/interfaces/BillingV2/Usage/UsageWarningAlerts/DiskIOBandwidthWarnings.tsx b/studio/components/interfaces/BillingV2/Usage/UsageWarningAlerts/DiskIOBandwidthWarnings.tsxnew file mode 100644index 00000000000..0d092e75878--- /dev/null+++ b/studio/components/interfaces/BillingV2/Usage/UsageWarningAlerts/DiskIOBandwidthWarnings.tsx@@ -0,0 +1,106 @@+import Link from 'next/link'+import { Alert, Button } from 'ui'++// [Joshen] In the future, conditionals should be from resource exhaustion endpoint as single source of truth+interface DiskIOBandwidthWarningsProps {+ isFreeTier: boolean+ hasLatest: boolean+ upgradeUrl: string+ currentBillingCycleSelected: boolean+ latestIoBudgetConsumption: number+ highestIoBudgetConsumption: number+}++const DiskIOBandwidthWarnings = ({+ isFreeTier,+ hasLatest,+ currentBillingCycleSelected,+ upgradeUrl,+ latestIoBudgetConsumption,+ highestIoBudgetConsumption,+}: DiskIOBandwidthWarningsProps) => {+ if (hasLatest && latestIoBudgetConsumption >= 100) {+ return (+ <Alert withIcon variant="danger" title="Your Disk IO Budget has been used up">+ <p className="mb-4">+ Your workload has used up all your Disk IO Budget and is now running at the baseline+ performance. If you need consistent disk performance, consider upgrading to a larger+ compute add-on.+ </p>+ <Link href={upgradeUrl}>+ <a>+ <Button type="danger">+ {isFreeTier ? 'Upgrade project' : 'Change compute add-on'}+ </Button>+ </a>+ </Link>+ </Alert>+ )+ }++ if (hasLatest && latestIoBudgetConsumption >= 80) {+ return (+ <Alert withIcon variant="danger" title="You are close to running out of Disk IO Budget">+ <p className="mb-4">+ Your workload has consumed {latestIoBudgetConsumption}% of your Disk IO Budget. If you use+ up all your Disk IO Budget, your instance will reverted to baseline performance. If you+ need consistent disk performance, consider upgrading to a larger compute add-on.+ </p>+ <Link href={upgradeUrl}>+ <a>+ <Button type="danger">+ {isFreeTier ? 'Upgrade project' : 'Change compute add-on'}+ </Button>+ </a>+ </Link>+ </Alert>+ )+ }++ if (currentBillingCycleSelected && highestIoBudgetConsumption >= 100) {+ return (+ <Alert withIcon variant="warning" title="You ran out of IO Budget at least once">+ <p className="mb-4">+ Your workload has used up all your Disk IO Budget and reverted to baseline performance at+ least once during this billing cycle. If you need consistent disk performance, consider+ upgrading to a larger compute add-on.+ </p>+ <Link href={upgradeUrl}>+ <a>+ <Button type="warning">+ {isFreeTier ? 'Upgrade project' : 'Change compute add-on'}+ </Button>+ </a>+ </Link>+ </Alert>+ )+ }++ if (currentBillingCycleSelected && highestIoBudgetConsumption >= 80) {+ return (+ <Alert+ withIcon+ variant="warning"+ title="You were close to using all your IO Budget at least once"+ >+ <p className="mb-4">+ Your workload has consumed {highestIoBudgetConsumption}% of your Disk IO budget during+ this billing cycle. If you use up all your Disk IO Budget, your instance will reverted to+ baseline performance. If you need consistent disk performance, consider upgrading to a+ larger compute add-on.+ </p>+ <Link href={upgradeUrl}>+ <a>+ <Button type="warning">+ {isFreeTier ? 'Upgrade project' : 'Change compute add-on'}+ </Button>+ </a>+ </Link>+ </Alert>+ )+ }++ return null+}++export default DiskIOBandwidthWarningsdiff --git a/studio/components/interfaces/BillingV2/Usage/UsageWarningAlerts/RAMWarnings.tsx b/studio/components/interfaces/BillingV2/Usage/UsageWarningAlerts/RAMWarnings.tsxnew file mode 100644index 00000000000..0a106669311--- /dev/null+++ b/studio/components/interfaces/BillingV2/Usage/UsageWarningAlerts/RAMWarnings.tsx@@ -0,0 +1,74 @@+import { AlertTitle } from '@ui/components/shadcn/ui/alert'+import Link from 'next/link'+import { AlertDescription_Shadcn_, Alert_Shadcn_, Button, IconAlertCircle } from 'ui'++interface RAMWarningsProps {+ isFreeTier: boolean+ upgradeUrl: string+}++// [Joshen TODO] Need to implement the necessary conditionals for rendering the warnings+const RAMWarnings = ({ isFreeTier, upgradeUrl }: RAMWarningsProps) => {+ const isApproaching = true+ const isExceeded = false++ if (isApproaching) {+ return (+ <Alert_Shadcn_ variant="warning">+ <IconAlertCircle />+ <AlertTitle>Your memory usage has exceeded 80%</AlertTitle>+ <AlertDescription_Shadcn_>+ High memory usage could result in overall degraded performance, and in rare cases, your+ instance may become unresponsive. If you need more resources, consider upgrading to a+ larger compute add-on.+ </AlertDescription_Shadcn_>+ <div className="mt-3 flex items-center space-x-2">+ <Link href="https://supabase.com/docs/guides/platform/exhaust-ram">+ <a>+ <Button type="default">Learn more</Button>+ </a>+ </Link>+ <Link href={upgradeUrl}>+ <a>+ <Button type="warning">+ {isFreeTier ? 'Upgrade project' : 'Change compute add-on'}+ </Button>+ </a>+ </Link>+ </div>+ </Alert_Shadcn_>+ )+ }++ if (isExceeded) {+ return (+ <Alert_Shadcn_ variant="destructive">+ <IconAlertCircle />+ <AlertTitle>Your memory usage has reached 100%</AlertTitle>+ <AlertDescription_Shadcn_>+ High memory usage could result in overall degraded performance, and in rare cases, your+ instance may become unresponsive. If you need more resources, consider upgrading to a+ larger compute add-on.+ </AlertDescription_Shadcn_>+ <div className="mt-3 flex items-center space-x-2">+ <Link href="https://supabase.com/docs/guides/platform/exhaust-cpu">+ <a>+ <Button type="default">Learn more</Button>+ </a>+ </Link>+ <Link href={upgradeUrl}>+ <a>+ <Button type="danger">+ {isFreeTier ? 'Upgrade project' : 'Change compute add-on'}+ </Button>+ </a>+ </Link>+ </div>+ </Alert_Shadcn_>+ )+ }++ return null+}++export default RAMWarningsdiff --git a/studio/components/interfaces/BillingV2/Usage/UsageWarningAlerts/index.ts b/studio/components/interfaces/BillingV2/Usage/UsageWarningAlerts/index.tsnew file mode 100644index 00000000000..3b3afe3f30e--- /dev/null+++ b/studio/components/interfaces/BillingV2/Usage/UsageWarningAlerts/index.ts@@ -0,0 +1,5 @@+import CPUWarnings from './CPUWarnings'+import DiskIOBandwidthWarnings from './DiskIOBandwidthWarnings'+import RAMWarnings from './RAMWarnings'++export { CPUWarnings, DiskIOBandwidthWarnings, RAMWarnings }diff --git a/studio/components/interfaces/Home/ProjectList/ProjectCardWarnings.tsx b/studio/components/interfaces/Home/ProjectList/ProjectCardWarnings.tsxindex 5453f2df74b..a0d7b2bbd85 100644--- a/studio/components/interfaces/Home/ProjectList/ProjectCardWarnings.tsx+++ b/studio/components/interfaces/Home/ProjectList/ProjectCardWarnings.tsx@@ -35,7 +35,7 @@ const RESOURCE_WARNING_MESSAGES = {}const ProjectCardWarnings = ({ resourceWarnings }: ProjectCardWarningsProps) => {- // [Joshen] Read only takes higher precendence over multiple resource warnings+ // [Joshen] Read only takes higher precedence over multiple resource warningsconst activeWarnings = resourceWarnings.is_readonly_mode_enabled? ['is_readonly_mode_enabled']: Object.keys(resourceWarnings).filter(diff --git a/studio/components/layouts/ProjectLayout/BuildingState.tsx b/studio/components/layouts/ProjectLayout/BuildingState.tsxindex 42418ba43ab..733d04fbe93 100644--- a/studio/components/layouts/ProjectLayout/BuildingState.tsx+++ b/studio/components/layouts/ProjectLayout/BuildingState.tsx@@ -6,20 +6,17 @@ import Link from 'next/link'import { useEffect, useRef } from 'react'import { Badge, Button, IconArrowRight, IconLoader } from 'ui'+import { useParams } from 'common'import { DisplayApiSettings, DisplayConfigSettings } from 'components/ui/ProjectSettings'+import { invalidateProjectDetailsQuery } from 'data/projects/project-detail-query'import { invalidateProjectsQuery } from 'data/projects/projects-query'+import { useSelectedProject } from 'hooks'import { getWithTimeout } from 'lib/common/fetch'import { API_URL, PROJECT_STATUS } from 'lib/constants'-import { Project } from 'types'-import { invalidateProjectDetailsQuery } from 'data/projects/project-detail-query'-import { useParams } from 'common'-export interface BuildingStateProps {- project: Project-}--const BuildingState = ({ project }: BuildingStateProps) => {+const BuildingState = () => {const { ref } = useParams()+ const project = useSelectedProject()const queryClient = useQueryClient()const checkServerInterval = useRef<number>()@@ -48,6 +45,8 @@ const BuildingState = ({ project }: BuildingStateProps) => {}}, [])+ if (project === undefined) return null+return (<div className="mx-auto my-16 w-full max-w-6xl items-center justify-center"><div className="mx-6 flex flex-col space-y-16">diff --git a/studio/components/layouts/ProjectLayout/ProjectLayout.tsx b/studio/components/layouts/ProjectLayout/ProjectLayout.tsxindex 37ad6281554..adeba22da72 100644--- a/studio/components/layouts/ProjectLayout/ProjectLayout.tsx+++ b/studio/components/layouts/ProjectLayout/ProjectLayout.tsx@@ -191,7 +191,7 @@ const ContentWrapper = ({ isLoading, children }: ContentWrapperProps) => {) : requiresDbConnection && isProjectRestoring ? (<RestoringState />) : requiresDbConnection && isProjectBuilding ? (- <BuildingState project={selectedProject} />+ <BuildingState />) : (<><UsageWarningBanner />diff --git a/studio/components/ui/UsageWarnings/UsageWarningBanner.constants.ts b/studio/components/ui/UsageWarnings/UsageWarningBanner.constants.tsnew file mode 100644index 00000000000..2a6ca960637--- /dev/null+++ b/studio/components/ui/UsageWarnings/UsageWarningBanner.constants.ts@@ -0,0 +1,54 @@+// [TODO] Just double check if the docs url and correction urls are all correct+export const RESOURCE_WARNING_MESSAGES = {+ is_readonly_mode_enabled: {+ title: 'Your project is currently in readonly mode and is no longer accepting write requests',+ description:+ 'You will need to manually override read-only mode and reduce the disk size to below 95%.',+ docsUrl: 'https://supabase.com/docs/guides/platform/database-size#disabling-read-only-mode',+ correctionUrl: undefined,+ buttonText: undefined,+ },+ is_disk_io_budget_below_threshold: {+ title:+ 'Your project is about to deplete its Disk IO Budget, and your instance may become unresponsive once fully exhausted',+ description:+ 'You will need to either optimize your performance, or upgrade your compute to a larger instance.',+ docsUrl: 'https://supabase.com/docs/guides/platform/exhaust-disk-io',+ correctionUrl: '/project/[ref]/settings/billing/usage#disk_io',+ buttonText: 'Check usage',+ },+ is_disk_space_usage_beyond_threshold: {+ title:+ 'Your project is about to exhaust its disk space budget, and your instance may become unresponsive once fully exhausted',+ description: 'Some CTA description here',+ docsUrl: undefined,+ correctionUrl: undefined,+ buttonText: undefined,+ },+ is_cpu_load_beyond_threshold: {+ title:+ "Your project is currently facing high CPU usage, and your instance's performance is affected",+ description:+ 'You will need to either optimize your performance or upgrade your compute to a larger instance',+ docsUrl: 'https://supabase.com/docs/guides/platform/exhaust-cpu',+ correctionUrl: '/project/[ref]/settings/billing/usage#cpu',+ buttonText: 'Check usage',+ },+ is_memory_and_swap_usage_beyond_threshold: {+ title:+ "Your project is currently facing high memory usage, and your instance's performance is affected",+ description:+ 'You will need to either optimize your performance or upgrade your compute to a larger instance',+ docsUrl: 'https://supabase.com/docs/guides/platform/exhaust-ram',+ correctionUrl: '/project/[ref]/settings/billing/usage#ram',+ buttonText: 'Check usage',+ },+ multiple_resource_warnings: {+ title:+ "Your project is currently exhausting multiple resources, and your instance's performance is affected",+ description: "Check which resources are reaching their threshold on your project's usage page.",+ docsUrl: undefined,+ correctionUrl: '/project/[ref]/settings/billing/usage',+ buttonText: 'Check usage',+ },+}diff --git a/studio/components/ui/UsageWarnings/UsageWarningBanner.tsx b/studio/components/ui/UsageWarnings/UsageWarningBanner.tsxindex aab7bd51390..c3672308ae0 100644--- a/studio/components/ui/UsageWarnings/UsageWarningBanner.tsx+++ b/studio/components/ui/UsageWarnings/UsageWarningBanner.tsx@@ -10,70 +10,18 @@ import {} from 'ui'import { useResourceWarningsQuery } from 'data/usage/resource-warnings-query'--// [TODO] Just double check if the docs url and correction urls are all correct-const RESOURCE_WARNING_MESSAGES = {- is_readonly_mode_enabled: {- title: 'Your project is currently in readonly mode and is no longer accepting write requests',- description:- 'You will need to manually override read-only mode and reduce the disk size to below 95%.',- docsUrl: 'https://supabase.com/docs/guides/platform/database-size#disabling-read-only-mode',- correctionUrl: undefined,- buttonText: undefined,- },- is_disk_io_budget_below_threshold: {- title:- 'Your project is about to deplete its Disk IO Budget, and your instance may become unresponsive once fully exhausted',- description:- 'You will need to either optimize your performance, or upgrade your compute to a larger instance.',- docsUrl: 'https://supabase.com/docs/guides/platform/exhaust-disk-io',- correctionUrl: '/project/[ref]/settings/billing/usage#disk_io',- buttonText: 'Check usage',- },- is_disk_space_usage_beyond_threshold: {- title:- 'Your project is about to exhaust its disk space budget, and your instance may become unresponsive once fully exhausted',- description: 'Some CTA description here',- docsUrl: undefined,- correctionUrl: undefined,- buttonText: undefined,- },- is_cpu_load_beyond_threshold: {- title:- "Your project is currently facing high CPU usage, and your instance's performance is affected",- description:- 'You will need to either optimize your performance or upgrade your compute to a larger instance',- docsUrl: 'https://supabase.com/docs/guides/platform/exhaust-cpu',- correctionUrl: '/project/[ref]/settings/billing/usage#cpu',- buttonText: 'Check usage',- },- is_memory_and_swap_usage_beyond_threshold: {- title:- "Your project is currently facing high memory usage, and your instance's performance is affected",- description:- 'You will need to either optimize your performance or upgrade your compute to a larger instance',- docsUrl: 'https://supabase.com/docs/guides/platform/exhaust-ram',- correctionUrl: '/project/[ref]/settings/billing/usage#ram',- buttonText: 'Check usage',- },- multiple_resource_warnings: {- title:- "Your project is currently exhausting multiple resources, and your instance's performance is affected",- description: "Check which resources are reaching their threshold on your project's usage page.",- docsUrl: undefined,- correctionUrl: '/project/[ref]/settings/billing/usage',- buttonText: 'Check usage',- },-}+import { RESOURCE_WARNING_MESSAGES } from './UsageWarningBanner.constants'+import { useRouter } from 'next/router'const UsageWarningBanner = () => {const { ref } = useParams()+ const router = useRouter()const { data: resourceWarnings } = useResourceWarningsQuery()const projectResourceWarnings = (resourceWarnings ?? [])?.find((warning) => warning.project === ref)- // [Joshen] Read only takes higher precendence over multiple resource warnings+ // [Joshen] Read only takes higher precedence over multiple resource warningsconst activeWarnings =projectResourceWarnings !== undefined? projectResourceWarnings.is_readonly_mode_enabled@@ -113,7 +61,7 @@ const UsageWarningBanner = () => {: RESOURCE_WARNING_MESSAGES[activeWarnings[0] as keyof typeof RESOURCE_WARNING_MESSAGES]?.buttonText- if (activeWarnings.length === 0) return null+ if (activeWarnings.length === 0 || router.pathname.includes('/usage')) return nullreturn (<Alert_Shadcn_