fix(ui): сохранять подтверждённые данные GRE при отказах
This commit is contained in:
1 parent
6ea3cdad0e
commit
fb009344e1
7 files changed
+183
-104
No files matched your search
@@ -105,6 +105,9 @@ interface GreTunnelsDataGridProps {
|
||||
onToggle?: (tunnel: GreTunnel) => void
|
||||
onDelete?: (tunnel: GreTunnel) => void
|
||||
mutationsLocked?: boolean
|
||||
unknownServerIds?: Set<string>
|
||||
emptyTitle?: string
|
||||
emptyDescription?: string
|
||||
}
|
||||
|
||||
function GreTunnelsDataGrid({
|
||||
@@ -116,6 +119,7 @@ function GreTunnelsDataGrid({
|
||||
onToggle,
|
||||
onDelete,
|
||||
mutationsLocked = false,
|
||||
unknownServerIds, emptyTitle, emptyDescription,
|
||||
}: GreTunnelsDataGridProps) {
|
||||
const serverMap = useMemo(() => new Map(servers.map((s) => [s.id, s])), [servers])
|
||||
const poolMap = useMemo(() => new Map(pools.map((p) => [p.id, p])), [pools])
|
||||
@@ -260,7 +264,7 @@ function GreTunnelsDataGrid({
|
||||
id: "status",
|
||||
accessorKey: "status",
|
||||
header: ({ column }) => <DataGridSortHeader column={column} title="Статус" />,
|
||||
cell: ({ row }) => <TunnelStatus status={row.original.status} />,
|
||||
cell: ({ row }) => unknownServerIds?.has(row.original.serverId) ? <span className="text-sm text-muted-foreground">Неизвестно</span> : <TunnelStatus status={row.original.status} />,
|
||||
meta: { headerTitle: "Статус", headerClassName: DATA_GRID_CELL_PAD, cellClassName: DATA_GRID_CELL_PAD },
|
||||
},
|
||||
{
|
||||
@@ -337,7 +341,7 @@ function GreTunnelsDataGrid({
|
||||
meta: { headerClassName: DATA_GRID_CELL_PAD_LAST, cellClassName: DATA_GRID_CELL_PAD_LAST },
|
||||
},
|
||||
],
|
||||
[onCodePreview, onEdit, onToggle, onDelete, mutationsLocked, poolMap, serverMap],
|
||||
[onCodePreview, onEdit, onToggle, onDelete, mutationsLocked, unknownServerIds, poolMap, serverMap],
|
||||
)
|
||||
|
||||
const table = useTable({
|
||||
@@ -345,15 +349,15 @@ function GreTunnelsDataGrid({
|
||||
manualPagination: true,
|
||||
data: tunnels,
|
||||
columns,
|
||||
getRowId: (row, index) => `${row.id}:${row.serverId}:${row.name}:${index}`,
|
||||
getRowId: row => JSON.stringify([row.serverId, row.id]),
|
||||
})
|
||||
|
||||
if (tunnels.length === 0) {
|
||||
return (
|
||||
<EmptyState
|
||||
icon={<NetworkIcon className="size-4" />}
|
||||
title="Нет GRE-туннелей"
|
||||
description="Измените фильтр или добавьте туннель"
|
||||
title={emptyTitle ?? "Нет GRE-туннелей"}
|
||||
description={emptyDescription ?? "Измените фильтр или добавьте туннель"}
|
||||
className="border-0 py-16"
|
||||
/>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user