fix(ui): учитывать права и состояние устройства при откате истории
This commit is contained in:
1 parent
5ce20e8892
commit
c8f9c83f45
17 files changed
+388
-16
No files matched your search
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { can } from "@/lib/auth"
|
||||
|
||||
import { Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react"
|
||||
import { useSearchParams } from "next/navigation"
|
||||
import { PageHeader } from "@/components/page-header"
|
||||
@@ -2040,6 +2042,7 @@ function FirewallPageInner() {
|
||||
}, [isLive, historyServerId, apiFetch])
|
||||
|
||||
const restoreRevision = useCallback(async (id: string) => {
|
||||
if (!can("mm:network:write")) throw new Error("Нет прав на изменение конфигурации")
|
||||
if (!isLive || !historyServerId) throw new Error("Выберите устройство в режиме Live")
|
||||
if (mutationLock.current) throw new Error("Дождитесь завершения текущей операции Firewall")
|
||||
if (!readTrusted) throw new Error("Обновите актуальные данные Firewall перед восстановлением")
|
||||
@@ -2837,6 +2840,7 @@ function FirewallPageInner() {
|
||||
revisions={revisions}
|
||||
loading={historyLoading}
|
||||
restoring={historyRestoring}
|
||||
restoreDisabled={!can("mm:network:write") || !isLive || !writeServer?.enabled || !readTrusted || failures.some(f => f.serverId === historyServerId) || dataLoading || busy || historyRestoring}
|
||||
onRestore={restoreRevision}
|
||||
/>
|
||||
</>
|
||||
|
||||
Reference in new issue
Block a user