The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add micro compute size option within the FE
Joshen Limbbd7cb2c4d52
diff --git a/studio/components/interfaces/Billing/AddOns/AddOns.utils.ts b/studio/components/interfaces/Billing/AddOns/AddOns.utils.tsindex 6132e51d4e4..9d2e0427979 100644--- a/studio/components/interfaces/Billing/AddOns/AddOns.utils.ts+++ b/studio/components/interfaces/Billing/AddOns/AddOns.utils.ts@@ -1,8 +1,36 @@export const formatComputeSizes = (computeSizes: any[]) => {// Just need to order the options - ideally if the API can filter this that'll be great// but for now just let FE order to get things moving quickly- return computeSizes- .filter((option: any) => option.name.includes('[Small]'))++ // FE will also inject the micro option as this will not be saved in our stripe dashboard++ const microOption = {+ id: '',+ name: 'Optimized database instance [Micro]',+ description: 'Basic set up to get started',+ metadata: {+ default_price_id: undefined,+ supabase_prod_id: undefined,+ features: '2 CPUs • 1GB memory • 2,085Mbps Disk IO',+ },+ prices: [+ {+ id: undefined,+ currency: 'usd',+ recurring: {+ interval: 'month',+ usage_type: 'licensed',+ interval_count: 1,+ aggregate_usage: null,+ trial_period_days: null,+ },+ unit_amount: 0,+ },+ ],+ }++ return [microOption]+ .concat(computeSizes.filter((option: any) => option.name.includes('[Small]'))).concat(computeSizes.filter((option: any) => option.name.includes('[Medium]'))).concat(computeSizes.filter((option: any) => option.name.includes('[Large]'))).concat(computeSizes.filter((option: any) => option.name.includes('[XLarge]')))diff --git a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsxindex 94edd90d1ed..f6c89d7eea4 100644--- a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx+++ b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx@@ -1,6 +1,5 @@import { FC } from 'react'import { Radio } from '@supabase/ui'-import { formatComputeSizes } from './AddOns.utils'interface Props {computeSizes: any[]@@ -9,7 +8,6 @@ interface Props {}const ComputeSizeSelection: FC<Props> = ({ computeSizes, selectedComputeSize, onSelectOption }) => {- const formattedComputeSizes = formatComputeSizes(computeSizes)return (<div className="space-y-4"><div>@@ -19,7 +17,7 @@ const ComputeSizeSelection: FC<Props> = ({ computeSizes, selectedComputeSize, on</p></div><Radio.Group type="cards" className="billing-compute-radio">- {formattedComputeSizes.map((option: any) => (+ {computeSizes.map((option: any) => (<Radiohiddenkey={option.id}diff --git a/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx b/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsxindex bd9065c6799..eda77360708 100644--- a/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx+++ b/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx@@ -16,6 +16,7 @@ import {import { STRIPE_PRODUCT_IDS } from 'lib/constants'import { SubscriptionPreview } from '../Billing.types'import UpdateSuccess from '../UpdateSuccess'+import { formatComputeSizes } from '../AddOns/AddOns.utils'import { formSubscriptionUpdatePayload } from './ProUpgrade.utils'// Do not allow compute size changes for af-south-1@@ -38,12 +39,14 @@ const ProUpgrade: FC<Props> = ({const { ui } = useStore()const { addons } = products+ const computeSizes = formatComputeSizes(addons)+const projectRef = ui.selectedProject?.refconst projectRegion = ui.selectedProject?.region ?? ''const currentComputeSize =- addons.find((option: any) => option.id === currentSubscription?.addons[0]?.prod_id) ||- addons.find((option: any) => option.name.includes('[Small]'))+ computeSizes.find((option: any) => option.id === currentSubscription?.addons[0]?.prod_id) ||+ computeSizes.find((option: any) => option.name.includes('[Micro]'))const isManagingProSubscription =currentSubscription.tier.prod_id === STRIPE_PRODUCT_IDS.PRO ||@@ -208,7 +211,7 @@ const ProUpgrade: FC<Props> = ({<Badge color="green">Optional</Badge></div><ComputeSizeSelection- computeSizes={addons || []}+ computeSizes={computeSizes || []}selectedComputeSize={selectedComputeSize}onSelectOption={onSelectComputeSizeOption}/>diff --git a/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.utils.ts b/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.utils.tsindex 1dc9d883fa1..14f231a98b8 100644--- a/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.utils.ts+++ b/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.utils.ts@@ -4,7 +4,8 @@ export const formSubscriptionUpdatePayload = (selectedPaymentMethod: string,region: string) => {- const addons = region === 'af-south-1' ? [] : [selectedComputeSize.prices[0].id]+ const addons =+ region === 'af-south-1' || !selectedComputeSize.id ? [] : [selectedComputeSize.prices[0].id]const proration_date = Math.floor(Date.now() / 1000)return {tier: selectedTier.prices[0].id,