fix(ui): подтверждать операции рекурсивных маршрутов

This commit is contained in:
Denozordec committed 2026-09-30 21:08:01 +07:00
1 parent 79a8d95e7d
commit f5fc9282e2
11 files changed
+364 -138

No files matched your search

+5 -3
View File
@@ -69,6 +69,7 @@ export function ConfigHistorySheet({
onRetry,
restoring,
onRestore,
restoreDisabled = false,
}: {
open: boolean
onOpenChange: (open: boolean) => void
@@ -79,6 +80,7 @@ export function ConfigHistorySheet({
loadError?: string | null
onRetry?: () => void
restoring: boolean
restoreDisabled?: boolean
onRestore: (id: string) => Promise<void> | void
}) {
const [pending, setPending] = useState<ConfigRevisionDto | null>(null)
@@ -87,7 +89,7 @@ export function ConfigHistorySheet({
const [restoreError, setRestoreError] = useState<string | null>(null)
const busy = restoring || submitting
async function confirmRestore() {
if (!pending || restoreLock.current || restoring) return
if (!pending || restoreLock.current || restoring || restoreDisabled) return
restoreLock.current = true
setSubmitting(true)
setRestoreError(null)
@@ -162,7 +164,7 @@ export function ConfigHistorySheet({
type="button"
variant="outline"
size="sm"
disabled={busy}
disabled={busy || restoreDisabled}
onClick={() => { setRestoreError(null); setPending(rev) }}
>
<RotateCcwIcon className="size-3.5" />
@@ -205,7 +207,7 @@ export function ConfigHistorySheet({
<AlertDialogFooter>
<AlertDialogCancel disabled={busy} onClick={() => setPending(null)}>Отмена</AlertDialogCancel>
<AlertDialogAction
disabled={busy || !pending}
disabled={busy || restoreDisabled || !pending}
type="button"
onClick={() => void confirmRestore()}
>