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, useRef, useMemo, useState } from "react"
|
||||
import Link from "next/link"
|
||||
import { useRouter, useSearchParams } from "next/navigation"
|
||||
@@ -294,6 +296,7 @@ function GrePageContent({ selectedServerId, selectedTunnelId, allTunnelsHref, on
|
||||
}, [isLive, historyServerId, apiFetch])
|
||||
|
||||
const restoreRevision = async (id: string) => {
|
||||
if (!can("mm:network:write")) throw new Error("Нет прав на изменение конфигурации")
|
||||
if (!historyServerId || !beginOperation(historyServerId)) throw new Error("Устройство не готово к восстановлению GRE")
|
||||
setHistoryRestoring(true)
|
||||
try {
|
||||
@@ -934,6 +937,7 @@ function GrePageContent({ selectedServerId, selectedTunnelId, allTunnelsHref, on
|
||||
revisions={revisions}
|
||||
loading={historyLoading}
|
||||
restoring={historyRestoring}
|
||||
restoreDisabled={!can("mm:network:write") || !historyServerId || !canManage(historyServerId)}
|
||||
onRestore={restoreRevision}
|
||||
/>
|
||||
|
||||
|
||||
Reference in new issue
Block a user