mirror of
https://github.com/supabase/supabase.git
synced 2026-09-08 19:08:44 +08:00
## What kind of change does this PR introduce? Feature. Stack 1 of 5 for [PIPE-1007](https://linear.app/supabase/issue/PIPE-1007/move-read-replicas-out-of-replication-into-infrastructure). ## What is the current behavior? Read replica UI lives under Database / Replication. ## What is the new behavior? Moves replica form, row, and modals into Settings/Infrastructure and extracts `REPLICA_STATUS` plus path helpers. URLs and user-facing behaviour are unchanged. ## Additional context Keep `infrastructure:read_replicas` off in prod until the full stack lands. Stack: this PR → [#49044](https://github.com/supabase/supabase/pull/49044) → [#49045](https://github.com/supabase/supabase/pull/49045) → [#49046](https://github.com/supabase/supabase/pull/49046) → [#48921](https://github.com/supabase/supabase/pull/48921) ## To test Open [Database / Replication](https://studio-staging-git-danny-pipe-1007-01-relocate-701014-supabase.vercel.app/dashboard/project/_/database/replication?destinationType=Read+Replica). Confirm add replica still works as today. No new Infrastructure section yet. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added navigation for viewing a specific read replica and starting the add-replica setup flow. - Improved read-replica setup validation, including unsupported regions and invalid PostgreSQL versions. - **Bug Fixes** - Corrected default region and success messaging behavior. - Prevented incomplete pricing labels and clarified eligibility warnings. - Improved display handling for localized pricing values. - **Tests** - Added coverage for read-replica navigation paths and fallback behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
64 lines
1.5 KiB
TypeScript
64 lines
1.5 KiB
TypeScript
import { REPLICA_STATUS } from './ReadReplicas.constants'
|
|
import { ReplicaInitializationStatus } from '@/data/read-replicas/replicas-status-query'
|
|
|
|
export const getIsInTransition = ({
|
|
initStatus,
|
|
status,
|
|
}: {
|
|
initStatus?: string
|
|
status?: string
|
|
}) => {
|
|
return (
|
|
(
|
|
[
|
|
REPLICA_STATUS.UNKNOWN,
|
|
REPLICA_STATUS.COMING_UP,
|
|
REPLICA_STATUS.GOING_DOWN,
|
|
REPLICA_STATUS.RESTORING,
|
|
REPLICA_STATUS.RESTARTING,
|
|
REPLICA_STATUS.RESIZING,
|
|
REPLICA_STATUS.INIT_READ_REPLICA,
|
|
] as string[]
|
|
).includes(status ?? '') || initStatus === ReplicaInitializationStatus.InProgress
|
|
)
|
|
}
|
|
|
|
export const getStatusLabel = ({
|
|
initStatus,
|
|
status,
|
|
}: {
|
|
initStatus?: string
|
|
status?: string
|
|
}) => {
|
|
if (
|
|
initStatus === ReplicaInitializationStatus.InProgress ||
|
|
status === REPLICA_STATUS.COMING_UP ||
|
|
status === REPLICA_STATUS.UNKNOWN ||
|
|
status === REPLICA_STATUS.INIT_READ_REPLICA
|
|
) {
|
|
return 'Coming up'
|
|
}
|
|
|
|
if (
|
|
initStatus === ReplicaInitializationStatus.Failed ||
|
|
status === REPLICA_STATUS.INIT_READ_REPLICA_FAILED
|
|
) {
|
|
return 'Failed'
|
|
}
|
|
|
|
switch (status) {
|
|
case REPLICA_STATUS.GOING_DOWN:
|
|
return 'Going down'
|
|
case REPLICA_STATUS.RESTARTING:
|
|
return 'Restarting'
|
|
case REPLICA_STATUS.RESIZING:
|
|
return 'Resizing'
|
|
case REPLICA_STATUS.RESTORING:
|
|
return 'Restoring'
|
|
case REPLICA_STATUS.ACTIVE_HEALTHY:
|
|
return 'Healthy'
|
|
default:
|
|
return 'Unhealthy'
|
|
}
|
|
}
|