Skip to content

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

small fix

Joshen Lim3d6d0c34fad5
diff --git a/studio/components/interfaces/BillingV2/Usage/Activity.tsx b/studio/components/interfaces/BillingV2/Usage/Activity.tsx
index 06a3958462e..e75f52d15b2 100644
--- a/studio/components/interfaces/BillingV2/Usage/Activity.tsx
+++ b/studio/components/interfaces/BillingV2/Usage/Activity.tsx
@@ -18,6 +18,7 @@ import SectionHeader from './SectionHeader'
import { USAGE_CATEGORIES } from './Usage.constants'
import { getUpgradeUrl } from './Usage.utils'
import { PRICING_TIER_PRODUCT_IDS } from 'lib/constants'
+import { DataPoint } from 'data/analytics/constants'
export interface ActivityProps {
projectRef: string
@@ -89,41 +90,43 @@ const Activity = ({ projectRef }: ActivityProps) => {
endDate,
})
- const chartMeta: any = {
+ const chartMeta: {
+ [key: string]: { data: DataPoint[]; margin: number; isLoading: boolean; hasNoData: boolean }
+ } = {
monthly_active_users: {
isLoading: isLoadingMauData,
data: mauData?.data ?? [],
- showLastUpdated: mauData?.hasNoData === false,
+ hasNoData: mauData?.hasNoData ?? false,
margin: 18,
},
monthly_active_sso_users: {
isLoading: isLoadingMauSSOData,
data: mauSSOData?.data ?? [],
- showLastUpdated: mauSSOData?.hasNoData === false,
+ hasNoData: mauSSOData?.hasNoData ?? false,
margin: 20,
},
storage_image_render_count: {
isLoading: isLoadingAssetTransformationsData,
data: assetTransformationsData?.data ?? [],
- showLastUpdated: assetTransformationsData?.hasNoData === false,
+ hasNoData: assetTransformationsData?.hasNoData ?? false,
margin: 0,
},
func_invocations: {
isLoading: isLoadingFuncInvocationsData,
data: funcInvocationsData?.data ?? [],
- showLastUpdated: funcInvocationsData?.hasNoData === false,
+ hasNoData: funcInvocationsData?.hasNoData ?? false,
margin: 26,
},
realtime_message_count: {
isLoading: isLoadingRealtimeMessagesData,
data: realtimeMessagesData?.data ?? [],
- showLastUpdated: realtimeMessagesData?.hasNoData === false,
+ hasNoData: realtimeMessagesData?.hasNoData ?? false,
margin: 38,
},
realtime_peak_connection: {
isLoading: isLoadingRealtimeConnectionsData,
data: realtimeConnectionsData?.data ?? [],
- showLastUpdated: realtimeConnectionsData?.hasNoData === false,
+ hasNoData: realtimeConnectionsData?.hasNoData ?? false,
margin: 0,
},
}
@@ -147,7 +150,7 @@ const Activity = ({ projectRef }: ActivityProps) => {
(x: any) => x.loopId > 0 && x[attribute.attribute] === 0
)
const lastKnownValue =
- lastZeroValue !== undefined
+ lastZeroValue !== undefined && !chartMeta[attribute.key]?.hasNoData
? dayjs(lastZeroValue.period_start)
.subtract(1, 'day')
.format('DD MMM YYYY, HH:mma (ZZ)')
@@ -240,11 +243,6 @@ const Activity = ({ projectRef }: ActivityProps) => {
{paragraph}
</p>
))}
- {lastKnownValue !== undefined && chartMeta[attribute.key].showLastUpdated && (
- <span className="text-sm text-scale-1000">
- Last updated at: {lastKnownValue}
- </span>
- )}
</div>
{chartMeta[attribute.key].isLoading ? (
<div className="space-y-2">
diff --git a/studio/components/interfaces/BillingV2/Usage/Bandwidth.tsx b/studio/components/interfaces/BillingV2/Usage/Bandwidth.tsx
index c00f263b898..b38341e249c 100644
--- a/studio/components/interfaces/BillingV2/Usage/Bandwidth.tsx
+++ b/studio/components/interfaces/BillingV2/Usage/Bandwidth.tsx
@@ -1,6 +1,7 @@
import clsx from 'clsx'
import ShimmeringLoader from 'components/ui/ShimmeringLoader'
import SparkBar from 'components/ui/SparkBar'
+import { DataPoint } from 'data/analytics/constants'
import { useDailyStatsQuery } from 'data/analytics/daily-stats-query'
import { useProjectSubscriptionQuery } from 'data/subscriptions/project-subscription-query'
import {
@@ -13,11 +14,11 @@ import { PRICING_TIER_PRODUCT_IDS, USAGE_APPROACHING_THRESHOLD } from 'lib/const
import { formatBytes } from 'lib/helpers'
import Link from 'next/link'
import { Button, IconAlertTriangle } from 'ui'
-import UsageBarChart from './UsageBarChart'
import SectionContent from './SectionContent'
import SectionHeader from './SectionHeader'
import { USAGE_CATEGORIES } from './Usage.constants'
import { getUpgradeUrl } from './Usage.utils'
+import UsageBarChart from './UsageBarChart'
export interface BandwidthProps {
projectRef: string
@@ -52,18 +53,20 @@ const Bandwidth = ({ projectRef }: BandwidthProps) => {
endDate,
})
- const chartMeta: any = {
+ const chartMeta: {
+ [key: string]: { data: DataPoint[]; margin: number; isLoading: boolean; hasNoData: boolean }
+ } = {
db_egress: {
- isLoading: isLoadingDbEgressData,
data: dbEgressData?.data ?? [],
margin: 16,
- showLastUpdated: dbEgressData?.hasNoData === false,
+ isLoading: isLoadingDbEgressData,
+ hasNoData: dbEgressData?.hasNoData ?? false,
},
storage_egress: {
- isLoading: isLoadingStorageEgressData,
data: storageEgressData?.data ?? [],
margin: 14,
- showLastUpdated: storageEgressData?.hasNoData === false,
+ isLoading: isLoadingStorageEgressData,
+ hasNoData: storageEgressData?.hasNoData ?? false,
},
}
@@ -86,14 +89,14 @@ const Bandwidth = ({ projectRef }: BandwidthProps) => {
(x: any) => x.loopId > 0 && x[attribute.attribute] === 0
)
const lastKnownValue =
- lastZeroValue !== undefined
+ lastZeroValue !== undefined && !chartMeta[attribute.key]?.hasNoData
? dayjs(lastZeroValue.period_start)
.subtract(1, 'day')
.format('DD MMM YYYY, HH:mma (ZZ)')
: undefined
return (
- <SectionContent key={attribute.key} section={attribute}>
+ <SectionContent key={attribute.key} section={attribute} lastKnownValue={lastKnownValue}>
<div className="space-y-2">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-4">
@@ -164,9 +167,6 @@ const Bandwidth = ({ projectRef }: BandwidthProps) => {
{paragraph}
</p>
))}
- {lastKnownValue !== undefined && chartMeta[attribute.key].showLastUpdated && (
- <span className="text-sm text-scale-1000">Last updated at: {lastKnownValue}</span>
- )}
</div>
{chartMeta[attribute.key]?.isLoading ? (
<div className="space-y-2">
diff --git a/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx b/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx
index 87cbedee0ec..f002a22b118 100644
--- a/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx
+++ b/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx
@@ -1,4 +1,5 @@
import ShimmeringLoader from 'components/ui/ShimmeringLoader'
+import { DataPoint } from 'data/analytics/constants'
import { useInfraMonitoringQuery } from 'data/analytics/infra-monitoring-query'
import { useProjectSubscriptionQuery } from 'data/subscriptions/project-subscription-query'
import dayjs from 'dayjs'
@@ -62,7 +63,7 @@ const Infrastructure = ({ projectRef }: InfrastructureProps) => {
] ?? 100
)
- const chartMeta: any = {
+ const chartMeta: { [key: string]: { data: DataPoint[]; isLoading: boolean } } = {
cpu_usage: {
isLoading: isLoadingCpuUsageData,
data: cpuUsageData?.data ?? [],
@@ -182,9 +183,6 @@ const Infrastructure = ({ projectRef }: InfrastructureProps) => {
{paragraph}
</p>
))}
- {lastKnownValue !== undefined && (
- <span className="text-sm text-scale-1000">Last updated at: {lastKnownValue}</span>
- )}
</div>
{chartMeta[attribute.key].isLoading ? (
<div className="space-y-2">
diff --git a/studio/components/interfaces/BillingV2/Usage/SizeAndCounts.tsx b/studio/components/interfaces/BillingV2/Usage/SizeAndCounts.tsx
index 70f6b975475..d062bf905e2 100644
--- a/studio/components/interfaces/BillingV2/Usage/SizeAndCounts.tsx
+++ b/studio/components/interfaces/BillingV2/Usage/SizeAndCounts.tsx
@@ -19,6 +19,7 @@ import SectionContent from './SectionContent'
import SectionHeader from './SectionHeader'
import { USAGE_CATEGORIES } from './Usage.constants'
import { generateUsageData, getUpgradeUrl } from './Usage.utils'
+import { DataPoint } from 'data/analytics/constants'
export interface SizeAndCountsProps {
projectRef: string
@@ -61,24 +62,26 @@ const SizeAndCounts = ({ projectRef }: SizeAndCountsProps) => {
endDate,
})
- const chartMeta: any = {
+ const chartMeta: {
+ [key: string]: { data: DataPoint[]; margin: number; isLoading: boolean; hasNoData: boolean }
+ } = {
db_size: {
isLoading: isLoadingDbSizeData,
margin: 14,
data: dbSizeData?.data ?? [],
- showLastUpdated: dbSizeData?.hasNoData === false,
+ hasNoData: dbSizeData?.hasNoData ?? false,
},
storage_size: {
isLoading: isLoadingStorageSizeData,
margin: 14,
data: storageSizeData?.data ?? [],
- showLastUpdated: storageSizeData?.hasNoData === false,
+ hasNoData: storageSizeData?.hasNoData ?? false,
},
func_count: {
isLoading: isLoadingFunctionCountData,
margin: 0,
data: functionCountData?.data ?? [],
- showLastUpdated: functionCountData?.hasNoData === false,
+ hasNoData: functionCountData?.hasNoData ?? false,
},
}
@@ -101,14 +104,14 @@ const SizeAndCounts = ({ projectRef }: SizeAndCountsProps) => {
(x: any) => x.loopId > 0 && x[attribute.attribute] === 0
)
const lastKnownValue =
- lastZeroValue !== undefined
+ lastZeroValue !== undefined && !chartMeta[attribute.key]?.hasNoData
? dayjs(lastZeroValue.period_start)
.subtract(1, 'day')
.format('DD MMM YYYY, HH:mma (ZZ)')
: undefined
return (
- <SectionContent key={attribute.key} section={attribute}>
+ <SectionContent key={attribute.key} section={attribute} lastKnownValue={lastKnownValue}>
<div className="space-y-2">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-4">
@@ -212,9 +215,6 @@ const SizeAndCounts = ({ projectRef }: SizeAndCountsProps) => {
{paragraph}
</p>
))}
- {lastKnownValue !== undefined && chartMeta[attribute.key].showLastUpdated && (
- <span className="text-sm text-scale-1000">Last updated at: {lastKnownValue}</span>
- )}
</div>
{chartMeta[attribute.key].isLoading ? (
<div className="space-y-2">