mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 18:00:20 -04:00
e4c50cefce
- Created DuplicateSecretWarningModal component following the pattern of DeployEdgeFunctionWarningModal - Added duplicate key detection logic to AddNewSecretForm before secret creation - Shows confirmation dialog when attempting to create a secret with an existing name - Allows users to proceed with replacing the existing secret or cancel the operation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
37 lines
990 B
TypeScript
37 lines
990 B
TypeScript
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
|
|
|
|
interface DuplicateSecretWarningModalProps {
|
|
visible: boolean
|
|
onCancel: () => void
|
|
onConfirm: () => void
|
|
isCreating: boolean
|
|
secretName: string
|
|
}
|
|
|
|
export const DuplicateSecretWarningModal = ({
|
|
visible,
|
|
onCancel,
|
|
onConfirm,
|
|
isCreating,
|
|
secretName,
|
|
}: DuplicateSecretWarningModalProps) => {
|
|
return (
|
|
<ConfirmationModal
|
|
visible={visible}
|
|
size="medium"
|
|
title="Confirm replacing existing secret"
|
|
confirmLabel="Replace secret"
|
|
confirmLabelLoading="Replacing secret"
|
|
variant="warning"
|
|
loading={isCreating}
|
|
onCancel={onCancel}
|
|
onConfirm={onConfirm}
|
|
>
|
|
<p className="text-sm text-foreground-light">
|
|
A secret with the name "{secretName}" already exists. Continuing will replace the existing
|
|
secret with the new value. This action cannot be undone. Are you sure you want to proceed?
|
|
</p>
|
|
</ConfirmationModal>
|
|
)
|
|
}
|