import { useFlag, useParams } from 'common' import { NoticeBar } from 'components/interfaces/DiskManagement/ui/NoticeBar' import { ScaffoldContainer, ScaffoldDivider, ScaffoldSection, ScaffoldSectionContent, ScaffoldSectionDetail, } from 'components/layouts/Scaffold' import AlertError from 'components/ui/AlertError' import { useProjectUpgradeEligibilityQuery } from 'data/config/project-upgrade-eligibility-query' import { useProjectServiceVersionsQuery } from 'data/projects/project-service-versions' import { useReadReplicasQuery } from 'data/read-replicas/replicas-query' import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled' import { useIsOrioleDb, useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import Link from 'next/link' import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Badge, Button, Input, Tooltip, TooltipContent, TooltipTrigger, } from 'ui' import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader' import { ProjectUpgradeAlert } from '../General/Infrastructure/ProjectUpgradeAlert' import { InstanceConfiguration } from './InfrastructureConfiguration/InstanceConfiguration' import { ObjectsToBeDroppedWarning, ReadReplicasWarning, UnsupportedExtensionsWarning, UserDefinedObjectsInInternalSchemasWarning, } from './UpgradeWarnings' const InfrastructureInfo = () => { const { ref } = useParams() const { data: project } = useSelectedProjectQuery() const unifiedReplication = useFlag('unifiedReplication') const { projectAuthAll: authEnabled, projectSettingsDatabaseUpgrades: showDatabaseUpgrades } = useIsFeatureEnabled(['project_auth:all', 'project_settings:database_upgrades']) const { data, error, isPending: isLoadingUpgradeEligibility, isError: isErrorUpgradeEligibility, isSuccess: isSuccessUpgradeEligibility, } = useProjectUpgradeEligibilityQuery({ projectRef: ref, }) const { data: serviceVersions, error: serviceVersionsError, isPending: isLoadingServiceVersions, isError: isErrorServiceVersions, isSuccess: isSuccessServiceVersions, } = useProjectServiceVersionsQuery({ projectRef: ref }) const { data: databases } = useReadReplicasQuery({ projectRef: ref }) const { current_app_version, current_app_version_release_channel, latest_app_version } = data || {} const isOnLatestVersion = current_app_version === latest_app_version const currentPgVersion = (current_app_version ?? '') .split('supabase-postgres-')[1] ?.replace('-orioledb', '') const isVisibleReleaseChannel = current_app_version_release_channel && !['ga', 'withdrawn'].includes(current_app_version_release_channel) ? current_app_version_release_channel : undefined const isOrioleDb = useIsOrioleDb() const latestPgVersion = (latest_app_version ?? '').split('supabase-postgres-')[1] const isInactive = project?.status === 'INACTIVE' const hasReadReplicas = (databases ?? []).length > 1 const hasObjectsToBeDropped = (data?.objects_to_be_dropped ?? []).length > 0 const hasUnsupportedExtensions = (data?.unsupported_extensions || []).length > 0 const hasObjectsInternalSchema = (data?.user_defined_objects_in_internal_schemas || []).length > 0 return ( <> {project?.cloud_provider !== 'FLY' && (unifiedReplication ? ( Go to Replication } /> ) : ( <> ))}

Service Versions

Service versions and upgrade eligibility for your provisioned instance.

{isInactive ? ( Service versions cannot be retrieved while project is paused Restoring the project will update Postgres to the newest version ) : ( <> {/* [Joshen] Double check why we need this waterfall loading behaviour here */} {isLoadingUpgradeEligibility && } {isErrorUpgradeEligibility && ( )} {isSuccessUpgradeEligibility && ( <> {isLoadingServiceVersions && } {isErrorServiceVersions && ( )} {isSuccessServiceVersions && ( <> {authEnabled && ( )} {isVisibleReleaseChannel} This project uses a {isVisibleReleaseChannel} database version release ), isOrioleDb && ( OrioleDB This project uses OrioleDB ), isOnLatestVersion && ( Latest Project is on the latest version of Postgres that Supabase supports ), ]} /> )} {showDatabaseUpgrades && data.eligible ? ( hasReadReplicas ? ( ) : ( ) ) : null} {showDatabaseUpgrades && !data.eligible ? ( hasObjectsToBeDropped ? ( ) : hasUnsupportedExtensions ? ( ) : hasObjectsInternalSchema ? ( ) : null ) : null} )} )}
) } export default InfrastructureInfo