fix: stabilize usage loading and session search
|
Before Width: | Height: | Size: 200 KiB After Width: | Height: | Size: 200 KiB |
|
Before Width: | Height: | Size: 200 KiB After Width: | Height: | Size: 200 KiB |
|
Before Width: | Height: | Size: 212 KiB After Width: | Height: | Size: 211 KiB |
|
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 186 KiB |
|
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 189 KiB |
|
Before Width: | Height: | Size: 260 KiB After Width: | Height: | Size: 258 KiB |
|
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 186 KiB |
|
Before Width: | Height: | Size: 201 KiB After Width: | Height: | Size: 201 KiB |
|
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 187 KiB |
|
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 186 KiB |
|
Before Width: | Height: | Size: 203 KiB After Width: | Height: | Size: 203 KiB |
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 192 KiB After Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 307 KiB After Width: | Height: | Size: 307 KiB |
@@ -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');
|
||||
|
||||
@@ -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": [
|
||||
{
|
||||
|
||||