fix(ui): показывать частичные сбои опроса VXLAN
This commit is contained in:
1 parent
4dc2ee2129
commit
e163a9ed9d
9 files changed
+120
-41
No files matched your search
@@ -37,10 +37,11 @@ import {
|
||||
interface VxlanDataGridProps {
|
||||
tunnels: VxlanTunnel[]
|
||||
servers: Server[]
|
||||
failedServerIds?: string[]
|
||||
onExport: (tunnel: VxlanTunnel) => void
|
||||
}
|
||||
|
||||
function VxlanDataGrid({ tunnels, servers, onExport }: VxlanDataGridProps) {
|
||||
function VxlanDataGrid({ tunnels, servers, onExport, failedServerIds = [] }: VxlanDataGridProps) {
|
||||
const serverMap = useMemo(
|
||||
() => new Map(servers.map((s) => [s.id, s])),
|
||||
[servers],
|
||||
@@ -61,7 +62,7 @@ function VxlanDataGrid({ tunnels, servers, onExport }: VxlanDataGridProps) {
|
||||
<span
|
||||
className={cn(
|
||||
"size-2 rounded-full shrink-0 mt-1.5",
|
||||
t.status === "up" ? "bg-emerald-500" : "bg-red-500",
|
||||
failedServerIds.includes(t.serverId) ? "bg-muted-foreground" : t.status === "up" ? "bg-emerald-500" : "bg-red-500",
|
||||
)}
|
||||
/>
|
||||
<div className="min-w-0">
|
||||
@@ -180,12 +181,14 @@ function VxlanDataGrid({ tunnels, servers, onExport }: VxlanDataGridProps) {
|
||||
<span
|
||||
className={cn(
|
||||
"text-[11px] font-mono px-2 py-0.5 rounded border whitespace-nowrap",
|
||||
row.original.status === "up"
|
||||
failedServerIds.includes(row.original.serverId)
|
||||
? "bg-muted text-muted-foreground border-border"
|
||||
: row.original.status === "up"
|
||||
? "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20"
|
||||
: "bg-red-500/10 text-red-500 border-red-500/20",
|
||||
)}
|
||||
>
|
||||
{row.original.status === "up" ? "UP" : "DOWN"}
|
||||
{failedServerIds.includes(row.original.serverId) ? "Неизвестно" : row.original.status === "up" ? "UP" : "DOWN"}
|
||||
</span>
|
||||
),
|
||||
meta: {
|
||||
@@ -251,7 +254,7 @@ function VxlanDataGrid({ tunnels, servers, onExport }: VxlanDataGridProps) {
|
||||
},
|
||||
},
|
||||
],
|
||||
[onExport, serverMap],
|
||||
[onExport, serverMap, failedServerIds],
|
||||
)
|
||||
|
||||
const table = useTable({
|
||||
|
||||
Reference in new issue
Block a user