fix(ui): исключить конфликты восстановления Firewall
This commit is contained in:
1 parent
14f8b1ee9a
commit
92ba474ca9
6 files changed
+100
-7
No files matched your search
@@ -2025,7 +2025,9 @@ function FirewallPageInner() {
|
||||
}, [isLive, historyServerId, apiFetch])
|
||||
|
||||
const restoreRevision = useCallback(async (id: string) => {
|
||||
if (!isLive || !historyServerId) return
|
||||
if (!isLive || !historyServerId) throw new Error("Выберите устройство в режиме Live")
|
||||
if (mutationLock.current) throw new Error("Дождитесь завершения текущей операции Firewall")
|
||||
mutationLock.current = true
|
||||
setHistoryRestoring(true)
|
||||
try {
|
||||
const res = await apiFetch<{ ok: boolean }>(
|
||||
@@ -2039,6 +2041,7 @@ function FirewallPageInner() {
|
||||
} catch (err) {
|
||||
throw err
|
||||
} finally {
|
||||
mutationLock.current = false
|
||||
setHistoryRestoring(false)
|
||||
}
|
||||
}, [isLive, historyServerId, apiFetch, loadLive, loadRevisions])
|
||||
@@ -2492,8 +2495,8 @@ function FirewallPageInner() {
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => { void loadLive() }}
|
||||
disabled={!isLive || dataLoading}
|
||||
onClick={() => { if (!mutationLock.current) void loadLive() }}
|
||||
disabled={!isLive || dataLoading || busy || togglePending || deletePending || movePending || historyRestoring}
|
||||
title={!isLive ? "Включите Live в источнике данных" : "Обновить правила с устройств"}
|
||||
>
|
||||
<RefreshCwIcon className={cn("size-4", dataLoading && "animate-spin")} />
|
||||
@@ -2503,10 +2506,11 @@ function FirewallPageInner() {
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
if (mutationLock.current) return
|
||||
setHistoryOpen(true)
|
||||
void loadRevisions()
|
||||
}}
|
||||
disabled={!isLive || !historyServerId || dataLoading}
|
||||
disabled={!isLive || !historyServerId || dataLoading || busy || togglePending || deletePending || movePending || historyRestoring}
|
||||
title={!historyServerId ? "Выберите сервер, чтобы смотреть историю" : "История версий и откат на CHR"}
|
||||
>
|
||||
<HistoryIcon className="size-4" />
|
||||
|
||||
Reference in new issue
Block a user