The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Prompt users to migrate to org billing if trying to enable branching but on legacy billing (#17776)
Joshen Lim0330ef01dc18
diff --git a/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingModal.tsx b/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingModal.tsxindex 0640ea528ca..5c4d23bccb4 100644--- a/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingModal.tsx+++ b/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingModal.tsx@@ -1,6 +1,16 @@import { useParams } from 'common'+import Link from 'next/link'import { useEffect, useState } from 'react'-import { Button, IconFileText, IconGitBranch, Modal } from 'ui'+import {+ AlertDescription_Shadcn_,+ AlertTitle_Shadcn_,+ Alert_Shadcn_,+ Button,+ IconAlertCircle,+ IconFileText,+ IconGitBranch,+ Modal,+} from 'ui'import SidePanelGitHubRepoLinker from 'components/interfaces/Organization/IntegrationSettings/SidePanelGitHubRepoLinker'import AlertError from 'components/ui/AlertError'@@ -21,6 +31,8 @@ const EnableBranchingModal = () => {const [selectedBranch, setSelectedBranch] = useState<string>()const [addConnectionType, setAddConnectionType] = useState<IntegrationName>()+ const isOrgBilling = !!selectedOrg?.subscription_id+useEffect(() => {if (snap.showEnableBranchingModal) setSelectedBranch(undefined)}, [snap.showEnableBranchingModal])@@ -78,88 +90,128 @@ const EnableBranchingModal = () => {<IconGitBranch strokeWidth={2} size={20} /><div><p className="text">Enable database branching</p>- <p className="text-sm text-light">Management environments in Supabase</p>+ <p className="text-sm text-light">Manage environments in Supabase</p></div></Modal.Content>- {isLoadingIntegrations && (+ {!isOrgBilling ? (<>- <Modal.Separator />- <Modal.Content className="px-7 py-6">- <GenericSkeletonLoader />+ <Modal.Content className="px-3 border-y bg-alternative">+ <Alert_Shadcn_ variant="default" className="rounded-none border-0">+ <IconAlertCircle strokeWidth={2} />+ <AlertTitle_Shadcn_>+ Organization-based billing migration required+ </AlertTitle_Shadcn_>+ <AlertDescription_Shadcn_>+ <p className="!leading-normal">+ Your organization will first need to be migrated to use our new+ organization-based billing before you can enable Branching.+ </p>+ <p className="!leading-normal mt-1">+ You may do so under the billing settings of your organization.+ </p>+ </AlertDescription_Shadcn_>+ </Alert_Shadcn_>+ </Modal.Content>+ <Modal.Content className="px-4 pt-3">+ <div className="flex items-center justify-end space-x-2 py-2 pb-4">+ <Button+ disabled={isCreating}+ type="default"+ onClick={() => snap.setShowEnableBranchingModal(false)}+ >+ Understood+ </Button>+ <Link passHref href={`/org/${selectedOrg?.slug}/billing`}>+ <Button asChild>+ <a>Organization settings</a>+ </Button>+ </Link>+ </div></Modal.Content>- <Modal.Separator /></>- )}-- {isErrorIntegrations && (+ ) : (<>- <Modal.Separator />- <Modal.Content className="px-7 py-6">- <AlertError error={integrationsError} subject="Failed to retrieve integrations" />+ {isLoadingIntegrations && (+ <>+ <Modal.Separator />+ <Modal.Content className="px-7 py-6">+ <GenericSkeletonLoader />+ </Modal.Content>+ <Modal.Separator />+ </>+ )}++ {isErrorIntegrations && (+ <>+ <Modal.Separator />+ <Modal.Content className="px-7 py-6">+ <AlertError error={integrationsError} subject="Failed to retrieve integrations" />+ </Modal.Content>+ <Modal.Separator />+ </>+ )}++ {isSuccessIntegrations && (+ <>+ <GithubRepositorySelection+ integration={githubIntegration}+ selectedBranch={selectedBranch}+ hasGithubIntegrationInstalled={hasGithubIntegrationInstalled}+ setSelectedBranch={setSelectedBranch}+ />+ {/* <VercelProjectSelection integration={vercelIntegration} /> */}+ </>+ )}++ <Modal.Content className="px-7 py-6 flex flex-col gap-3">+ <p className="text-sm text-light">Please keep in mind the following:</p>+ <div className="flex flex-row gap-4">+ <div>+ <figure className="w-10 h-10 rounded-md bg-warning-200 border border-warning-300 flex items-center justify-center">+ <IconFileText className="text-amber-900" size={20} strokeWidth={2} />+ </figure>+ </div>+ <div>+ <p className="text-sm text">+ You will not be able to use the dashboard to make changes to the database+ </p>+ <p className="text-sm text-light">+ Schema changes for database preview branches must be done via Git. We are+ nonetheless working on allowing the dashboard to make schema changes for preview+ branches.+ </p>+ </div>+ </div></Modal.Content>+<Modal.Separator />- </>- )}- {isSuccessIntegrations && (- <>- <GithubRepositorySelection- integration={githubIntegration}- selectedBranch={selectedBranch}- hasGithubIntegrationInstalled={hasGithubIntegrationInstalled}- setSelectedBranch={setSelectedBranch}- />- {/* <VercelProjectSelection integration={vercelIntegration} /> */}+ <Modal.Content className="px-7">+ <div className="flex items-center space-x-2 py-2 pb-4">+ <Button+ size="medium"+ block+ disabled={isCreating}+ type="default"+ onClick={() => snap.setShowEnableBranchingModal(false)}+ >+ Cancel+ </Button>+ <Button+ size="medium"+ block+ disabled={selectedBranch === undefined || isCreating}+ loading={isCreating}+ type="primary"+ onClick={() => onEnableBranching()}+ >+ I understand, enable branching+ </Button>+ </div>+ </Modal.Content></>)}-- <Modal.Content className="px-7 py-6 flex flex-col gap-3">- <p className="text-sm text-light">Please keep in mind the following:</p>- <div className="flex flex-row gap-4">- <div>- <figure className="w-10 h-10 rounded-md bg-warning-200 border border-warning-300 flex items-center justify-center">- <IconFileText className="text-amber-900" size={20} strokeWidth={2} />- </figure>- </div>- <div>- <p className="text-sm text">- You will not be able to use the dashboard to make changes to the database- </p>- <p className="text-sm text-light">- Schema changes for database preview branches must be done via Git. We are- nonetheless working on allowing the dashboard to make schema changes for preview- branches.- </p>- </div>- </div>- </Modal.Content>-- <Modal.Separator />-- <Modal.Content className="px-7">- <div className="flex items-center space-x-2 py-2 pb-4">- <Button- size="medium"- block- disabled={isCreating}- type="default"- onClick={() => snap.setShowEnableBranchingModal(false)}- >- Cancel- </Button>- <Button- size="medium"- block- disabled={selectedBranch === undefined || isCreating}- loading={isCreating}- type="primary"- onClick={() => onEnableBranching()}- >- I understand, enable branching- </Button>- </div>- </Modal.Content></Modal><SidePanelGitHubRepoLinker projectRef={ref} />