unify Semi UI filter workspaces and pagination

This commit is contained in:
lingniu
2026-07-18 01:29:30 +08:00
parent 5c0a61f7bd
commit 6d63783630
11 changed files with 318 additions and 57 deletions

View File

@@ -15,6 +15,7 @@ const reconciliationSource = readFileSync(resolve(process.cwd(), 'src/v2/pages/R
const profileSyncPanelSource = readFileSync(resolve(process.cwd(), 'src/v2/pages/VehicleProfileSyncPanel.tsx'), 'utf8');
const sourceEvidenceSource = readFileSync(resolve(process.cwd(), 'src/v2/shared/VehicleSourceEvidencePanel.tsx'), 'utf8');
const mobileFilterToggleSource = readFileSync(resolve(process.cwd(), 'src/v2/shared/MobileFilterToggle.tsx'), 'utf8');
const workspaceFilterPanelSource = readFileSync(resolve(process.cwd(), 'src/v2/shared/WorkspaceFilterPanel.tsx'), 'utf8');
const segmentedTabsSource = readFileSync(resolve(process.cwd(), 'src/v2/shared/SegmentedTabs.tsx'), 'utf8');
const metricActionSource = readFileSync(resolve(process.cwd(), 'src/v2/shared/MetricActionButton.tsx'), 'utf8');
const tablePaginationSource = readFileSync(resolve(process.cwd(), 'src/v2/shared/TablePagination.tsx'), 'utf8');
@@ -122,7 +123,8 @@ describe('V2 production entry', () => {
for (const surface of ['v2-export-jobs', 'v2-history-evidence', 'v2-history-metrics-card', 'v2-history-summary']) {
expect(corePageSources.HistoryPage).toContain(`<Card className="${surface}"`);
}
expect(corePageSources.HistoryPage).toContain('<Card className={`v2-history-filter-card');
expect(corePageSources.HistoryPage).toContain('<WorkspaceFilterPanel');
expect(corePageSources.HistoryPage).toContain('className="v2-history-filter-card"');
expect(corePageSources.HistoryPage).toContain('<Card className={`v2-history-table-card');
expect(corePageSources.HistoryPage).toContain('<Descriptions className="v2-history-evidence-descriptions"');
expect(corePageSources.HistoryPage).toContain('<Descriptions className="v2-evidence-values"');
@@ -153,7 +155,7 @@ describe('V2 production entry', () => {
expect(corePageSources.AlertsPage).toContain('className="v2-alert-event-table"');
expect(corePageSources.AlertsPage).toContain('detailTriggerRow({');
expect(corePageSources.AlertsPage).not.toContain('<table><thead><tr><th />');
expect(corePageSources.AlertsPage).toContain('<Card className={`v2-alert-filter-card');
expect(corePageSources.AlertsPage).toContain('className="v2-alert-filter-card"');
expect(corePageSources.AlertsPage).not.toContain('<section className="v2-alert-table-card"');
expect(corePageSources.AlertsPage).not.toContain('<aside className="v2-alert-inspector"');
expect(corePageSources.AlertsPage).not.toContain('<select');
@@ -189,7 +191,7 @@ describe('V2 production entry', () => {
expect(corePageSources.AccessPage).toContain('<Card className={`v2-access-inspector-v3');
expect(corePageSources.AccessPage).toContain('className="v2-access-detail-sidesheet"');
expect(corePageSources.AccessPage).toContain('className="v2-access-governance-sidesheet"');
expect(corePageSources.AccessPage).toContain('<Card className={`v2-access-filter-card-v3');
expect(corePageSources.AccessPage).toContain('className="v2-access-filter-card-v3"');
expect(corePageSources.AccessPage).not.toContain('<section className="v2-access-table-v3"');
expect(corePageSources.AccessPage).not.toContain('<aside className="v2-access-inspector-v3"');
expect(corePageSources.AccessPage).toContain('<Card key={row.vin} className={`v2-access-mobile-card');
@@ -384,8 +386,9 @@ describe('V2 production entry', () => {
expect(metricActionSource).toContain("from '@douyinfe/semi-ui'");
expect(metricActionSource).toContain('aria-pressed={active}');
expect(tablePaginationSource).toContain("from '@douyinfe/semi-ui'");
expect(tablePaginationSource).toContain('aria-label="上一页"');
expect(tablePaginationSource).toContain('aria-label="下一页"');
expect(tablePaginationSource).toContain('<Pagination');
expect(tablePaginationSource).toContain('currentPage={safePage}');
expect(tablePaginationSource).toContain('onPageChange={onPageChange}');
for (const name of ['MonitorPage', 'AlertsPage', 'HistoryPage', 'AccessPage', 'StatisticsPage']) {
expect(corePageSources[name]).toContain("from '../shared/TablePagination'");
expect(corePageSources[name]).toContain('<TablePagination');
@@ -435,11 +438,18 @@ describe('V2 production entry', () => {
expect(workspaceStyles).toContain('color: #f8fbff;');
expect(v2Styles).toContain('.v2-track-current-card > .semi-card-body > div strong { margin-top: 4px; color: var(--track-overlay-text);');
expect(v2Styles).toContain('.v2-track-current-card.semi-card { top: auto; right: 8px; bottom: 126px; left: 8px; width: auto; height: auto;');
for (const name of ['HistoryPage', 'StatisticsPage', 'AlertsPage', 'AccessPage']) {
expect(workspaceFilterPanelSource).toContain("from './MobileFilterToggle'");
expect(workspaceFilterPanelSource).toContain('<MobileFilterToggle');
for (const name of ['HistoryPage', 'AlertsPage', 'AccessPage']) {
expect(corePageSources[name]).toContain("from '../shared/WorkspaceFilterPanel'");
expect(corePageSources[name]).toContain('<WorkspaceFilterPanel');
}
for (const name of ['StatisticsPage']) {
expect(corePageSources[name]).toContain("from '../shared/MobileFilterToggle'");
expect(corePageSources[name]).toContain('<MobileFilterToggle');
expect(corePageSources[name]).not.toContain('<button type="button" className="v2-mobile-filter-toggle"');
}
expect(tablePaginationSource).toContain('<Pagination');
});
test('keeps the shared desktop and mobile application shell on Semi UI navigation primitives', () => {