Files
supabase/apps/studio/components/interfaces/Functions/EdgeFunctionSecrets/DuplicateSecretWarningModal.tsx
Lakshan Perera e4c50cefce feat: Add duplicate key check with confirmation dialog for Edge Function secrets (#36793)
- 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>
2025-07-01 19:15:39 +10:00

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>
)
}