mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 06:39:09 +03:00
* add edge function knowledge * deploy edge function mutaton * add edge function block with deploy * update function url * update tools * editor sql * add templates * use monaco editor * hook up templates * fixes * add behind feature flag * preview docs * move editor * initialPrompt * consolidate widgets * remove generic editor * move logic * fix ts * include schema metadata * Fix width of save snippet button * Set tooltip position * Use inlineLink component * Remove unnecessary z index * Lint * Lint import statements in EditorPanel * fixes * fix keyboard shortcut * show/hide results and invalidation * fix focus issues in widget * fixes * fix ts * Support cmd enter shortcut to run query in InlineEditor * Update InlineEditorPreview to use admonition * prompt updates * add discussion url to preview * schemas array * One last clean up --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { Button } from 'ui'
|
|
import { Admonition } from 'ui-patterns'
|
|
|
|
export interface SqlWarningAdmonitionProps {
|
|
warningType: 'hasWriteOperation' | 'hasUnknownFunctions'
|
|
onCancel: () => void
|
|
onConfirm: () => void
|
|
disabled?: boolean
|
|
className?: string
|
|
}
|
|
|
|
const SqlWarningAdmonition = ({
|
|
warningType,
|
|
onCancel,
|
|
onConfirm,
|
|
disabled = false,
|
|
className,
|
|
}: SqlWarningAdmonitionProps) => {
|
|
return (
|
|
<Admonition
|
|
type="warning"
|
|
className={`mb-0 rounded-none border-0 shrink-0 bg-background-100 ${className}`}
|
|
>
|
|
<p>
|
|
{warningType === 'hasWriteOperation'
|
|
? 'This query contains write operations.'
|
|
: 'This query involves running a function.'}{' '}
|
|
Are you sure you want to execute it?
|
|
</p>
|
|
<p className="text-foreground-light">
|
|
Make sure you are not accidentally removing something important.
|
|
</p>
|
|
<div className="flex justify-stretch mt-2 gap-2">
|
|
<Button type="outline" size="tiny" className="w-full flex-1" onClick={onCancel}>
|
|
Cancel
|
|
</Button>
|
|
<Button
|
|
type="danger"
|
|
size="tiny"
|
|
disabled={disabled}
|
|
className="w-full flex-1"
|
|
onClick={onConfirm}
|
|
>
|
|
Run
|
|
</Button>
|
|
</div>
|
|
</Admonition>
|
|
)
|
|
}
|
|
|
|
export default SqlWarningAdmonition
|