fix(ui): учитывать ошибки устройств в сводке туннелей
This commit is contained in:
1 parent
9d3129372b
commit
55c9349677
10 files changed
+56
-33
No files matched your search
@@ -15,7 +15,6 @@ import {
|
||||
import { useDataSource } from "@/lib/data-source"
|
||||
import { requestJson } from "@/shared/api/http-client"
|
||||
import { listEvents } from "@/shared/api/events"
|
||||
import { listWireGuard } from "@/shared/api/wireguard"
|
||||
import type { EventItem } from "@mmapp/contracts/events"
|
||||
import { buildLatencySeriesByProbeSource } from "@/lib/dashboard-latency"
|
||||
import {
|
||||
@@ -29,6 +28,7 @@ import type { FiltersRulesetRow, RouteOptimizerSpeedProbe } from "@/lib/route-op
|
||||
import { updateDashboardSource, type DashboardSource, type DashboardSources } from "@/lib/dashboard-source-state"
|
||||
|
||||
import {can,ensureAuthConfig} from "@/lib/auth"
|
||||
import {parseDashboardGre,parseDashboardWireGuard,parseDashboardVxlan,type DashboardGreTunnel} from "@/lib/dashboard-overlays"
|
||||
import type {DashboardProbe} from "@/lib/dashboard-probes"
|
||||
import {parseDashboardServers,parseDashboardProbes,type DashboardServerRow} from "@/lib/dashboard-readers"
|
||||
import {parseDashboardTraffic,type DashboardTraffic} from "@/lib/dashboard-traffic"
|
||||
@@ -63,26 +63,7 @@ function readMockDashboardStarIds(): Set<string> {
|
||||
|
||||
type BackendServerRow=DashboardServerRow
|
||||
|
||||
interface ApiGreTunnelRow {
|
||||
id: string
|
||||
name: string
|
||||
serverId: string
|
||||
localAddress: string
|
||||
remoteAddress: string
|
||||
localInnerIp: string
|
||||
remoteInnerIp: string
|
||||
poolId: string
|
||||
ipsec: null
|
||||
mtu: number
|
||||
keepaliveInterval: number
|
||||
keepaliveRetries: number
|
||||
dscp: "inherit" | number
|
||||
clampTcpMss: boolean
|
||||
allowFastPath: boolean
|
||||
comment: string
|
||||
enabled: boolean
|
||||
status: "up" | "down" | "degraded"
|
||||
}
|
||||
type ApiGreTunnelRow=DashboardGreTunnel
|
||||
|
||||
interface InternetPathSnapshotPayload {
|
||||
sampledAt: string
|
||||
@@ -248,10 +229,10 @@ export function useDashboardLive() {
|
||||
apiFetch<{ rulesets: Array<{ rules?: unknown[] }> }>("/api/filters/rules"),
|
||||
apiFetch<unknown>("/api/bgp/catalog").then(parseDashboardBgp),
|
||||
apiFetch<{ snapshot: InternetPathSnapshotPayload | null }>("/api/internet-path/latest"),
|
||||
apiFetch<{ tunnels?: ApiGreTunnelRow[] }>("/api/filters/gre-tunnels"),
|
||||
dashboardRequest("/api/wireguard",()=>listWireGuard(backendUrl)),
|
||||
apiFetch<unknown>("/api/filters/gre-tunnels").then(parseDashboardGre),
|
||||
apiFetch<unknown>("/api/wireguard").then(parseDashboardWireGuard),
|
||||
apiFetch<unknown>("/api/traffic/servers?range=1h").then(parseDashboardTraffic),
|
||||
apiFetch<{ tunnels?: Array<{ id: string; serverId: string; name: string; status: OverlayItem["status"] }> }>("/api/vxlan"),
|
||||
apiFetch<unknown>("/api/vxlan").then(parseDashboardVxlan),
|
||||
])
|
||||
|
||||
if (!current()) return
|
||||
@@ -302,7 +283,7 @@ export function useDashboardLive() {
|
||||
name: t.name,
|
||||
kind: "vxlan" as const,
|
||||
href: "/vxlan?server=" + encodeURIComponent(t.serverId) + "&tunnel=" + encodeURIComponent(t.id),
|
||||
status: t.status === "up" ? "up" : "down",
|
||||
status: t.status,
|
||||
}))
|
||||
: []
|
||||
setOverlayItems(previous => [
|
||||
@@ -396,7 +377,7 @@ export function useDashboardLive() {
|
||||
setInternetPathLoading(false)
|
||||
}
|
||||
}
|
||||
}, [apiFetch, backendUrl, isLive, recordSource])
|
||||
}, [apiFetch, isLive, recordSource])
|
||||
|
||||
const fetchRecentEvents = useCallback(async (_silent: boolean) => {
|
||||
if (!isLive) {
|
||||
|
||||
Reference in new issue
Block a user