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

* chore: gitignore .pnpm-store/*

* chore: allow pausing for aws new projects

* fix: incorrect logic

* chore: clean up logic

* Small refactor

* chore: update conditions for useIsOrioleDbInAwsRevamped

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
This commit is contained in:
angelico
2025-05-16 14:16:53 +08:00
committed by GitHub
parent 8e43416557
commit 0880e0e1d0
3 changed files with 19 additions and 3 deletions

2
.gitignore vendored
View File

@@ -136,3 +136,5 @@ gcloud.json
# CLI version file
.temp/cli-latest
.pnpm-store/*

View File

@@ -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,
},

View File

@@ -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
}