diff --git a/apps/studio/components/interfaces/Settings/General/Infrastructure/Infrastructure.tsx b/apps/studio/components/interfaces/Settings/General/Infrastructure/Infrastructure.tsx index 44063957396..df601a1124c 100644 --- a/apps/studio/components/interfaces/Settings/General/Infrastructure/Infrastructure.tsx +++ b/apps/studio/components/interfaces/Settings/General/Infrastructure/Infrastructure.tsx @@ -1,9 +1,9 @@ import * as Tooltip from '@radix-ui/react-tooltip' +import { useParams } from 'common' import { observer } from 'mobx-react-lite' import Link from 'next/link' import { Alert, Badge, Button, IconPackage, Input } from 'ui' -import { useParams } from 'common/hooks' import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext' import { FormHeader, @@ -13,11 +13,11 @@ import { FormSectionLabel, } from 'components/ui/Forms' import { useProjectUpgradeEligibilityQuery } from 'data/config/project-upgrade-eligibility-query' -import { useFlag, useSelectedOrganization } from 'hooks' +import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query' +import { useSelectedOrganization } from 'hooks' import PauseProjectButton from './PauseProjectButton' import ProjectUpgradeAlert from './ProjectUpgradeAlert' import RestartServerButton from './RestartServerButton' -import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query' interface InfrastructureProps {} @@ -41,7 +41,6 @@ const Infrastructure = ({}: InfrastructureProps) => { const currentPgVersion = (current_app_version ?? '').split('supabase-postgres-')[1] const latestPgVersion = (latest_app_version ?? '').split('supabase-postgres-')[1] - const showDbUpgrades = useFlag('databaseUpgrades') const subject = 'Request%20for%20Postgres%20upgrade%20for%20project' const message = `Upgrade information:%0A• Manual intervention reason: ${requires_manual_intervention}` @@ -125,8 +124,8 @@ const Infrastructure = ({}: InfrastructureProps) => { ), ]} /> - {showDbUpgrades && data?.eligible && } - {showDbUpgrades && !data?.eligible && data?.requires_manual_intervention && ( + {data?.eligible && } + {!data?.eligible && data?.requires_manual_intervention && ( } variant="neutral" diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx index 205318470e5..8175dd819cc 100644 --- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx +++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx @@ -1,7 +1,15 @@ import * as Tooltip from '@radix-ui/react-tooltip' -import Link from 'next/link' - import { useParams } from 'common' +import Link from 'next/link' +import { + AlertDescription_Shadcn_, + AlertTitle_Shadcn_, + Alert_Shadcn_, + Badge, + Button, + Input, +} from 'ui' + import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext' import { ScaffoldContainer, @@ -15,14 +23,6 @@ import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader' import { useProjectUpgradeEligibilityQuery } from 'data/config/project-upgrade-eligibility-query' import { useReadReplicasQuery } from 'data/read-replicas/replicas-query' import { useFlag, useIsFeatureEnabled } from 'hooks' -import { - AlertDescription_Shadcn_, - AlertTitle_Shadcn_, - Alert_Shadcn_, - Badge, - Button, - Input, -} from 'ui' import ProjectUpgradeAlert from '../General/Infrastructure/ProjectUpgradeAlert' import InstanceConfiguration from './InfrastructureConfiguration/InstanceConfiguration' @@ -47,7 +47,6 @@ const InfrastructureInfo = () => { const currentPgVersion = (current_app_version ?? '').split('supabase-postgres-')[1] const latestPgVersion = (latest_app_version ?? '').split('supabase-postgres-')[1] - const showDbUpgrades = useFlag('databaseUpgrades') const readReplicasEnabled = useFlag('readReplicas') const showReadReplicasUI = readReplicasEnabled && project?.is_read_replicas_enabled const hasReadReplicas = (databases ?? []).length > 1 @@ -155,8 +154,8 @@ const InfrastructureInfo = () => { ), ]} /> - {showDbUpgrades && data?.eligible && !hasReadReplicas && } - {showDbUpgrades && data.eligible && hasReadReplicas && ( + {data?.eligible && !hasReadReplicas && } + {data.eligible && hasReadReplicas && ( A new version of Postgres is available for your project @@ -167,7 +166,7 @@ const InfrastructureInfo = () => { )} - {showDbUpgrades && !data?.eligible && data?.requires_manual_intervention && ( + {!data?.eligible && data?.requires_manual_intervention && ( A new version of Postgres is available for your project @@ -189,49 +188,47 @@ const InfrastructureInfo = () => { )} - {showDbUpgrades && - !data?.eligible && - (data?.extension_dependent_objects || []).length > 0 && ( - - New version of Postgres available - -
-

- This project cannot be upgraded due to the following extension dependent - objects: -

- -
    - {(data?.extension_dependent_objects || []).map((obj) => ( -
  • - {obj} -
  • - ))} -
-
-

- Once the above objects are exported and removed, you can proceed to - upgrade your project, and re-import the objects after the upgrade - operation is complete. Please refer to the docs on additional extensions - that might also need to be dropped. + {!data?.eligible && (data?.extension_dependent_objects || []).length > 0 && ( + + New version of Postgres available + +

+

+ This project cannot be upgraded due to the following extension dependent + objects:

-
- -
- - - )} + +
    + {(data?.extension_dependent_objects || []).map((obj) => ( +
  • + {obj} +
  • + ))} +
+
+

+ Once the above objects are exported and removed, you can proceed to upgrade + your project, and re-import the objects after the upgrade operation is + complete. Please refer to the docs on additional extensions that might also + need to be dropped. +

+
+ +
+
+
+ )} )} diff --git a/apps/studio/components/ui/ProjectUpgradeFailedBanner.tsx b/apps/studio/components/ui/ProjectUpgradeFailedBanner.tsx index 3acd4028082..9b1cfe5fee3 100644 --- a/apps/studio/components/ui/ProjectUpgradeFailedBanner.tsx +++ b/apps/studio/components/ui/ProjectUpgradeFailedBanner.tsx @@ -1,18 +1,17 @@ +import { DatabaseUpgradeStatus } from '@supabase/shared-types/out/events' +import { useParams } from 'common' import dayjs from 'dayjs' import Link from 'next/link' import { useState } from 'react' import { Alert, Button, IconX } from 'ui' -import { useParams } from 'common/hooks' -import { IS_PLATFORM } from 'lib/constants' + import { useProjectUpgradingStatusQuery } from 'data/config/project-upgrade-status-query' -import { DatabaseUpgradeStatus } from '@supabase/shared-types/out/events' -import { useFlag } from 'hooks' +import { IS_PLATFORM } from 'lib/constants' // [Joshen] Think twice about the category though - it doesn't correspond const ProjectUpgradeFailedBanner = () => { const { ref } = useParams() - const showDbUpgrades = useFlag('databaseUpgrades') const { data } = useProjectUpgradingStatusQuery({ projectRef: ref }, { enabled: IS_PLATFORM }) const { status, initiated_at, error } = data?.databaseUpgradeStatus ?? {} @@ -35,7 +34,7 @@ const ProjectUpgradeFailedBanner = () => { localStorage.setItem(key, 'true') } - if (!isFailed || !showMessage || !showDbUpgrades) return null + if (!isFailed || !showMessage) return null return (