The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add link to docs for usage page
Joshen Lim3b0f0766ce1f
diff --git a/studio/components/interfaces/BillingV2/Usage/Activity.tsx b/studio/components/interfaces/BillingV2/Usage/Activity.tsxindex bcdf36faca2..d6b874ca7ed 100644--- a/studio/components/interfaces/BillingV2/Usage/Activity.tsx+++ b/studio/components/interfaces/BillingV2/Usage/Activity.tsx@@ -128,8 +128,7 @@ const Activity = ({ projectRef }: ActivityProps) => {return (<SectionContentkey={attribute.key}- title={attribute.name}- description={attribute.description}+ section={attribute}includedInPlan={usageMeta.available_in_plan}><div className="space-y-2">diff --git a/studio/components/interfaces/BillingV2/Usage/Bandwidth.tsx b/studio/components/interfaces/BillingV2/Usage/Bandwidth.tsxindex 4296da6b307..7947033f423 100644--- a/studio/components/interfaces/BillingV2/Usage/Bandwidth.tsx+++ b/studio/components/interfaces/BillingV2/Usage/Bandwidth.tsx@@ -62,11 +62,7 @@ const Bandwidth = ({ projectRef }: BandwidthProps) => {const usageExcess = (usageMeta?.usage ?? 0) - (usageMeta?.limit ?? 0)return (- <SectionContent- key={attribute.key}- title={attribute.name}- description={attribute.description}- >+ <SectionContent key={attribute.key} section={attribute}><div className="space-y-2"><div className="flex items-center justify-between"><div className="flex items-center space-x-4">diff --git a/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx b/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsxindex 4b80ab93871..520063dc3ff 100644--- a/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx+++ b/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx@@ -4,110 +4,94 @@ import { useProjectSubscriptionQuery } from 'data/subscriptions/project-subscripimport BarChart from './BarChart'import SectionContent from './SectionContent'import SectionHeader from './SectionHeader'+import { USAGE_CATEGORIES } from './Usage.constants'export interface InfrastructureProps {projectRef: string}+// [Joshen] Need to update the IO budget chart to show burst mbps and duration next time+const Infrastructure = ({ projectRef }: InfrastructureProps) => {const { data: subscription } = useProjectSubscriptionQuery({ projectRef })const { current_period_start, current_period_end } = subscription?.billing ?? {}const startDate = new Date((current_period_start ?? 0) * 1000).toISOString()const endDate = new Date((current_period_end ?? 0) * 1000).toISOString()+ const categoryMeta = USAGE_CATEGORIES.find((category) => category.key === 'infra')- const CPU_USAGE_KEY = 'cpu_usage'const { data: cpuUsageData, isLoading: isLoadingCpuUsageData } = useInfraMonitoringQuery({projectRef,- attribute: CPU_USAGE_KEY,+ attribute: 'cpu_usage',interval: '1d',startDate,endDate,})- const MEMORY_USAGE_KEY = 'ram_usage'const { data: memoryUsageData, isLoading: isLoadingMemoryUsageData } = useInfraMonitoringQuery({projectRef,- attribute: MEMORY_USAGE_KEY,+ attribute: 'ram_usage',interval: '1d',startDate,endDate,})- const DISK_IO_BUDGET_KEY = 'disk_io_budget'const { data: ioBudgetData, isLoading: isLoadingIoBudgetData } = useInfraMonitoringQuery({projectRef,- attribute: DISK_IO_BUDGET_KEY,+ attribute: 'disk_io_budget',interval: '1d',startDate,endDate,})+ const chartMeta: any = {+ cpu_usage: { isLoading: isLoadingCpuUsageData, data: cpuUsageData?.data ?? [] },+ ram_usage: { isLoading: isLoadingMemoryUsageData, data: memoryUsageData?.data ?? [] },+ disk_io_budget: { isLoading: isLoadingIoBudgetData, data: ioBudgetData?.data ?? [] },+ }++ if (categoryMeta === undefined) return null+return (<><SectionHeader title="Infrastructure" description="Some description here" />-- <SectionContent title="CPU" description="Some description here">- <div className="space-y-1">- <p>Max CPU usage each day</p>- <p className="text-sm text-scale-1000">Some description here</p>- </div>- {isLoadingCpuUsageData ? (- <div className="space-y-2">- <ShimmeringLoader />- <ShimmeringLoader className="w-3/4" />- <ShimmeringLoader className="w-1/2" />- </div>- ) : (- <BarChart- attribute={CPU_USAGE_KEY}- data={cpuUsageData?.data ?? []}- unit={cpuUsageData?.format}- yLimit={100}- />- )}- </SectionContent>-- <SectionContent title="Memory" description="Some description here">- <div className="space-y-1">- <p>Max memory usage each day</p>- <p className="text-sm text-scale-1000">Some description here</p>- </div>- {isLoadingMemoryUsageData ? (- <div className="space-y-2">- <ShimmeringLoader />- <ShimmeringLoader className="w-3/4" />- <ShimmeringLoader className="w-1/2" />- </div>- ) : (- <BarChart- attribute={MEMORY_USAGE_KEY}- data={memoryUsageData?.data ?? []}- unit={memoryUsageData?.format}- yLimit={100}- />- )}- </SectionContent>-- <SectionContent title="IO Budget" description="Some description here">- <div className="space-y-1">- <p>Disk IO budget per day</p>- <p className="text-sm text-scale-1000">Some description here</p>- </div>- {isLoadingIoBudgetData ? (- <div className="space-y-2">- <ShimmeringLoader />- <ShimmeringLoader className="w-3/4" />- <ShimmeringLoader className="w-1/2" />- </div>- ) : (- <BarChart- attribute={DISK_IO_BUDGET_KEY}- data={ioBudgetData?.data ?? []}- unit={ioBudgetData?.format}- yLimit={100}- />- )}- </SectionContent>+ {categoryMeta.attributes.map((attribute) => {+ return (+ <SectionContent key={attribute.key} section={attribute}>+ <div className="space-y-1">+ {attribute.key === 'disk_io_budget' ? (+ <p>{attribute.name} remaining per day</p>+ ) : (+ <p>+ Max{' '}+ <span className={attribute.key === 'ram_usage' ? 'lowercase' : ''}>+ {attribute.name}+ </span>{' '}+ usage each day+ </p>+ )}+ {attribute.chartDescription.split('\n').map((paragraph, idx) => (+ <p key={`para-${idx}`} className="text-sm text-scale-1000">+ {paragraph}+ </p>+ ))}+ </div>+ {chartMeta[attribute.key].isLoading ? (+ <div className="space-y-2">+ <ShimmeringLoader />+ <ShimmeringLoader className="w-3/4" />+ <ShimmeringLoader className="w-1/2" />+ </div>+ ) : (+ <BarChart+ attribute={attribute.attribute}+ data={chartMeta[attribute.key]?.data ?? []}+ yFormatter={(value) => `${value}%`}+ yLimit={100}+ />+ )}+ </SectionContent>+ )+ })}</>)}diff --git a/studio/components/interfaces/BillingV2/Usage/SectionContent.tsx b/studio/components/interfaces/BillingV2/Usage/SectionContent.tsxindex 1f8407d2025..440bf5616fb 100644--- a/studio/components/interfaces/BillingV2/Usage/SectionContent.tsx+++ b/studio/components/interfaces/BillingV2/Usage/SectionContent.tsx@@ -1,39 +1,50 @@import { PropsWithChildren } from 'react'-import { Badge } from 'ui'+import { Badge, Button, IconExternalLink } from 'ui'+import { CategoryAttribute } from './Usage.constants'+import Link from 'next/link'export interface SectionContent {- title: string- description: string+ section: CategoryAttributeincludedInPlan?: boolean}const SectionContent = ({- title,- description,+ section,includedInPlan,children,}: PropsWithChildren<SectionContent>) => {+ const { name, description, docsUrl } = section+return (<div className="border-b"><div className="1xl:px-28 mx-auto flex flex-col gap-10 px-5 lg:px-16 2xl:px-32 py-16"><div className="grid grid-cols-12 gap-x-6"><div className="col-span-5">- <div className="sticky top-16 space-y-1">- <div className="flex items-center space-x-2">- <p className="text-base capitalize">{title}</p>- {includedInPlan === false && <Badge color="gray">Not included</Badge>}+ <div className="sticky top-16 space-y-6">+ <div className="space-y-1">+ <div className="flex items-center space-x-2">+ <p className="text-base capitalize">{name}</p>+ {includedInPlan === false && <Badge color="gray">Not included</Badge>}+ </div>+ {description.split('\n').map((value, idx) => (+ <p key={`desc-${idx}`} className="text-sm text-scale-1000">+ {value}+ </p>+ ))}</div>- {description.split('\n').map((value, idx) => (- <p key={`desc-${idx}`} className="text-sm text-scale-1000">- {value}- </p>- ))}- {/* [Joshen] Feels a little too wordy if include below CTA */}- {/* {includedInPlan === false && (- <p className="text-sm text-scale-1000">- Upgrade your project to have access to <span className="lowercase">{title}</span>- </p>- )} */}+ {docsUrl !== undefined && (+ <div>+ <p className="text-sm text-scale-1100 mb-2">More information</p>+ <Link href={docsUrl}>+ <a target="_blank" rel="noreferrer">+ <div className="flex items-center space-x-2 opacity-50 hover:opacity-100 transition">+ <p className="text-sm">Documentation</p>+ <IconExternalLink size={16} strokeWidth={2} />+ </div>+ </a>+ </Link>+ </div>+ )}</div></div><div className="col-span-7 space-y-6">{children}</div>diff --git a/studio/components/interfaces/BillingV2/Usage/SizeAndCounts.tsx b/studio/components/interfaces/BillingV2/Usage/SizeAndCounts.tsxindex 728bd1e070d..7e713d6ab57 100644--- a/studio/components/interfaces/BillingV2/Usage/SizeAndCounts.tsx+++ b/studio/components/interfaces/BillingV2/Usage/SizeAndCounts.tsx@@ -73,11 +73,7 @@ const SizeAndCounts = ({ projectRef }: SizeAndCountsProps) => {const usageExcess = (usageMeta?.usage ?? 0) - (usageMeta?.limit ?? 0)return (- <SectionContent- key={attribute.key}- title={attribute.name}- description={attribute.description}- >+ <SectionContent key={attribute.key} section={attribute}><div className="space-y-2"><div className="flex items-center justify-between"><div className="flex items-center space-x-4">diff --git a/studio/components/interfaces/BillingV2/Usage/Usage.constants.ts b/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsindex b987c8837be..2c5dc8637b2 100644--- a/studio/components/interfaces/BillingV2/Usage/Usage.constants.ts+++ b/studio/components/interfaces/BillingV2/Usage/Usage.constants.ts@@ -27,26 +27,29 @@ export const USAGE_CATEGORIES: {{key: 'cpu_usage',attribute: 'cpu_usage',- name: 'CPU usage',+ name: 'CPU',unit: 'absolute',description: 'Some description here',- chartDescription: 'Some description here',+ chartDescription: 'The data shown here is refreshed over a period of 24 hours.',},{key: 'ram_usage',attribute: 'ram_usage',- name: 'Memory usage',+ name: 'Memory',unit: 'absolute',description: 'Some description here',- chartDescription: 'Some description here',+ chartDescription: 'The data shown here is refreshed over a period of 24 hours.',},{key: 'disk_io_budget',attribute: 'disk_io_budget',- name: 'IO budget',+ name: 'Disk IO bandwidth',unit: 'absolute',- description: 'Some description here',- chartDescription: 'Some description here',+ docsUrl: 'https://supabase.com/docs/guides/platform/compute-add-ons#disk-io-bandwidth',+ description:+ 'SSD Disks are attached to your servers and the disk performance of your workload is determined by the Disk IO bandwidth of this connection.',+ chartDescription:+ 'If the remaining bandwidth is less than 100%, it indicates that your workload has burst beyond the baseline IO throughput during the day.\nIf this metric drops to zero, the workload has used up all the burst IO throughput minutes during the day and is running at the baseline performance.\nThe amount of remaining bandwidth resets at the beginning of each day, and the data shown here is refreshed over a period of 24 hours.',},],},