The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Ensure that connecting state is shown after updating project subscription with change in compute size
Joshen Lim4695b6ce82c8
diff --git a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsxindex 90f02c9e0d3..6f5d68af515 100644--- a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx+++ b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx@@ -1,5 +1,7 @@import { FC } from 'react'-import { Badge, Radio } from '@supabase/ui'+import Link from 'next/link'+import { Badge, Button, Radio } from '@supabase/ui'+import { useStore } from 'hooks'import { getProductPrice } from '../Billing.utils'interface Props {@@ -17,6 +19,9 @@ const ComputeSizeSelection: FC<Props> = ({}) => {// [Joshen] We should have some indication on what's the current compute// size of the project based on currentComputeSize+ const { ui } = useStore()+ const projectRef = ui.selectedProjectRef+return (<div className="space-y-4"><div>@@ -51,6 +56,21 @@ const ComputeSizeSelection: FC<Props> = ({/>)})}+ <Radio+ hidden+ disabled+ key="compute-size-cta"+ align="vertical"+ label="Need something else?"+ description="Reach out to us! We'll get you sorted."+ optionalLabel={+ <Link href={`/support/new?ref=${projectRef}&category=sales`}>+ <a>+ <Button>Contact us</Button>+ </a>+ </Link>+ }+ /></Radio.Group></div>)diff --git a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsxindex 56afce11285..d7a85a79601 100644--- a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx+++ b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx@@ -239,6 +239,7 @@ const PaymentSummaryPanel: FC<Props> = ({</Button></div></div>+<ModalhideFootervisible={showConfirmModal}@@ -253,9 +254,8 @@ const PaymentSummaryPanel: FC<Props> = ({variant="warning"title="Your project will need to be restarted for changes to take place">- Upon confirmation, your project will be restarted in order for the change in instance- size to take place. This will take up to 2 minutes in which your project will be- unavailable during the time.+ Upon confirmation, your project will be restarted to change your instance size. This+ will take up to 2 minutes in which your project will be unavailable during the time.</Alert></Modal.Content><Modal.Content>diff --git a/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx b/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsxindex f75627f220a..caa5d0afd9c 100644--- a/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx+++ b/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx@@ -1,6 +1,7 @@import { FC, useEffect, useState } from 'react'import { Transition } from '@headlessui/react'-import { Badge, Button, IconArrowLeft, IconHelpCircle, Toggle, Modal } from '@supabase/ui'+import { useRouter } from 'next/router'+import { Button, IconHelpCircle, Toggle, Modal } from '@supabase/ui'import { useFlag, useStore } from 'hooks'import { post, patch } from 'lib/common/fetch'@@ -42,11 +43,13 @@ const ProUpgrade: FC<Props> = ({*/const nativeBilling = useFlag('nativeBilling')- const { ui } = useStore()+ const { app, ui } = useStore()+ const router = useRouter()const { addons } = productsconst computeSizes = formatComputeSizes(addons)+ const projectId = ui.selectedProject?.id ?? -1const projectRef = ui.selectedProject?.refconst projectRegion = ui.selectedProject?.region ?? ''@@ -54,10 +57,6 @@ const ProUpgrade: FC<Props> = ({computeSizes.find((option: any) => option.id === currentSubscription?.addons[0]?.prod_id) ||computeSizes.find((option: any) => option.metadata.supabase_prod_id === 'addon_instance_micro')- const isManagingProSubscription =- currentSubscription.tier.prod_id === STRIPE_PRODUCT_IDS.PRO ||- currentSubscription.tier.prod_id === STRIPE_PRODUCT_IDS.PAYG-const [isSpendCapEnabled, setIsSpendCapEnabled] = useState(// If project is currently free, default to enabling spend capscurrentSubscription.tier.prod_id === STRIPE_PRODUCT_IDS.FREE ||@@ -79,6 +78,12 @@ const ProUpgrade: FC<Props> = ({? products?.tiers.find((tier: any) => tier.id === STRIPE_PRODUCT_IDS.PRO): products?.tiers.find((tier: any) => tier.id === STRIPE_PRODUCT_IDS.PAYG)+ const isManagingProSubscription =+ currentSubscription.tier.prod_id === STRIPE_PRODUCT_IDS.PRO ||+ currentSubscription.tier.prod_id === STRIPE_PRODUCT_IDS.PAYG++ const isChangingComputeSize = currentComputeSize?.id !== selectedComputeSize.id+useEffect(() => {if (!isLoadingPaymentMethods && paymentMethods && paymentMethods.length > 0) {setSelectedPaymentMethod(paymentMethods[0].id)@@ -131,9 +136,17 @@ const ProUpgrade: FC<Props> = ({message: `Failed to update subscription: ${res?.error?.message}`,})} else {- setIsSuccessful(true)- // [TODO] remove this- console.log('Successfully updated project, now go check AWS and stripe')+ if (isChangingComputeSize) {+ app.onProjectPostgrestStatusUpdated(projectId, 'OFFLINE')+ ui.setNotification({+ category: 'success',+ message:+ 'Your project has been updated and is currently restarting to update its instance size',+ })+ router.push(`/project/${projectRef}`)+ } else {+ setIsSuccessful(true)+ }}setIsSubmitting(false)}diff --git a/studio/styles/main.scss b/studio/styles/main.scssindex 51f2c32137d..1b92d6faee3 100644--- a/studio/styles/main.scss+++ b/studio/styles/main.scss@@ -182,6 +182,9 @@ div[data-radix-portal]:not(.portal--toast) {.billing-compute-radio {label {@apply items-center justify-between;+ &:last-child {+ opacity: 100 !important;+ }}}