mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 12:55:06 +03:00
- Adds missing log and active compute hour insights in both usage summary and daily stats (only Platform Plan) - Adds database size usage insights for platform orgs - Hide the circular progress bar if the usage item has no included usage (otherwise always 100% filled with any usage) - Hide percentage if usage item has no included usage - Adjust upcoming invoice breakdown to properly handle compute and active compute hours - Hide subscription change button for platform/enterprise orgs (we already have a callout saying they gotta reach out to us) - Adjusted database size insights for platform to no longer display 0.5 GB per project being included
68 lines
1.7 KiB
TypeScript
68 lines
1.7 KiB
TypeScript
import { DataPoint } from 'data/analytics/constants'
|
|
import {
|
|
PricingMetric,
|
|
useOrgDailyStatsQuery,
|
|
type OrgDailyUsageResponse,
|
|
} from 'data/analytics/org-daily-stats-query'
|
|
import type { OrgSubscription } from 'data/subscriptions/types'
|
|
import UsageSection from './UsageSection/UsageSection'
|
|
import { dailyUsageToDataPoints } from './Usage.utils'
|
|
|
|
export interface SizeAndCountsProps {
|
|
orgSlug: string
|
|
projectRef?: string | null
|
|
subscription: OrgSubscription | undefined
|
|
currentBillingCycleSelected: boolean
|
|
orgDailyStats: OrgDailyUsageResponse | undefined
|
|
isLoadingOrgDailyStats: boolean
|
|
startDate: string | undefined
|
|
endDate: string | undefined
|
|
}
|
|
|
|
const SizeAndCounts = ({
|
|
orgSlug,
|
|
projectRef,
|
|
subscription,
|
|
currentBillingCycleSelected,
|
|
orgDailyStats,
|
|
isLoadingOrgDailyStats,
|
|
startDate,
|
|
endDate,
|
|
}: SizeAndCountsProps) => {
|
|
const chartMeta: {
|
|
[key: string]: { data: DataPoint[]; margin: number; isLoading: boolean }
|
|
} = {
|
|
[PricingMetric.STORAGE_SIZE]: {
|
|
isLoading: isLoadingOrgDailyStats,
|
|
margin: 14,
|
|
data: dailyUsageToDataPoints(
|
|
orgDailyStats,
|
|
(metric) => metric === PricingMetric.STORAGE_SIZE
|
|
),
|
|
},
|
|
[PricingMetric.DATABASE_SIZE]: {
|
|
isLoading: isLoadingOrgDailyStats,
|
|
margin: 14,
|
|
data: dailyUsageToDataPoints(
|
|
orgDailyStats,
|
|
(metric) => metric === PricingMetric.DATABASE_SIZE
|
|
),
|
|
},
|
|
}
|
|
|
|
return (
|
|
<UsageSection
|
|
orgSlug={orgSlug}
|
|
projectRef={projectRef}
|
|
categoryKey="sizeCount"
|
|
chartMeta={chartMeta}
|
|
subscription={subscription}
|
|
currentBillingCycleSelected={currentBillingCycleSelected}
|
|
startDate={startDate}
|
|
endDate={endDate}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default SizeAndCounts
|