From ef457b471a750896d2595f7362cbb4c5b2f421cf Mon Sep 17 00:00:00 2001 From: Denozordec Date: Sun, 4 Oct 2026 00:53:28 +0700 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D1=8F=D1=82=D1=8C=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86?= =?UTF-8?q?=D1=83=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=B0=D0=BA=D1=82=D0=BD=D0=BE?= =?UTF-8?q?=D0=B9=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=8B=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D0=BE=D0=BF=D1=80=D0=BE=D1=81=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/data-grids/compact-data-grid.tsx | 9 ++++++++- docs/ux-ui-performance.md | 2 +- docs/ux-ui-plan.md | 6 +++--- docs/ux-ui-progress.md | 10 +++++++++- docs/ux-ui-stage-12.md | 8 ++++++++ tests/e2e/dashboard-data.spec.ts | 4 ++++ 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/components/data-grids/compact-data-grid.tsx b/components/data-grids/compact-data-grid.tsx index b5304cca..aa483d37 100644 --- a/components/data-grids/compact-data-grid.tsx +++ b/components/data-grids/compact-data-grid.tsx @@ -2,7 +2,7 @@ import { dataGridFeatures, type DataGridFeatures } from "@/components/reui/data-grid" -import { useMemo, type ReactNode } from "react" +import { useMemo, useEffect, type ReactNode } from "react" import { type ColumnDef, useTable, @@ -83,6 +83,7 @@ function CompactDataGrid({ const table = useTable({ features: dataGridFeatures, manualPagination: false, + autoResetPageIndex: false, initialState: { pagination: { pageIndex: 0, pageSize: 50 } }, data, columns: columnDefs, @@ -90,6 +91,12 @@ function CompactDataGrid({ ...(getExpandedContent ? { getRowCanExpand: () => true } : {}), }) + const {pageIndex,pageSize}=table.state.pagination + useEffect(()=>{ + const last=Math.max(0,Math.ceil(data.length/pageSize)-1) + if(pageIndex>last)table.setPageIndex(last) + },[data.length,pageSize,pageIndex,table]) + return ( { test.setTimeout(90000);const start=Date.now();await setup(page,false,1000);await expect(refresh(page)).toBeEnabled();const queue=page.getByRole("region",{name:"Требует внимания",exact:true});const links=queue.locator('a[href^="/servers?server="]');await expect(links).toHaveCount(5);const sample={fixtureRows:1000,readyMs:Date.now()-start,renderedAttentionRows:await links.count(),domNodes:await page.locator("*").count()};console.log(JSON.stringify(sample));await info.attach("large-attention-metrics",{body:JSON.stringify(sample),contentType:"application/json"});const summary=queue.locator("summary").filter({hasText:"Ещё 995"});await summary.focus();await summary.press("Enter");await expect(links).toHaveCount(55);await queue.getByRole("button",{name:"Показать ещё 50",exact:true}).click();await expect(links).toHaveCount(105);await summary.focus();await summary.press("Enter");await expect(links).toHaveCount(5);await summary.press("Enter");await expect(links).toHaveCount(55);await page.setViewportSize({width:320,height:900});expect(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth)).toBe(true);await links.first().click();await expect(page).toHaveURL(/servers\?server=1$/);await expect(page.getByRole("status",{name:"Сервер по ссылке"})).toContainText("Узел 1") }) + +test("Dashboard active probes retain page after refreshed measurements",async({page})=>{ + const control=await setup(page);await expect(refresh(page)).toBeEnabled();const at="2026-10-04T00:00:00Z";const probes=Array.from({length:100},(_,i)=>({id:"large-p"+(i+1),srcServerId:"1",name:"Paged probe "+String(i+1).padStart(3,"0"),target:"192.0.2.2",filter:"main",rtt:0,loss:0,status:"up",series:[],enabled:true,showOnDashboard:true,observations:{samples:[{sampledAt:at,rtt:0,loss:0,status:"up"}]}}));control.probesPayload={rangeStartAt:"2026-10-03T23:00:00Z",rangeEndAt:at,probes};await refresh(page).click();await expect(page.locator("tr[data-row-id]")).toHaveCount(50);await page.getByRole("button",{name:"Следующая страница",exact:true}).click();await expect(page.getByText("Paged probe 051",{exact:true})).toBeVisible();await refresh(page).click();await expect(refresh(page)).toBeEnabled();await expect(page.getByText("51–100 из 100",{exact:true})).toBeVisible();await expect(page.getByText("Paged probe 051",{exact:true})).toBeVisible();control.probesPayload={rangeStartAt:"2026-10-03T23:00:00Z",rangeEndAt:at,probes:probes.slice(0,1)};await refresh(page).click();await expect(page.locator("tr[data-row-id]")).toHaveCount(1);await expect(page.getByText("Paged probe 001",{exact:true})).toBeVisible() +})