mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 17:30:25 -04:00
dd41a34706
Simplify the Connect modal for Multigres/High Availability projects. Pooling is always on for these projects, so the connection method distinction doesn't apply. **Removed:** - Connection Method selector (Direct/Transaction/Session) for HA projects - IPv4 add-on panel for HA projects - Pooler badge (Shared/Dedicated) for HA projects **Changed:** - "Type" label renamed to "Connection Type" for HA projects - Default connection method set to `transaction` (instead of `direct`) for HA projects Non-HA projects are completely unaffected. ## To test - Open Connect sheet → Direct tab on a **non-HA project** — verify everything looks the same as before - Open Connect sheet → Direct tab on an **HA project** — verify: - No Connection Method radio selector - Label reads "Connection Type" instead of "Type" - No IPv4 status panel - No pooler badge - Connection string displays correctly <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * Connection UI now adapts for high-availability projects: hides pooler options and IPv4 status, and updates the connection type label for clarity. * **Tests** * Added tests covering connection configuration behavior when a project is high-availability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import { useParams } from 'common'
|
|
|
|
import { useProjectDetailQuery } from '@/data/projects/project-detail-query'
|
|
import { PROJECT_STATUS, PROVIDERS } from '@/lib/constants'
|
|
|
|
export function useSelectedProjectQuery({ enabled = true } = {}) {
|
|
const { ref } = useParams()
|
|
|
|
return useProjectDetailQuery(
|
|
{ ref },
|
|
{
|
|
enabled,
|
|
select: (data) => {
|
|
return {
|
|
...data,
|
|
parentRef: data.parent_project_ref ?? data.ref,
|
|
}
|
|
},
|
|
}
|
|
)
|
|
}
|
|
|
|
export const useIsAwsCloudProvider = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const isAws = project?.cloud_provider === PROVIDERS.AWS.id
|
|
|
|
return isAws
|
|
}
|
|
|
|
export const useIsAwsK8sCloudProvider = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const isAwsK8s = project?.cloud_provider === PROVIDERS.AWS_K8S.id
|
|
|
|
return isAwsK8s
|
|
}
|
|
|
|
export const useIsAwsNimbusCloudProvider = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const isAwsNimbus = project?.cloud_provider === PROVIDERS.AWS_NIMBUS.id
|
|
|
|
return isAwsNimbus
|
|
}
|
|
|
|
export const useIsOrioleDb = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const isOrioleDb = project?.dbVersion?.endsWith('orioledb')
|
|
return isOrioleDb
|
|
}
|
|
|
|
export const useIsOrioleDbInAws = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const isOrioleDbInAws =
|
|
project?.dbVersion?.endsWith('orioledb') && project?.cloud_provider === PROVIDERS.AWS.id
|
|
return isOrioleDbInAws
|
|
}
|
|
|
|
export const useIsHighAvailability = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
return project?.high_availability ?? false
|
|
}
|
|
|
|
export const useIsProjectActive = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
return project?.status === PROJECT_STATUS.ACTIVE_HEALTHY
|
|
}
|