fix(ui): учитывать права и состояние устройства при откате истории

This commit is contained in:
Denozordec committed 2026-10-13 19:45:39 +07:00
1 parent 5ce20e8892
commit c8f9c83f45
17 files changed
+388 -16

No files matched your search

+4
View File
@@ -1,5 +1,7 @@
"use client"
import { can } from "@/lib/auth"
import { Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react"
import Link from "next/link"
import { useRouter, useSearchParams } from "next/navigation"
@@ -308,6 +310,7 @@ function WireGuardPageContent({ selectedServerId, selectedInterfaceId, allInterf
}, [isLive, historyServerId, backendUrl])
const restoreRevision = useCallback(async (id: string) => {
if (!can("mm:network:write")) throw new Error("Нет прав на изменение конфигурации")
if (!isLive || !historyServerId || restoreLock.current) return
restoreLock.current = true
setHistoryRestoring(true)
@@ -1022,6 +1025,7 @@ function WireGuardPageContent({ selectedServerId, selectedInterfaceId, allInterf
revisions={revisions}
loading={historyLoading}
restoring={historyRestoring}
restoreDisabled={!can("mm:network:write") || !isLive || !historyServerId || !displayServers.some(s => s.id === historyServerId && s.enabled) || loading || busy || deleteBusy || !!togglePending}
onRestore={restoreRevision}
/>
</>