mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 09:50:33 -04:00
d8f8d9a1f3
**Old** <img width="1376" height="1115" alt="image" src="https://github.com/user-attachments/assets/75703b14-f066-491e-8d5a-b68a716fa081" /> **New** <img width="1374" height="678" alt="image" src="https://github.com/user-attachments/assets/538830be-a8bf-40c8-97dc-2c6085d500c7" /> This updates the add-ons design to remove the Compute Size section which has now been moved and simplify the add-on list design.
117 lines
2.4 KiB
TypeScript
117 lines
2.4 KiB
TypeScript
export interface IPv4DisabledReasonOptions {
|
|
isAws: boolean
|
|
isProjectActive: boolean
|
|
projectUpdateDisabled: boolean
|
|
canUpdateIPv4: boolean
|
|
ipv4Enabled: boolean
|
|
}
|
|
|
|
export const getIPv4DisabledReason = ({
|
|
isAws,
|
|
isProjectActive,
|
|
projectUpdateDisabled,
|
|
canUpdateIPv4,
|
|
ipv4Enabled,
|
|
}: IPv4DisabledReasonOptions) => {
|
|
if (!isAws) {
|
|
return 'Dedicated IPv4 address is only available for AWS projects'
|
|
}
|
|
|
|
if (!isProjectActive) {
|
|
return 'Project must be active to update IPv4'
|
|
}
|
|
|
|
if (projectUpdateDisabled) {
|
|
return 'Project updates are currently disabled'
|
|
}
|
|
|
|
if (!canUpdateIPv4 && !ipv4Enabled) {
|
|
return 'You can only add IPv4 when your project network configuration is set to IPv6'
|
|
}
|
|
|
|
return undefined
|
|
}
|
|
|
|
export interface PitrDisabledReasonOptions {
|
|
isProjectActive: boolean
|
|
projectUpdateDisabled: boolean
|
|
hasHipaaAddon: boolean
|
|
sufficientPgVersion: boolean
|
|
isOrioleDbInAws: boolean
|
|
}
|
|
|
|
export const getPitrDisabledReason = ({
|
|
isProjectActive,
|
|
projectUpdateDisabled,
|
|
hasHipaaAddon,
|
|
sufficientPgVersion,
|
|
isOrioleDbInAws,
|
|
}: PitrDisabledReasonOptions) => {
|
|
if (!isProjectActive) {
|
|
return 'Project must be active to update PITR'
|
|
}
|
|
|
|
if (projectUpdateDisabled) {
|
|
return 'Project updates are currently disabled'
|
|
}
|
|
|
|
if (hasHipaaAddon) {
|
|
return 'PITR cannot be changed with HIPAA enabled'
|
|
}
|
|
|
|
if (!sufficientPgVersion) {
|
|
return 'Your project is too old to enable PITR'
|
|
}
|
|
|
|
if (isOrioleDbInAws) {
|
|
return 'Point in time recovery is not supported with OrioleDB'
|
|
}
|
|
|
|
return undefined
|
|
}
|
|
|
|
export interface CustomDomainDisabledReasonOptions {
|
|
isProjectActive: boolean
|
|
projectUpdateDisabled: boolean
|
|
}
|
|
|
|
export const getCustomDomainDisabledReason = ({
|
|
isProjectActive,
|
|
projectUpdateDisabled,
|
|
}: CustomDomainDisabledReasonOptions) => {
|
|
if (!isProjectActive) {
|
|
return 'Project must be active to update custom domain'
|
|
}
|
|
|
|
if (projectUpdateDisabled) {
|
|
return 'Project updates are currently disabled'
|
|
}
|
|
|
|
return undefined
|
|
}
|
|
|
|
export type PitrAlertState = 'hipaa' | 'legacy-project' | 'orioledb' | undefined
|
|
|
|
export const getPitrAlertState = ({
|
|
hasHipaaAddon,
|
|
sufficientPgVersion,
|
|
isOrioleDbInAws,
|
|
}: Pick<
|
|
PitrDisabledReasonOptions,
|
|
'hasHipaaAddon' | 'sufficientPgVersion' | 'isOrioleDbInAws'
|
|
>) => {
|
|
if (hasHipaaAddon) {
|
|
return 'hipaa'
|
|
}
|
|
|
|
if (!sufficientPgVersion) {
|
|
return 'legacy-project'
|
|
}
|
|
|
|
if (isOrioleDbInAws) {
|
|
return 'orioledb'
|
|
}
|
|
|
|
return undefined
|
|
}
|