mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 05:09:12 +03:00
Merge branch 'feat/usage-v2' of github.com:supabase/supabase into feat/usage-v2
This commit is contained in:
commit
43ec6b5886
3 files changed
+46
-10
No files matched your search
@@ -9,6 +9,8 @@ import {
|
||||
useProjectUsageQuery,
|
||||
} from 'data/usage/project-usage-query'
|
||||
import dayjs from 'dayjs'
|
||||
import { PRICING_TIER_PRODUCT_IDS } from 'lib/constants'
|
||||
import Link from 'next/link'
|
||||
import { Button, IconAlertTriangle } from 'ui'
|
||||
import { USAGE_APPROACHING_THRESHOLD } from '../Billing.constants'
|
||||
import BarChart from './BarChart'
|
||||
@@ -28,6 +30,13 @@ const Activity = ({ projectRef }: ActivityProps) => {
|
||||
const endDate = new Date((current_period_end ?? 0) * 1000).toISOString()
|
||||
const categoryMeta = USAGE_CATEGORIES.find((category) => category.key === 'activity')
|
||||
|
||||
const upgradeUrl =
|
||||
subscription?.tier.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.ENTERPRISE
|
||||
? `/project/${projectRef}/settings/billing/enterprise`
|
||||
: subscription?.tier.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.TEAM
|
||||
? `/project/${projectRef}/settings/billing/team`
|
||||
: `/project/${projectRef}/settings/billing/update`
|
||||
|
||||
const { data: mauData, isLoading: isLoadingMauData } = useDailyStatsQuery({
|
||||
projectRef,
|
||||
attribute: 'total_auth_billing_period_mau',
|
||||
@@ -169,9 +178,13 @@ const Activity = ({ projectRef }: ActivityProps) => {
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
<Button type="default" size="tiny" onClick={() => {}}>
|
||||
Upgrade project
|
||||
</Button>
|
||||
<Link href={upgradeUrl}>
|
||||
<a>
|
||||
<Button type="default" size="tiny">
|
||||
Upgrade project
|
||||
</Button>
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
<SparkBar
|
||||
type="horizontal"
|
||||
|
||||
@@ -9,8 +9,9 @@ import {
|
||||
useProjectUsageQuery,
|
||||
} from 'data/usage/project-usage-query'
|
||||
import dayjs from 'dayjs'
|
||||
import { USAGE_APPROACHING_THRESHOLD } from 'lib/constants'
|
||||
import { PRICING_TIER_PRODUCT_IDS, USAGE_APPROACHING_THRESHOLD } from 'lib/constants'
|
||||
import { formatBytes } from 'lib/helpers'
|
||||
import Link from 'next/link'
|
||||
import { Button, IconAlertTriangle } from 'ui'
|
||||
import BarChart from './BarChart'
|
||||
import SectionContent from './SectionContent'
|
||||
@@ -29,6 +30,13 @@ const Bandwidth = ({ projectRef }: BandwidthProps) => {
|
||||
const endDate = new Date((current_period_end ?? 0) * 1000).toISOString()
|
||||
const categoryMeta = USAGE_CATEGORIES.find((category) => category.key === 'bandwidth')
|
||||
|
||||
const upgradeUrl =
|
||||
subscription?.tier.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.ENTERPRISE
|
||||
? `/project/${projectRef}/settings/billing/enterprise`
|
||||
: subscription?.tier.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.TEAM
|
||||
? `/project/${projectRef}/settings/billing/team`
|
||||
: `/project/${projectRef}/settings/billing/update`
|
||||
|
||||
const { data: dbEgressData, isLoading: isLoadingDbEgressData } = useDailyStatsQuery({
|
||||
projectRef,
|
||||
attribute: 'total_egress_modified',
|
||||
@@ -103,9 +111,13 @@ const Bandwidth = ({ projectRef }: BandwidthProps) => {
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
<Button type="default" size="tiny" onClick={() => {}}>
|
||||
Upgrade project
|
||||
</Button>
|
||||
<Link href={upgradeUrl}>
|
||||
<a>
|
||||
<Button type="default" size="tiny">
|
||||
Upgrade project
|
||||
</Button>
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
<SparkBar
|
||||
type="horizontal"
|
||||
|
||||
@@ -31,6 +31,13 @@ const SizeAndCounts = ({ projectRef }: SizeAndCountsProps) => {
|
||||
const endDate = new Date((current_period_end ?? 0) * 1000).toISOString()
|
||||
const categoryMeta = USAGE_CATEGORIES.find((category) => category.key === 'sizeCount')
|
||||
|
||||
const upgradeUrl =
|
||||
subscription?.tier.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.ENTERPRISE
|
||||
? `/project/${projectRef}/settings/billing/enterprise`
|
||||
: subscription?.tier.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.TEAM
|
||||
? `/project/${projectRef}/settings/billing/team`
|
||||
: `/project/${projectRef}/settings/billing/update`
|
||||
|
||||
const { data: dbSizeData, isLoading: isLoadingDbSizeData } = useDailyStatsQuery({
|
||||
projectRef,
|
||||
attribute: 'total_db_size_bytes',
|
||||
@@ -118,9 +125,13 @@ const SizeAndCounts = ({ projectRef }: SizeAndCountsProps) => {
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
<Button type="default" size="tiny" onClick={() => {}}>
|
||||
Upgrade project
|
||||
</Button>
|
||||
<Link href={upgradeUrl}>
|
||||
<a>
|
||||
<Button type="default" size="tiny">
|
||||
Upgrade project
|
||||
</Button>
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
<SparkBar
|
||||
type="horizontal"
|
||||
|
||||
Reference in new issue
Block a user