feat(web): unify Semi UI workspace states

This commit is contained in:
lingniu
2026-07-18 00:59:11 +08:00
parent 159c80b0ae
commit 1cd92715a5
13 changed files with 639 additions and 46 deletions

View File

@@ -74,6 +74,27 @@ test('preserves the exact monitor return after changing history filters', async
expect(await screen.findByRole('link', { name: /返回全局监控/ })).toHaveAttribute('href', monitorPath);
});
test('renders the shared empty state when the API returns nullable empty collections', async () => {
mocks.historyMetricCatalog.mockResolvedValue({ categories: [{ key: 'location', label: '位置数据' }], metrics: [metric] });
mocks.historyExports.mockResolvedValue([]);
mocks.historyData.mockResolvedValue({
category: 'location',
columns: null,
rows: null,
summary: null,
total: 0,
limit: 50,
offset: 0,
asOf: '2026-07-18 00:53:00'
} as unknown as HistoryDataResponse);
const view = renderPage('/history?keywords=LTESTNOEXIST00001&dateFrom=2026-07-18T00%3A00&dateTo=2026-07-18T00%3A53');
expect(await screen.findByText('当前条件没有历史记录')).toBeInTheDocument();
expect(view.container.querySelector('.v2-history-empty.v2-state-surface')).toBeInTheDocument();
expect(screen.queryByText('当前模块暂时无法显示')).not.toBeInTheDocument();
});
test('clears stale rows, charts, and evidence as soon as the history scope changes', async () => {
let resolveNewData!: (value: HistoryDataResponse) => void;
let resolveNewSeries!: (value: HistorySeriesResponse) => void;