mirror of
https://github.com/supabase/supabase.git
synced 2026-09-06 09:59:03 +08:00
## Context As per PR title, disables disk management for HA projects, which involves - Disabling "Increase disk size" CTAs in reports/database and the old disk config settings in database/settings - Disabling all input fields related to disk management in settings/infrastructure <img width="1076" height="857" alt="image" src="https://github.com/user-attachments/assets/bfbdfc36-8ae3-41ce-af12-c05b46e620f4" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added High Availability notices and restrictions throughout disk management settings. * Disabled disk size, IOPS, throughput, and autoscaling controls where High Availability limits changes. * Added explanatory tooltips for restricted disk-size actions. * Updated database observability controls to reflect High Availability restrictions. * **Accessibility** * Added an accessible label to the database observability refresh button. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { useMemo } from 'react'
|
|
|
|
import { MULTIGRES_SCHEMA_NAME, resolveHighAvailability } from './useHighAvailability.constants'
|
|
import { useIsHighAvailability, useSelectedProjectQuery } from './useSelectedProject'
|
|
|
|
export { MULTIGRES_SCHEMA_NAME, resolveHighAvailability }
|
|
|
|
export function useHighAvailability() {
|
|
const isHighAvailability = useIsHighAvailability()
|
|
const { isPending } = useSelectedProjectQuery()
|
|
|
|
return {
|
|
isHighAvailability,
|
|
isHighAvailabilityDisabled: !isHighAvailability,
|
|
isPending,
|
|
}
|
|
}
|
|
|
|
export function filterSchemasForHighAvailability<T extends { name: string }>(
|
|
schemas: T[],
|
|
isHighAvailability: boolean
|
|
) {
|
|
if (!isHighAvailability) return schemas
|
|
|
|
return schemas.filter((schema) => schema.name !== MULTIGRES_SCHEMA_NAME)
|
|
}
|
|
|
|
/**
|
|
* Memoized `filterSchemasForHighAvailability` bound to the selected project's
|
|
* high availability state.
|
|
*/
|
|
export function useSchemasFilteredForHighAvailability<T extends { name: string }>(
|
|
schemas: T[] | undefined
|
|
): T[] {
|
|
const { isHighAvailability } = useHighAvailability()
|
|
|
|
return useMemo(
|
|
() => filterSchemasForHighAvailability(schemas ?? [], isHighAvailability),
|
|
[schemas, isHighAvailability]
|
|
)
|
|
}
|