Skip to content

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

chore: allow pausing for AWS_NEW projects regardless of pricing tier (#35493)

angelico0880e0e1d0ef
diff --git a/.gitignore b/.gitignore
index e7cd51f7258..761041edaae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -136,3 +136,5 @@ gcloud.json
# CLI version file
.temp/cli-latest
+
+.pnpm-store/*
diff --git a/apps/studio/components/interfaces/Settings/General/Infrastructure/PauseProjectButton.tsx b/apps/studio/components/interfaces/Settings/General/Infrastructure/PauseProjectButton.tsx
index b94d15df87d..c86f94cc5ff 100644
--- a/apps/studio/components/interfaces/Settings/General/Infrastructure/PauseProjectButton.tsx
+++ b/apps/studio/components/interfaces/Settings/General/Infrastructure/PauseProjectButton.tsx
@@ -14,6 +14,7 @@ import { useProjectPauseMutation } from 'data/projects/project-pause-mutation'
import { setProjectStatus } from 'data/projects/projects-query'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
+import { useIsOrioleDbInAwsRevamped } from 'hooks/misc/useSelectedProject'
import { PROJECT_STATUS } from 'lib/constants'
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
@@ -32,10 +33,12 @@ const PauseProjectButton = () => {
'queue_jobs.projects.pause'
)
+ const isOrioleDBInAwsNew = useIsOrioleDbInAwsRevamped()
const isFreePlan = organization?.plan.id === 'free'
+ const isPaidAndNotAwsNew = !isFreePlan && !isOrioleDBInAwsNew
const { mutate: pauseProject, isLoading: isPausing } = useProjectPauseMutation({
- onSuccess: (res, variables) => {
+ onSuccess: (_, variables) => {
setProjectStatus(queryClient, variables.ref, PROJECT_STATUS.PAUSING)
toast.success('Pausing project...')
router.push(`/project/${projectRef}`)
@@ -50,7 +53,7 @@ const PauseProjectButton = () => {
}
const buttonDisabled =
- !isFreePlan || project === undefined || isPaused || !canPauseProject || !isProjectActive
+ isPaidAndNotAwsNew || project === undefined || isPaused || !canPauseProject || !isProjectActive
return (
<>
@@ -69,7 +72,7 @@ const PauseProjectButton = () => {
? 'You need additional permissions to pause this project'
: !isProjectActive
? 'Unable to pause project as project is not active'
- : !isFreePlan
+ : isPaidAndNotAwsNew
? 'Projects on a paid plan will always be running'
: undefined,
},
diff --git a/apps/studio/hooks/misc/useSelectedProject.ts b/apps/studio/hooks/misc/useSelectedProject.ts
index c973f22e083..4b88355116a 100644
--- a/apps/studio/hooks/misc/useSelectedProject.ts
+++ b/apps/studio/hooks/misc/useSelectedProject.ts
@@ -46,3 +46,14 @@ export const useIsOrioleDbInAws = () => {
project?.dbVersion?.endsWith('orioledb') && project?.cloud_provider === PROVIDERS.AWS.id
return isOrioleDbInAws
}
+
+export const useIsOrioleDbInAwsRevamped = () => {
+ const project = useSelectedProject()
+
+ const isOrioleDb = project?.dbVersion?.endsWith('orioledb')
+ const isOrioleDbInAws =
+ project?.dbVersion?.endsWith('orioledb') && project?.cloud_provider === PROVIDERS.AWS.id
+ const isOrioleDbInAwsRevamped = isOrioleDb && !isOrioleDbInAws
+
+ return isOrioleDbInAwsRevamped
+}