Skip to content

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

Improve disabled state + add docs link for SSL

Joshen Limf6bdc0e37989
diff --git a/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx b/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx
index d43cee3453e..b53c71fe425 100644
--- a/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx
+++ b/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx
@@ -1,7 +1,7 @@
import Link from 'next/link'
import { useState, useEffect } from 'react'
import * as Tooltip from '@radix-ui/react-tooltip'
-import { Button, IconDownload, Toggle, IconLoader, Alert } from 'ui'
+import { Button, IconDownload, Toggle, IconLoader, Alert, IconExternalLink } from 'ui'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { checkPermissions, useStore, useFlag } from 'hooks'
@@ -73,7 +73,7 @@ const SSLConfiguration = () => {
<div>
<div className="flex items-center justify-between">
<FormHeader title="SSL Configuration" description="" />
- {/* <div className="flex items-center space-x-2 mb-6">
+ <div className="flex items-center space-x-2 mb-6">
<Link href="https://supabase.com/docs/guides/platform/ssl-enforcement">
<a target="_blank">
<Button type="default" icon={<IconExternalLink />}>
@@ -81,10 +81,10 @@ const SSLConfiguration = () => {
</Button>
</a>
</Link>
- </div> */}
+ </div>
</div>
<FormPanel>
- {sslEnforcement && hasAccessToSSLEnforcement && (
+ {sslEnforcement && (
<FormSection
header={
<FormSectionLabel
@@ -121,11 +121,41 @@ const SSLConfiguration = () => {
{(isLoading || isSubmitting) && (
<IconLoader className="animate-spin" strokeWidth={1.5} size={16} />
)}
- <Toggle
- checked={isEnforced}
- disabled={isLoading || isSubmitting || !canUpdateSSLEnforcement}
- onChange={toggleSSLEnforcement}
- />
+ <Tooltip.Root delayDuration={0}>
+ <Tooltip.Trigger>
+ <Toggle
+ checked={isEnforced}
+ disabled={
+ isLoading ||
+ isSubmitting ||
+ !canUpdateSSLEnforcement ||
+ !hasAccessToSSLEnforcement
+ }
+ onChange={toggleSSLEnforcement}
+ />
+ </Tooltip.Trigger>
+ {(!canUpdateSSLEnforcement || !hasAccessToSSLEnforcement) && (
+ <Tooltip.Portal>
+ <Tooltip.Content align="center" side="bottom">
+ <Tooltip.Arrow className="radix-tooltip-arrow" />
+ <div
+ className={[
+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
+ 'border border-scale-200 w-[250px]',
+ ].join(' ')}
+ >
+ <span className="text-xs text-scale-1200 text-center flex items-center justify-center">
+ {!canUpdateSSLEnforcement
+ ? 'You need additional permissions to update SSL enforcement for your project'
+ : !hasAccessToSSLEnforcement
+ ? 'Your project does not have access to SSL enforcement'
+ : ''}
+ </span>
+ </div>
+ </Tooltip.Content>
+ </Tooltip.Portal>
+ )}
+ </Tooltip.Root>
</div>
</FormSectionContent>
</FormSection>