Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Simplify paused state (#39922)

Saxon Fletcher4608b9af8c4c
diff --git a/apps/studio/components/interfaces/Home/Home.tsx b/apps/studio/components/interfaces/Home/Home.tsx
index fc24055f47d..e040864b476 100644
--- a/apps/studio/components/interfaces/Home/Home.tsx
+++ b/apps/studio/components/interfaces/Home/Home.tsx
@@ -98,6 +98,14 @@ export const Home = () => {
// [Joshen] JFYI minus 1 as the replicas endpoint returns the primary DB minimally
const replicasCount = Math.max(0, (replicasData?.length ?? 1) - 1)
+ if (isPaused) {
+ return (
+ <div className="w-full h-full flex items-center justify-center">
+ <ProjectPausedState />
+ </div>
+ )
+ }
+
return (
<div className="w-full px-4">
<div className={cn('py-16 ', !isPaused && 'border-b border-muted ')}>
@@ -200,84 +208,81 @@ export const Home = () => {
</div>
</div>
<ProjectUpgradeFailedBanner />
- {isPaused && <ProjectPausedState />}
</div>
</div>
- {!isPaused && (
- <>
- <div className="py-16 border-b border-muted">
- <div className="mx-auto max-w-7xl space-y-16">
- {IS_PLATFORM && project?.status !== PROJECT_STATUS.INACTIVE && (
- <>{isNewProject ? <NewProjectPanel /> : <ProjectUsageSection />}</>
- )}
- {!isNewProject && project?.status !== PROJECT_STATUS.INACTIVE && <AdvisorWidget />}
- </div>
+ <>
+ <div className="py-16 border-b border-muted">
+ <div className="mx-auto max-w-7xl space-y-16">
+ {IS_PLATFORM && project?.status !== PROJECT_STATUS.INACTIVE && (
+ <>{isNewProject ? <NewProjectPanel /> : <ProjectUsageSection />}</>
+ )}
+ {!isNewProject && project?.status !== PROJECT_STATUS.INACTIVE && <AdvisorWidget />}
</div>
+ </div>
- <div className="bg-surface-100/5 py-16">
- <div className="mx-auto max-w-7xl space-y-16">
- {project?.status !== PROJECT_STATUS.INACTIVE && (
- <>
- <div className="space-y-8">
- <h2 className="text-lg">Client libraries</h2>
- <div className="grid grid-cols-2 gap-x-8 gap-y-8 md:gap-12 mb-12 md:grid-cols-3">
- {clientLibraries!.map((library) => (
- // [Alaister]: Looks like the useCustomContent has wonky types. I'll look at a fix later.
- <ClientLibrary key={(library as any).language} {...(library as any)} />
- ))}
- </div>
+ <div className="bg-surface-100/5 py-16">
+ <div className="mx-auto max-w-7xl space-y-16">
+ {project?.status !== PROJECT_STATUS.INACTIVE && (
+ <>
+ <div className="space-y-8">
+ <h2 className="text-lg">Client libraries</h2>
+ <div className="grid grid-cols-2 gap-x-8 gap-y-8 md:gap-12 mb-12 md:grid-cols-3">
+ {clientLibraries!.map((library) => (
+ // [Alaister]: Looks like the useCustomContent has wonky types. I'll look at a fix later.
+ <ClientLibrary key={(library as any).language} {...(library as any)} />
+ ))}
</div>
- {showExamples && (
- <div className="flex flex-col gap-y-8">
- <h4 className="text-lg">Example projects</h4>
- {!!projectHomepageExampleProjects ? (
- <div className="grid gap-2 md:gap-8 md:grid-cols-2 lg:grid-cols-3">
- {/* [Alaister]: Looks like the useCustomContent has wonky types. I'll look at a fix later. */}
- {(projectHomepageExampleProjects as any)
- .sort((a: any, b: any) => a.title.localeCompare(b.title))
- .map((project: any) => (
- <ExampleProject key={project.url} {...project} />
- ))}
- </div>
- ) : (
- <div className="flex justify-center">
- <Tabs_Shadcn_ defaultValue="app" className="w-full">
- <TabsList_Shadcn_ className="flex gap-4 mb-8">
- <TabsTrigger_Shadcn_ value="app">App Frameworks</TabsTrigger_Shadcn_>
- <TabsTrigger_Shadcn_ value="mobile">
- Mobile Frameworks
- </TabsTrigger_Shadcn_>
- </TabsList_Shadcn_>
- <TabsContent_Shadcn_ value="app">
- <div className="grid gap-2 md:gap-8 md:grid-cols-2 lg:grid-cols-3">
- {EXAMPLE_PROJECTS.filter((project) => project.type === 'app')
- .sort((a, b) => a.title.localeCompare(b.title))
- .map((project) => (
- <ExampleProject key={project.url} {...project} />
- ))}
- </div>
- </TabsContent_Shadcn_>
- <TabsContent_Shadcn_ value="mobile">
- <div className="grid gap-2 md:gap-8 md:grid-cols-2 lg:grid-cols-3">
- {EXAMPLE_PROJECTS.filter((project) => project.type === 'mobile')
- .sort((a, b) => a.title.localeCompare(b.title))
- .map((project) => (
- <ExampleProject key={project.url} {...project} />
- ))}
- </div>
- </TabsContent_Shadcn_>
- </Tabs_Shadcn_>
- </div>
- )}
- </div>
- )}
- </>
- )}
- </div>
+ </div>
+ {showExamples && (
+ <div className="flex flex-col gap-y-8">
+ <h4 className="text-lg">Example projects</h4>
+ {!!projectHomepageExampleProjects ? (
+ <div className="grid gap-2 md:gap-8 md:grid-cols-2 lg:grid-cols-3">
+ {/* [Alaister]: Looks like the useCustomContent has wonky types. I'll look at a fix later. */}
+ {(projectHomepageExampleProjects as any)
+ .sort((a: any, b: any) => a.title.localeCompare(b.title))
+ .map((project: any) => (
+ <ExampleProject key={project.url} {...project} />
+ ))}
+ </div>
+ ) : (
+ <div className="flex justify-center">
+ <Tabs_Shadcn_ defaultValue="app" className="w-full">
+ <TabsList_Shadcn_ className="flex gap-4 mb-8">
+ <TabsTrigger_Shadcn_ value="app">App Frameworks</TabsTrigger_Shadcn_>
+ <TabsTrigger_Shadcn_ value="mobile">
+ Mobile Frameworks
+ </TabsTrigger_Shadcn_>
+ </TabsList_Shadcn_>
+ <TabsContent_Shadcn_ value="app">
+ <div className="grid gap-2 md:gap-8 md:grid-cols-2 lg:grid-cols-3">
+ {EXAMPLE_PROJECTS.filter((project) => project.type === 'app')
+ .sort((a, b) => a.title.localeCompare(b.title))
+ .map((project) => (
+ <ExampleProject key={project.url} {...project} />
+ ))}
+ </div>
+ </TabsContent_Shadcn_>
+ <TabsContent_Shadcn_ value="mobile">
+ <div className="grid gap-2 md:gap-8 md:grid-cols-2 lg:grid-cols-3">
+ {EXAMPLE_PROJECTS.filter((project) => project.type === 'mobile')
+ .sort((a, b) => a.title.localeCompare(b.title))
+ .map((project) => (
+ <ExampleProject key={project.url} {...project} />
+ ))}
+ </div>
+ </TabsContent_Shadcn_>
+ </Tabs_Shadcn_>
+ </div>
+ )}
+ </div>
+ )}
+ </>
+ )}
</div>
- </>
- )}
+ </div>
+ </>
</div>
)
}
diff --git a/apps/studio/components/interfaces/HomeNew/TopSection.tsx b/apps/studio/components/interfaces/HomeNew/TopSection.tsx
index 498deedb424..e32c7aa711d 100644
--- a/apps/studio/components/interfaces/HomeNew/TopSection.tsx
+++ b/apps/studio/components/interfaces/HomeNew/TopSection.tsx
@@ -37,19 +37,7 @@ export const TopSection = () => {
: 'Welcome to your project'
if (isPaused) {
- return (
- <div className="w-full">
- <div className="mb-8">
- {!isMainBranch && (
- <Link href={`/project/${parentProject?.ref}`} className="text-sm text-foreground-light">
- {parentProject?.name}
- </Link>
- )}
- <h1 className="text-3xl">{projectName}</h1>
- </div>
- <ProjectPausedState />
- </div>
- )
+ return <ProjectPausedState />
}
return (
diff --git a/apps/studio/components/interfaces/ProjectCreation/PostgresVersionSelector.tsx b/apps/studio/components/interfaces/ProjectCreation/PostgresVersionSelector.tsx
index 9e4f0d3b2e1..7b17d5d43aa 100644
--- a/apps/studio/components/interfaces/ProjectCreation/PostgresVersionSelector.tsx
+++ b/apps/studio/components/interfaces/ProjectCreation/PostgresVersionSelector.tsx
@@ -19,14 +19,14 @@ import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { smartRegionToExactRegion } from './ProjectCreation.utils'
interface PostgresVersionDetails {
- postgresEngine: PostgresEngine | undefined
- releaseChannel: ReleaseChannel | undefined
+ postgresEngine?: Exclude<PostgresEngine, '13' | '14'>
+ releaseChannel?: ReleaseChannel
}
interface PostgresVersionSelectorProps {
cloudProvider: CloudProvider
dbRegion: string
- organizationSlug: string | undefined
+ organizationSlug?: string
field: ControllerRenderProps<any, 'postgresVersionSelection'>
form: UseFormReturn<any>
type?: 'create' | 'unpause'
diff --git a/apps/studio/components/interfaces/Settings/General/Infrastructure/ProjectUpgradeAlert.tsx b/apps/studio/components/interfaces/Settings/General/Infrastructure/ProjectUpgradeAlert.tsx
index 3209c31a593..b285e566581 100644
--- a/apps/studio/components/interfaces/Settings/General/Infrastructure/ProjectUpgradeAlert.tsx
+++ b/apps/studio/components/interfaces/Settings/General/Infrastructure/ProjectUpgradeAlert.tsx
@@ -10,12 +10,12 @@ import { z } from 'zod'
import { useFlag, useParams } from 'common'
import { PLAN_DETAILS } from 'components/interfaces/DiskManagement/ui/DiskManagement.constants'
import { Markdown } from 'components/interfaces/Markdown'
+import { extractPostgresVersionDetails } from 'components/interfaces/ProjectCreation/PostgresVersionSelector'
import { useDiskAttributesQuery } from 'data/config/disk-attributes-query'
import {
ProjectUpgradeTargetVersion,
useProjectUpgradeEligibilityQuery,
} from 'data/config/project-upgrade-eligibility-query'
-import { ReleaseChannel } from 'data/projects/new-project.constants'
import { useSetProjectStatus } from 'data/projects/project-detail-query'
import { useProjectUpgradeMutation } from 'data/projects/project-upgrade-mutation'
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
@@ -43,24 +43,10 @@ import {
import { Admonition } from 'ui-patterns/admonition'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
-interface PostgresVersionDetails {
- postgresEngine: string
- releaseChannel: ReleaseChannel
-}
-
const formatValue = ({ postgres_version, release_channel }: ProjectUpgradeTargetVersion) => {
return `${postgres_version}|${release_channel}`
}
-export const extractPostgresVersionDetails = (value: string): PostgresVersionDetails | null => {
- if (!value) {
- return null
- }
-
- const [postgresEngine, releaseChannel] = value.split('|')
- return { postgresEngine, releaseChannel } as PostgresVersionDetails
-}
-
export const ProjectUpgradeAlert = () => {
const router = useRouter()
const { ref } = useParams()
@@ -99,6 +85,7 @@ export const ProjectUpgradeAlert = () => {
const versionDetails = extractPostgresVersionDetails(postgresVersionSelection)
if (!versionDetails) return toast.error('Invalid Postgres version')
+ if (!versionDetails.postgresEngine) return toast.error('Missing target version')
upgradeProject({
ref,
diff --git a/apps/studio/components/layouts/ProjectLayout/PausedState/PauseDisabledState.tsx b/apps/studio/components/layouts/ProjectLayout/PausedState/PauseDisabledState.tsx
index 8eaa7b8bad4..965f16e0678 100644
--- a/apps/studio/components/layouts/ProjectLayout/PausedState/PauseDisabledState.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/PausedState/PauseDisabledState.tsx
@@ -4,6 +4,7 @@ import { toast } from 'sonner'
import { useParams } from 'common'
import { DropdownMenuItemTooltip } from 'components/ui/DropdownMenuItemTooltip'
+import { InlineLink } from 'components/ui/InlineLink'
import { useBackupDownloadMutation } from 'data/database/backup-download-mutation'
import { useProjectPauseStatusQuery } from 'data/projects/project-pause-status-query'
import { useStorageArchiveCreateMutation } from 'data/storage/storage-archive-create-mutation'
@@ -12,16 +13,13 @@ import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { Database, Storage } from 'icons'
import { DOCS_URL, PROJECT_STATUS } from 'lib/constants'
import {
- Alert_Shadcn_,
- AlertDescription_Shadcn_,
- AlertTitle_Shadcn_,
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
- WarningIcon,
} from 'ui'
+import { Admonition } from 'ui-patterns'
export const PauseDisabledState = () => {
const { ref } = useParams()
@@ -116,25 +114,56 @@ export const PauseDisabledState = () => {
}
return (
- <Alert_Shadcn_ variant="warning">
- <WarningIcon />
- <AlertTitle_Shadcn_>Project cannot be restored through the dashboard</AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_>
- This project has been paused for over{' '}
- <span className="text-foreground">
- {pauseStatus?.max_days_till_restore_disabled ?? 90} days
- </span>{' '}
- and cannot be restored through the dashboard. However, your data remains intact and can be
- downloaded as a backup.
- </AlertDescription_Shadcn_>
- <AlertDescription_Shadcn_ className="gap-x-2 mt-3">
+ <>
+ <Admonition
+ showIcon={false}
+ type="warning"
+ className="mb-0 rounded-none border-0 px-6"
+ title="Project can no longer be restored through the dashboard"
+ >
+ <p className="!leading-normal !mb-3">
+ This project has been paused for over{' '}
+ <span className="text-foreground">
+ {pauseStatus?.max_days_till_restore_disabled ?? 90} days
+ </span>{' '}
+ and cannot be restored through the dashboard. However, your data remains intact and can be
+ downloaded as a backup.
+ </p>
+
+ <div>
+ <p className="!leading-normal !mb-1">Recovery options:</p>
+ <ul className="flex flex-col gap-y-0.5">
+ <li className="flex items-center gap-x-2">
+ <ExternalLink size={14} />
+ <InlineLink
+ href={`${DOCS_URL}/guides/platform/migrating-within-supabase/dashboard-restore`}
+ >
+ Restore the backup to a new Supabase project
+ </InlineLink>
+ </li>
+ <li className="flex items-center gap-x-2">
+ <ExternalLink size={14} />
+ <InlineLink href={`${DOCS_URL}/guides/local-development/restoring-downloaded-backup`}>
+ Restore the backup on your local machine
+ </InlineLink>
+ </li>
+ </ul>
+ </div>
+ </Admonition>
+ <div className="border-t flex justify-between items-center px-6 py-4 bg-alternative">
+ <div>
+ <p className="text-sm">Export your data</p>
+ <p className="text-sm text-foreground-lighter">
+ Download backups for your database and storage objects
+ </p>
+ </div>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button type="default" icon={<Download />} iconRight={<ChevronDown />}>
Download backups
</Button>
</DropdownMenuTrigger>
- <DropdownMenuContent className="w-56" align="start">
+ <DropdownMenuContent className="w-60" align="end">
<DropdownMenuItemTooltip
className="gap-x-2"
disabled={!latestBackup}
@@ -160,25 +189,7 @@ export const PauseDisabledState = () => {
</DropdownMenuItem> */}
</DropdownMenuContent>
</DropdownMenu>
- <Button asChild type="default" icon={<ExternalLink />} className="my-3">
- <a
- target="_blank"
- rel="noreferrer"
- href={`${DOCS_URL}/guides/platform/migrating-within-supabase/dashboard-restore`}
- >
- Restore backup to a new Supabase project guide
- </a>
- </Button>
- <Button asChild type="default" icon={<ExternalLink />} className="mb-3">
- <a
- target="_blank"
- rel="noreferrer"
- href={`${DOCS_URL}/guides/local-development/restoring-downloaded-backup`}
- >
- Restore backup on your local machine guide
- </a>
- </Button>
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
+ </div>
+ </>
)
}
diff --git a/apps/studio/components/layouts/ProjectLayout/PausedState/ProjectPausedState.tsx b/apps/studio/components/layouts/ProjectLayout/PausedState/ProjectPausedState.tsx
index 41fa6ea8664..482fb73888a 100644
--- a/apps/studio/components/layouts/ProjectLayout/PausedState/ProjectPausedState.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/PausedState/ProjectPausedState.tsx
@@ -1,7 +1,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import dayjs from 'dayjs'
-import { ExternalLink, PauseCircle } from 'lucide-react'
+import { PauseCircle } from 'lucide-react'
import Link from 'next/link'
import { useState } from 'react'
import { useForm } from 'react-hook-form'
@@ -9,11 +9,14 @@ import { toast } from 'sonner'
import { z } from 'zod'
import { useFlag, useParams } from 'common'
-import { PostgresVersionSelector } from 'components/interfaces/ProjectCreation/PostgresVersionSelector'
+import {
+ extractPostgresVersionDetails,
+ PostgresVersionSelector,
+} from 'components/interfaces/ProjectCreation/PostgresVersionSelector'
import AlertError from 'components/ui/AlertError'
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
+import { InlineLinkClassName } from 'components/ui/InlineLink'
import { useFreeProjectLimitCheckQuery } from 'data/organizations/free-project-limit-check-query'
-import { PostgresEngine, ReleaseChannel } from 'data/projects/new-project.constants'
import { useSetProjectStatus } from 'data/projects/project-detail-query'
import { useProjectPauseStatusQuery } from 'data/projects/project-pause-status-query'
import { useProjectRestoreMutation } from 'data/projects/project-restore-mutation'
@@ -21,35 +24,35 @@ import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { usePHFlag } from 'hooks/ui/useFlag'
-import { DOCS_URL, PROJECT_STATUS } from 'lib/constants'
+import { PROJECT_STATUS } from 'lib/constants'
import { AWS_REGIONS, CloudProvider } from 'shared-data'
import {
- AlertDescription_Shadcn_,
- AlertTitle_Shadcn_,
- Alert_Shadcn_,
Button,
- FormField_Shadcn_,
+ Card,
+ CardContent,
+ CardFooter,
+ cn,
+ Dialog,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogSection,
+ DialogTitle,
Form_Shadcn_,
- Modal,
+ FormField_Shadcn_,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
} from 'ui'
+import { TimestampInfo } from 'ui-patterns'
+import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
-import { RestorePaidPlanProjectNotice } from '../RestorePaidPlanProjectNotice'
import { PauseDisabledState } from './PauseDisabledState'
export interface ProjectPausedStateProps {
product?: string
}
-interface PostgresVersionDetails {
- postgresEngine: Exclude<PostgresEngine, '13' | '14'>
- releaseChannel: ReleaseChannel
-}
-
-export const extractPostgresVersionDetails = (value: string): PostgresVersionDetails => {
- const [postgresEngine, releaseChannel] = value.split('|')
- return { postgresEngine, releaseChannel } as PostgresVersionDetails
-}
-
export const ProjectPausedState = ({ product }: ProjectPausedStateProps) => {
const { ref } = useParams()
const { data: project } = useSelectedProjectQuery()
@@ -66,7 +69,7 @@ export const ProjectPausedState = ({ product }: ProjectPausedStateProps) => {
data: pauseStatus,
error: pauseStatusError,
isError,
- isSuccess,
+ isSuccess: isPauseStatusSuccess,
isLoading,
} = useProjectPauseStatusQuery({ ref }, { enabled: project?.status === PROJECT_STATUS.INACTIVE })
@@ -76,7 +79,7 @@ export const ProjectPausedState = ({ product }: ProjectPausedStateProps) => {
0
const isFreePlan = selectedOrganization?.plan?.id === 'free'
- const isRestoreDisabled = isSuccess && !pauseStatus.can_restore
+ const isRestoreDisabled = isPauseStatusSuccess && !pauseStatus.can_restore
const { data: membersExceededLimit } = useFreeProjectLimitCheckQuery(
{ slug: orgSlug },
@@ -138,214 +141,207 @@ export const ProjectPausedState = ({ product }: ProjectPausedStateProps) => {
return (
<>
- <div className="space-y-4">
- <div className="w-full mx-auto mb-8 md:mb-16">
- <div className="flex md:h-[500px] items-center justify-center rounded border border-overlay bg-surface-100 p-4 md:p-8">
- <div className="grid max-w-2xl gap-4">
- <div className="mx-auto flex max-w-[300px] items-center justify-center space-x-4 lg:space-x-8">
- <PauseCircle className="text-foreground-light" size={50} strokeWidth={1.5} />
- </div>
+ <Card className="w-[40rem] mx-auto">
+ <CardContent>
+ <PauseCircle
+ size={48}
+ strokeWidth={1}
+ className="text-foreground-lighter shrink-0 mb-4"
+ />
+ <div className="flex-1">
+ <div>
+ <h2 className="mb-4">The project "{project?.name}" is currently paused</h2>
+ <div className="text-foreground-light max-w-4xl">
+ {isLoading && <GenericSkeletonLoader className="mt-3" />}
- <div className="flex flex-col gap-y-2">
- <div className="flex flex-col gap-y-1">
- <p className="text-center">
- The project "{project?.name ?? ''}" is currently paused.
- </p>
- <p className="text-sm text-foreground-light text-center">
+ {isPauseStatusSuccess && !isRestoreDisabled ? (
+ isFreePlan ? (
+ <>
+ <p className="text-sm">
+ All data, including backups and storage objects, remains safe. You can
+ resume this project from the dashboard within{' '}
+ <Tooltip>
+ <TooltipTrigger>
+ <span className={cn(InlineLinkClassName, 'text-foreground')}>
+ {finalDaysRemainingBeforeRestoreDisabled} day
+ {finalDaysRemainingBeforeRestoreDisabled > 1 ? 's' : ''}
+ </span>{' '}
+ </TooltipTrigger>
+ <TooltipContent side="bottom" className="w-80 text-center">
+ Free projects cannot be restored through the dashboard if they are
+ paused for more than {pauseStatus.max_days_till_restore_disabled} days
+ </TooltipContent>
+ </Tooltip>{' '}
+ (until{' '}
+ <TimestampInfo
+ displayAs="local"
+ utcTimestamp={dayjs()
+ .utc()
+ .add(pauseStatus.remaining_days_till_restore_disabled ?? 0, 'day')
+ .toISOString()}
+ className="text-sm text-foreground"
+ labelFormat="DD MMM YYYY"
+ />
+ ). After that, this project will not be resumable, but data will still be
+ available for download.
+ </p>
+ <p className="text-sm text-foreground-lighter mt-4">
+ {enableProBenefitWording === 'variant-a'
+ ? 'Upgrade to Pro to prevent pauses and unlock features like branching, compute upgrades, and daily backups.'
+ : 'To prevent future pauses, consider upgrading to Pro.'}
+ </p>
+ </>
+ ) : (
+ <p className="text-sm">
+ Your project data is safe but inaccessible while paused. Once resumed, usage
+ will be billed by compute size and hours active.
+ </p>
+ )
+ ) : !isLoading ? (
+ <p className="text-sm">
All of your project's data is still intact, but your project is inaccessible
while paused.{' '}
{product !== undefined ? (
<>
- Restore this project to access the{' '}
- <span className="text-brand">{product}</span> page
+ Resume this project to access the{' '}
+ <span className="text-brand">{product}</span> page.
</>
- ) : (
- 'Restore this project and get back to building!'
- )}
+ ) : !isRestoreDisabled ? (
+ 'Resume this project and get back to building!'
+ ) : null}
</p>
- </div>
-
- {isLoading && <GenericSkeletonLoader />}
- {isError && (
- <AlertError error={pauseStatusError} subject="Failed to retrieve pause status" />
- )}
- {isSuccess && (
- <>
- {isRestoreDisabled ? (
- <PauseDisabledState />
- ) : isFreePlan ? (
- <>
- <p className="text-sm text-foreground-light text-center">
- {enableProBenefitWording === 'variant-a'
- ? 'Upgrade to Pro plan to prevent future pauses and use Pro features like branching, compute upgrades, and daily backups.'
- : 'To prevent future pauses, consider upgrading to Pro.'}
- </p>
- <Alert_Shadcn_>
- <AlertTitle_Shadcn_>
- Project can be restored through the dashboard within the next{' '}
- {finalDaysRemainingBeforeRestoreDisabled} day
- {finalDaysRemainingBeforeRestoreDisabled > 1 ? 's' : ''}
- </AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_>
- Free projects cannot be restored through the dashboard if they are
- paused for more than{' '}
- <span className="text-foreground">
- {pauseStatus?.max_days_till_restore_disabled} days
- </span>
- . The latest that your project can be restored is by{' '}
- <span className="text-foreground">
- {dayjs()
- .utc()
- .add(pauseStatus.remaining_days_till_restore_disabled ?? 0, 'day')
- .format('DD MMM YYYY')}
- </span>
- . However, your database backup and Storage objects will still be
- available for download thereafter.
- </AlertDescription_Shadcn_>
- <AlertDescription_Shadcn_ className="mt-3">
- <Button asChild type="default" icon={<ExternalLink />}>
- <a
- target="_blank"
- rel="noreferrer"
- href={`${DOCS_URL}/guides/platform/migrating-and-upgrading-projects#time-limits`}
- >
- More information
- </a>
- </Button>
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
- </>
- ) : (
- <RestorePaidPlanProjectNotice />
- )}
- </>
- )}
+ ) : null}
</div>
-
- {isSuccess && !isRestoreDisabled && (
- <div className="flex items-center justify-center gap-4">
- <ButtonTooltip
- size="tiny"
- type="default"
- disabled={!canResumeProject}
- onClick={onSelectRestore}
- tooltip={{
- content: {
- side: 'bottom',
- text: !canResumeProject
- ? 'You need additional permissions to resume this project'
- : undefined,
- },
- }}
- >
- Restore project
- </ButtonTooltip>
- {isFreePlan ? (
- <Button asChild type="primary">
- <Link
- href={`/org/${orgSlug}/billing?panel=subscriptionPlan&source=projectPausedStateRestore`}
- >
- Upgrade to Pro
- </Link>
- </Button>
- ) : (
- <Button asChild type="default">
- <Link href={`/project/${ref}/settings/general`}>View project settings</Link>
- </Button>
- )}
- </div>
- )}
</div>
</div>
- </div>
- </div>
+ </CardContent>
+
+ {isError && (
+ <AlertError
+ className="rounded-none border-0"
+ error={pauseStatusError}
+ subject="Failed to retrieve pause status"
+ />
+ )}
+
+ {isPauseStatusSuccess && !isRestoreDisabled && (
+ <CardFooter className="flex justify-end items-center gap-x-2">
+ <ButtonTooltip
+ size="tiny"
+ type="default"
+ disabled={!canResumeProject}
+ onClick={onSelectRestore}
+ tooltip={{
+ content: {
+ side: 'bottom',
+ text: !canResumeProject
+ ? 'You need additional permissions to resume this project'
+ : undefined,
+ },
+ }}
+ >
+ Resume project
+ </ButtonTooltip>
+
+ {isFreePlan ? (
+ <Button asChild type="primary">
+ <Link
+ href={`/org/${orgSlug}/billing?panel=subscriptionPlan&source=projectPausedStateRestore`}
+ >
+ Upgrade to Pro
+ </Link>
+ </Button>
+ ) : (
+ <Button asChild type="default">
+ <Link href={`/project/${ref}/settings/general`}>View project settings</Link>
+ </Button>
+ )}
+ </CardFooter>
+ )}
- <Modal
- hideFooter
+ {isPauseStatusSuccess && isRestoreDisabled && <PauseDisabledState />}
+ </Card>
+
+ <ConfirmationModal
visible={showConfirmRestore}
- size={'small'}
- title="Restore this project"
- description="Confirm to restore this project? Your project's data will be restored to when it was initially paused."
+ size="medium"
+ title="Resume this project"
+ description={
+ isFreePlan
+ ? "Your project's data will be restored to when it was initially paused."
+ : "Your project's data will be restored and billing will resume based on compute size and hours active."
+ }
onCancel={() => setShowConfirmRestore(false)}
- header={'Restore this project'}
+ onConfirm={() => form.handleSubmit(onConfirmRestore)()}
+ loading={isRestoring}
+ confirmLabel="Confirm resume"
+ cancelLabel="Cancel"
>
<Form_Shadcn_ {...form}>
<form onSubmit={form.handleSubmit(onConfirmRestore)}>
{showPostgresVersionSelector && (
- <Modal.Content>
- <div className="space-y-2">
- <FormField_Shadcn_
- control={form.control}
- name="postgresVersionSelection"
- render={({ field }) => (
- <PostgresVersionSelector
- field={field}
- form={form}
- type="unpause"
- label="Select the version of Postgres to restore to"
- layout="vertical"
- dbRegion={region?.displayName ?? ''}
- cloudProvider={(project?.cloud_provider ?? 'AWS') as CloudProvider}
- organizationSlug={selectedOrganization?.slug}
- />
- )}
- />
- </div>
- </Modal.Content>
+ <div className="space-y-2">
+ <FormField_Shadcn_
+ control={form.control}
+ name="postgresVersionSelection"
+ render={({ field }) => (
+ <PostgresVersionSelector
+ field={field}
+ form={form}
+ type="unpause"
+ label="Select the version of Postgres to resume to"
+ layout="vertical"
+ dbRegion={region?.displayName ?? ''}
+ cloudProvider={(project?.cloud_provider ?? 'AWS') as CloudProvider}
+ organizationSlug={selectedOrganization?.slug}
+ />
+ )}
+ />
+ </div>
)}
- <Modal.Content className="flex items-center space-x-2 justify-end">
- <Button
- type="default"
- disabled={isRestoring}
- onClick={() => setShowConfirmRestore(false)}
- >
- Cancel
- </Button>
- <Button htmlType="submit" loading={isRestoring}>
- Confirm restore
- </Button>
- </Modal.Content>
</form>
</Form_Shadcn_>
- </Modal>
+ </ConfirmationModal>
- <Modal
- hideFooter
- visible={showFreeProjectLimitWarning}
- size="medium"
- header="Your organization has members who have exceeded their free project limits"
- onCancel={() => setShowFreeProjectLimitWarning(false)}
+ <Dialog
+ open={showFreeProjectLimitWarning}
+ onOpenChange={() => setShowFreeProjectLimitWarning(false)}
>
- <Modal.Content className="space-y-2">
- <p className="text-sm text-foreground-light">
- The following members have reached their maximum limits for the number of active free
- plan projects within organizations where they are an administrator or owner:
- </p>
- <ul className="pl-5 text-sm list-disc text-foreground-light">
- {(membersExceededLimit || []).map((member, idx: number) => (
- <li key={`member-${idx}`}>
- {member.username || member.primary_email} (Limit: {member.free_project_limit} free
- projects)
- </li>
- ))}
- </ul>
- <p className="text-sm text-foreground-light">
- These members will need to either delete, pause, or upgrade one or more of these
- projects before you're able to unpause this project.
- </p>
- </Modal.Content>
- <Modal.Separator />
- <Modal.Content>
- <Button
- htmlType="button"
- type="default"
- onClick={() => setShowFreeProjectLimitWarning(false)}
- block
- >
- Understood
- </Button>
- </Modal.Content>
- </Modal>
+ <DialogContent size="medium" className="gap-0 pb-0">
+ <DialogHeader className="border-b">
+ <DialogTitle className="leading-normal">
+ Your organization has members who have exceeded their free project limits
+ </DialogTitle>
+ </DialogHeader>
+ <DialogSection className="text-sm">
+ <p className="text-foreground-light">
+ The following members have reached their maximum limits for the number of active free
+ plan projects within organizations where they are an administrator or owner:
+ </p>
+ <ul className="my-4 list-disc list-inside">
+ {(membersExceededLimit || []).map((member, idx: number) => (
+ <li key={`member-${idx}`}>
+ {member.username || member.primary_email} (Limit: {member.free_project_limit} free
+ projects)
+ </li>
+ ))}
+ </ul>
+ <p className="text-foreground-light">
+ These members will need to either delete, pause, or upgrade one or more of these
+ projects before you're able to resume this project.
+ </p>
+ </DialogSection>
+ <DialogFooter>
+ <Button
+ htmlType="button"
+ type="default"
+ onClick={() => setShowFreeProjectLimitWarning(false)}
+ >
+ Understood
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
</>
)
}