Skip to content

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

Shift alert into modal when resetting jwt

Joshen Lim48c020f818fe
diff --git a/studio/components/interfaces/Settings/API/JWTSettings.tsx b/studio/components/interfaces/Settings/API/JWTSettings.tsx
index d0f8b0fb44f..932ef7158d8 100644
--- a/studio/components/interfaces/Settings/API/JWTSettings.tsx
+++ b/studio/components/interfaces/Settings/API/JWTSettings.tsx
@@ -8,9 +8,13 @@ import {
import { Dispatch, SetStateAction, useState } from 'react'
import {
Alert,
+ AlertDescription_Shadcn_,
+ AlertTitle_Shadcn_,
+ Alert_Shadcn_,
Button,
Dropdown,
IconAlertCircle,
+ IconAlertTriangle,
IconChevronDown,
IconEye,
IconEyeOff,
@@ -23,7 +27,7 @@ import {
} from 'ui'
import { useParams } from 'common/hooks'
-import ConfirmModal from 'components/ui/Dialogs/ConfirmDialog'
+import ConfirmationModal from 'components/ui/ConfirmationModal'
import Panel from 'components/ui/Panel'
import { useJwtSecretUpdateMutation } from 'data/config/jwt-secret-update-mutation'
import { useJwtSecretUpdatingStatusQuery } from 'data/config/jwt-secret-updating-status-query'
@@ -200,36 +204,40 @@ const JWTSettings = () => {
Change tracking ID: {data?.changeTrackingId} <br />
Error message: {jwtSecretUpdateErrorMessage}
</Alert>
- ) : canGenerateNewJWTSecret ? (
- <Alert
- withIcon
- variant="warning"
- title="This will invalidate all existing API keys!"
- >
- Generating a new JWT secret will invalidate <u>all</u> of your API keys,
- including your <code>service_role</code> and <code>anon</code> keys. Your
- project will also be restarted during this process, which will terminate any
- existing connections.
- </Alert>
- ) : (
- <></>
- )}
+ ) : null}
</div>
</>
)}
</Panel.Content>
</Panel>
- <ConfirmModal
+
+ <ConfirmationModal
danger
+ size="medium"
visible={isRegeneratingKey}
- title="Are you absolutely sure?"
- description="This action cannot be undone and the old JWT secret will be lost. All existing API keys
- will be invalidated, and any open connections will be terminated."
+ header="Confirm to generate a new JWT secret"
buttonLabel="Generate new secret"
buttonLoadingLabel="Generating"
onSelectCancel={() => setIsGeneratingKey(false)}
onSelectConfirm={() => handleJwtSecretUpdate('ROLL', setIsGeneratingKey)}
- />
+ >
+ <Modal.Content className="py-4 space-y-4">
+ <Alert_Shadcn_ variant="warning">
+ <IconAlertTriangle />
+ <AlertTitle_Shadcn_>This will invalidate all existing API keys</AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
+ Generating a new JWT secret will invalidate <u className="text">all</u> of your API
+ keys, including your <code className="text-xs">service_role</code> and{' '}
+ <code className="text-xs">anon</code> keys. Your project will also be restarted during
+ this process, which will terminate any existing connections.
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
+ <p className="text text-sm">
+ This action cannot be undone and the old JWT secret will be lost. All existing API keys
+ will be invalidated, and any open connections will be terminated.
+ </p>
+ </Modal.Content>
+ </ConfirmationModal>
<Modal
closable
@@ -262,11 +270,16 @@ const JWTSettings = () => {
Create a custom JWT secret. Make sure it is a strong combination of characters that
cannot be guessed easily.
</p>
- <Alert
- withIcon
- variant="warning"
- title="All existing API keys will be invalidated, and any open connections will be terminated."
- />
+ <Alert_Shadcn_ variant="warning">
+ <IconAlertTriangle />
+ <AlertTitle_Shadcn_>This will invalidate all existing API keys</AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
+ Generating a new JWT secret will invalidate <u className="text">all</u> of your API
+ keys, including your <code className="text-xs">service_role</code> and{' '}
+ <code className="text-xs">anon</code> keys. Your project will also be restarted
+ during this process, which will terminate any existing connections.
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
<Input
onChange={(e: any) => setCustomToken(e.target.value)}
value={customToken}