The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add alert dialog when toggling SSL enforcement (#41887)
Joshen Lim5c91e60811a5
diff --git a/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx b/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.tsxindex 140b5bd2f09..36d1028933d 100644--- a/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx+++ b/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx@@ -18,6 +18,15 @@ import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'import { DOCS_URL } from 'lib/constants'import {Alert,+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+ AlertDialogTrigger,Button,Card,CardContent,@@ -28,10 +37,10 @@ import {} from 'ui'import {PageSection,+ PageSectionContent,PageSectionMeta,PageSectionSummary,PageSectionTitle,- PageSectionContent,} from 'ui-patterns'import { FormLayout } from 'ui-patterns/form/Layout/FormLayout'@@ -117,40 +126,64 @@ const SSLConfiguration = () => {label="Enforce SSL on incoming connections"description="Reject non-SSL connections to your database">- <div className="flex items-center justify-end mt-2.5 space-x-2">- {(isLoading || isSubmitting) && (- <Loader2 className="animate-spin" strokeWidth={1.5} size={16} />- )}- {isSuccess && (- <Tooltip>- <TooltipTrigger asChild>- {/* [Joshen] Added div as tooltip is messing with data state property of toggle */}- <div>- <Switch- size="large"- checked={isEnforced}- disabled={- isLoading ||- isSubmitting ||- !canUpdateSSLEnforcement ||- !hasAccessToSSLEnforcement- }- onCheckedChange={toggleSSLEnforcement}- />- </div>- </TooltipTrigger>- {(!canUpdateSSLEnforcement || !hasAccessToSSLEnforcement) && (- <TooltipContent side="bottom" className="w-64 text-center">- {!canUpdateSSLEnforcement- ? 'You need additional permissions to update SSL enforcement for your project'- : !hasAccessToSSLEnforcement- ? 'Your project does not have access to SSL enforcement'- : undefined}- </TooltipContent>+ <AlertDialog>+ <AlertDialogTrigger asChild>+ <div className="flex items-center justify-end mt-2.5 space-x-2">+ {(isLoading || isSubmitting) && (+ <Loader2 className="animate-spin" strokeWidth={1.5} size={16} />)}- </Tooltip>- )}- </div>+ {isSuccess && (+ <Tooltip>+ <TooltipTrigger asChild>+ {/* [Joshen] Added div as tooltip is messing with data state property of toggle */}+ <div>+ <Switch+ size="large"+ checked={isEnforced}+ disabled={+ isLoading ||+ isSubmitting ||+ !canUpdateSSLEnforcement ||+ !hasAccessToSSLEnforcement+ }+ />+ </div>+ </TooltipTrigger>+ {(!canUpdateSSLEnforcement || !hasAccessToSSLEnforcement) && (+ <TooltipContent side="bottom" className="w-64 text-center">+ {!canUpdateSSLEnforcement+ ? 'You need additional permissions to update SSL enforcement for your project'+ : !hasAccessToSSLEnforcement+ ? 'Your project does not have access to SSL enforcement'+ : undefined}+ </TooltipContent>+ )}+ </Tooltip>+ )}+ </div>+ </AlertDialogTrigger>+ <AlertDialogContent size="medium">+ <AlertDialogHeader>+ <AlertDialogTitle>+ Updating SSL enforcement involves a brief downtime+ </AlertDialogTitle>+ <AlertDialogDescription>+ A database restart is required for SSL enforcement changes to take place, and+ this involves a few minutes of downtime. Confirm to proceed now?+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel disabled={isSubmitting}>Cancel</AlertDialogCancel>+ <AlertDialogAction+ variant="warning"+ disabled={isSubmitting}+ onClick={toggleSSLEnforcement}+ >+ {!isEnforced ? 'Enable SSL' : 'Disable SSL'}+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog></FormLayout>{isSuccess && !sslEnforcementConfiguration?.appliedSuccessfully && (<Alert