From f81b35308b95442ec87cb2c80e199418c628c280 Mon Sep 17 00:00:00 2001 From: Denozordec Date: Mon, 14 Sep 2026 13:39:47 +0700 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=B8=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=8B?= =?UTF-8?q?=20Firewall=20=D0=B8=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=20=D0=BF=D0=BE=D1=80=D1=8F=D0=B4=D0=BE=D0=BA?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-grids/firewall-rules-data-grid.tsx | 29 ++--- .../firewall-scenario-rules-data-grid.tsx | 24 ++-- docs/ux-ui-progress.md | 12 ++ tests/e2e/firewall-tables.spec.ts | 112 ++++++++++++++++++ 4 files changed, 154 insertions(+), 23 deletions(-) create mode 100644 tests/e2e/firewall-tables.spec.ts diff --git a/components/data-grids/firewall-rules-data-grid.tsx b/components/data-grids/firewall-rules-data-grid.tsx index 45a266c5..4d3b0f43 100644 --- a/components/data-grids/firewall-rules-data-grid.tsx +++ b/components/data-grids/firewall-rules-data-grid.tsx @@ -1,12 +1,12 @@ "use client" +import { dataGridFeatures, type DataGridFeatures } from "@/components/reui/data-grid" + import { useMemo } from "react" import { type ColumnDef, - getCoreRowModel, - getSortedRowModel, - useReactTable, -} from "@tanstack/react-table-v8" + useTable, +} from "@tanstack/react-table" import type { FirewallRule } from "@/lib/data" import { FormToggle } from "@/components/form-kit" import { cn } from "@/lib/utils" @@ -18,15 +18,15 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" -import { DataGridShell } from "@/components/data-grids/shared/legacy-data-grid-shell" +import { DataGridShell } from "@/components/data-grids/shared/data-grid-shell" import { DATA_GRID_CELL_PAD, DATA_GRID_CELL_PAD_FIRST, DATA_GRID_CELL_PAD_LAST, DATA_GRID_CONTAINER_CLASS, -} from "@/components/data-grids/shared/legacy-data-grid-layout" -import { DataGridSortHeader } from "@/components/data-grids/shared/legacy-data-grid-sort-header" -import { DataGridContainer, DataGridTableDndRowHandle, DataGridTableDndRows } from "@/components/reui/legacy-data-grid" +} from "@/components/data-grids/shared/data-grid-layout" +import { DataGridSortHeader } from "@/components/data-grids/shared/data-grid-sort-header" +import { DataGridContainer, DataGridTableDndRowHandle, DataGridTableDndRows } from "@/components/reui/data-grid" import type { DragEndEvent } from "@dnd-kit/core" import { EmptyState } from "@/components/empty-state" import { @@ -112,7 +112,7 @@ function FirewallRulesDataGrid({ const reorderable = Boolean(onReorder) const indexPad = reorderable ? DATA_GRID_CELL_PAD : DATA_GRID_CELL_PAD_FIRST - const columns = useMemo[]>( + const columns = useMemo[]>( () => [ ...(reorderable ? [{ @@ -125,7 +125,7 @@ function FirewallRulesDataGrid({ headerClassName: DATA_GRID_CELL_PAD_FIRST, cellClassName: DATA_GRID_CELL_PAD_FIRST, }, - } satisfies ColumnDef] + } satisfies ColumnDef] : []), { id: "index", @@ -157,7 +157,7 @@ function FirewallRulesDataGrid({ ), meta: { headerTitle: "Сервер", headerClassName: DATA_GRID_CELL_PAD, cellClassName: DATA_GRID_CELL_PAD }, - } satisfies ColumnDef] + } satisfies ColumnDef] : []), { id: "chain", @@ -318,11 +318,12 @@ function FirewallRulesDataGrid({ [onEdit, onToggle, onDelete, showServer, reorderable, indexPad], ) - const table = useReactTable({ + const table = useTable({ + features: dataGridFeatures, + manualPagination: true, data: indexedRules, columns, - getCoreRowModel: getCoreRowModel(), - ...(reorderable ? {} : { getSortedRowModel: getSortedRowModel() }), + manualSorting: reorderable, enableSorting: !reorderable, getRowId: (row) => row.id, }) diff --git a/components/data-grids/firewall-scenario-rules-data-grid.tsx b/components/data-grids/firewall-scenario-rules-data-grid.tsx index a45f26ce..a83a4c8c 100644 --- a/components/data-grids/firewall-scenario-rules-data-grid.tsx +++ b/components/data-grids/firewall-scenario-rules-data-grid.tsx @@ -1,18 +1,19 @@ "use client" +import { dataGridFeatures, type DataGridFeatures } from "@/components/reui/data-grid" + import { useMemo } from "react" import { type ColumnDef, - getCoreRowModel, - useReactTable, -} from "@tanstack/react-table-v8" + useTable, +} from "@tanstack/react-table" import { ActionBadge, ChainBadge } from "@/components/data-grids/firewall-rules-data-grid" -import { DataGridShell } from "@/components/data-grids/shared/legacy-data-grid-shell" +import { DataGridShell } from "@/components/data-grids/shared/data-grid-shell" import { DATA_GRID_CELL_PAD, DATA_GRID_CELL_PAD_FIRST, DATA_GRID_CELL_PAD_LAST, -} from "@/components/data-grids/shared/legacy-data-grid-layout" +} from "@/components/data-grids/shared/data-grid-layout" import { cn } from "@/lib/utils" import { PowerIcon, Trash2Icon } from "lucide-react" @@ -53,7 +54,7 @@ function FirewallScenarioRulesDataGrid({ [rules], ) - const columns = useMemo[]>( + const columns = useMemo[]>( () => [ { id: "index", @@ -154,7 +155,7 @@ function FirewallScenarioRulesDataGrid({ cell: ({ row }) => { const index = row.original._index - 1 return ( -
+