Files
supabase/apps/studio/components/interfaces/Settings/Database/SSLEnforcementConfirmDialog.tsx
Etienne Stalmans 51c5b9f013 chore: sync ssl enforcement and temporary access (#48743)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Chore - fix-up

## What is the current behavior?

Temporary access depends on ssl enforcement. The frontend doesn't
enforce this very well or keep state between the two configs.

## What is the new behavior?

This updates the two configs to be interdependent and updates to each
one triggers a frontend state change on the other.

## Additional context

Before:



https://github.com/user-attachments/assets/8f040b62-587c-4268-9e27-27dd09b052a3



After:



https://github.com/user-attachments/assets/c62e006e-6147-4c94-b6cf-375ca300b890



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added confirmation dialogs and downtime warnings before changing
database SSL enforcement.
- Added loading states and success or failure notifications for SSL
updates.
- Enabled SSL enforcement directly from temporary database access
settings.

- **Bug Fixes**
- Prevented SSL enforcement from being disabled while temporary database
access is enabled.
  - Improved settings refresh after SSL enforcement changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-08-06 10:52:37 +02:00

47 lines
1.4 KiB
TypeScript

import { type PropsWithChildren } from 'react'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from 'ui'
interface SSLEnforcementConfirmDialogProps {
isTargetEnforced: boolean
isSubmitting: boolean
onConfirm: () => Promise<void>
}
export const SSLEnforcementConfirmDialog = ({
isTargetEnforced,
isSubmitting,
onConfirm,
children,
}: PropsWithChildren<SSLEnforcementConfirmDialogProps>) => {
return (
<AlertDialog>
<AlertDialogTrigger asChild>{children}</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={onConfirm}>
{isTargetEnforced ? 'Enable SSL' : 'Disable SSL'}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)
}