fix: stabilize usage loading and session search

This commit is contained in:
shiyue
2026-08-05 10:41:50 +08:00
parent c61b7434d2
commit 3f00cfe7a4
22 changed files with 109 additions and 47 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 KiB

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 KiB

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 KiB

After

Width:  |  Height:  |  Size: 307 KiB

View File

@@ -411,6 +411,29 @@ async function main() {
await waitFor(() => evaluate(cdp, "!document.querySelector('#usage-dashboard-panel').hidden"), 10000);
await waitFor(() => evaluate(cdp, "document.querySelector('#usage-dashboard-panel').dataset.state !== 'loading'"), 30000);
await sleep(320);
const loadingLayout = await evaluate(cdp, `(() => {
const metricGrid = document.querySelector('.usage-dashboard__metric-grid');
const beforeTop = metricGrid.getBoundingClientRect().top;
document.querySelector('#usage-dashboard-refresh').click();
const afterTop = metricGrid.getBoundingClientRect().top;
return {
state: document.querySelector('#usage-dashboard-panel').dataset.state,
label: document.querySelector('#usage-dashboard-refresh-label').textContent,
busy: document.querySelector('#usage-dashboard-refresh').getAttribute('aria-busy'),
contentShift: Math.round(Math.abs(afterTop - beforeTop) * 10) / 10,
standaloneLoading: !!document.querySelector('#usage-dashboard-loading'),
};
})()`);
if (loadingLayout.state !== 'loading'
|| loadingLayout.label !== '整理中'
|| loadingLayout.busy !== 'true'
|| loadingLayout.contentShift > 0.5
|| loadingLayout.standaloneLoading) {
throw new Error(`加载状态仍引发布局变化:${JSON.stringify(loadingLayout)}`);
}
await waitFor(() => evaluate(cdp, `document.querySelector('#usage-dashboard-panel').dataset.state !== 'loading'
&& document.querySelector('#usage-dashboard-refresh-label').textContent === '刷新'`), 30000);
await sleep(300);
await evaluate(cdp, `(() => {
const from = document.querySelector('#usage-dashboard-from');
const to = document.querySelector('#usage-dashboard-to');

View File

@@ -1,5 +1,5 @@
{
"generatedAt": "2026-08-03T14:15:13.710Z",
"generatedAt": "2026-08-05T01:06:45.134Z",
"chrome": "/home/hdzx/.cache/ms-playwright/chromium-1228/chrome-linux64/chrome",
"views": [
{