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 { z } from "zod"
import { Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react"
import { useSearchParams } from "next/navigation"
@@ -295,6 +297,7 @@ function IpsecPage({ selectedServerId, setSelectedServerId, workspaceTab, setWor
}, [isLive, historyServerId, backendUrl])
const restoreRevision = async (id: string) => {
if (!can("mm:network:write")) throw new Error("Нет прав на изменение конфигурации")
if (!isLive || !historyServerId) return
beginOperation(historyServerId)
setHistoryRestoring(true)
@@ -969,6 +972,7 @@ function IpsecPage({ selectedServerId, setSelectedServerId, workspaceTab, setWor
revisions={revisions}
loading={historyLoading}
restoring={historyRestoring}
restoreDisabled={!can("mm:network:write") || !historyServerId || !canManage(historyServerId)}
onRestore={restoreRevision}
title="История конфигураций IPsec"
itemLabel="конфигурация"