Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Only show Connect UI in layout header if project is active healthy (#32698)

Joshen Lim2781fb928509
diff --git a/apps/studio/components/interfaces/Connect/Connect.tsx b/apps/studio/components/interfaces/Connect/Connect.tsx
index a5820b3a910..1d125531190 100644
--- a/apps/studio/components/interfaces/Connect/Connect.tsx
+++ b/apps/studio/components/interfaces/Connect/Connect.tsx
@@ -5,9 +5,12 @@ import { parseAsBoolean, useQueryState } from 'nuqs'
import { useState } from 'react'
import { DatabaseConnectionString } from 'components/interfaces/Connect/DatabaseConnectionString'
+import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import Panel from 'components/ui/Panel'
import { getAPIKeys, useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
+import { useSelectedProject } from 'hooks/misc/useSelectedProject'
+import { PROJECT_STATUS } from 'lib/constants'
import {
Button,
DIALOG_PADDING_X,
@@ -31,6 +34,8 @@ import ConnectTabContent from './ConnectTabContent'
const Connect = () => {
const { ref: projectRef } = useParams()
+ const selectedProject = useSelectedProject()
+ const isActiveHealthy = selectedProject?.status === PROJECT_STATUS.ACTIVE_HEALTHY
const [showConnect, setShowConnect] = useQueryState(
'showConnect',
@@ -147,6 +152,25 @@ const Connect = () => {
selectedGrandchild,
})
+ if (!isActiveHealthy) {
+ return (
+ <ButtonTooltip
+ disabled
+ type="default"
+ className="rounded-full"
+ icon={<Plug className="rotate-90" />}
+ tooltip={{
+ content: {
+ side: 'bottom',
+ text: 'Project is currently not active and cannot be connected',
+ },
+ }}
+ >
+ Connect
+ </ButtonTooltip>
+ )
+ }
+
return (
<Dialog open={showConnect} onOpenChange={(open) => setShowConnect(!open ? null : open)}>
<DialogTrigger asChild>