feat(platform): promote alert events surface

This commit is contained in:
lingniu
2026-07-04 17:58:33 +08:00
parent eb8f15ca18
commit 1235e76c32
11 changed files with 135 additions and 70 deletions

View File

@@ -48,7 +48,18 @@ describe('parseAppHash', () => {
});
});
test('parses quality governance filters from hash query', () => {
test('parses alert event filters from hash query', () => {
expect(parseAppHash('#/alert-events?keyword=%E7%B2%A4A&protocol=VEHICLE_SERVICE&issueType=NO_SOURCE')).toEqual({
page: 'alert-events',
keyword: '粤A',
protocol: 'VEHICLE_SERVICE',
filters: {
issueType: 'NO_SOURCE'
}
});
});
test('keeps legacy quality governance hash compatible', () => {
expect(parseAppHash('#/quality?keyword=%E7%B2%A4A&protocol=VEHICLE_SERVICE&issueType=NO_SOURCE')).toEqual({
page: 'quality',
keyword: '粤A',
@@ -110,7 +121,11 @@ describe('buildAppHash', () => {
expect(buildAppHash({ page: 'vehicles', filters: { coverage: 'multi', serviceStatus: 'degraded', archiveStatus: 'incomplete', archiveMissing: 'phone', missingProtocol: 'YUTONG_MQTT' } })).toBe('#/vehicles?coverage=multi&serviceStatus=degraded&archiveStatus=incomplete&archiveMissing=phone&missingProtocol=YUTONG_MQTT');
});
test('builds shareable quality hash with filters', () => {
test('builds shareable alert events hash with filters', () => {
expect(buildAppHash({ page: 'alert-events', keyword: '粤A', protocol: 'VEHICLE_SERVICE', filters: { issueType: 'NO_SOURCE' } })).toBe('#/alert-events?keyword=%E7%B2%A4A&protocol=VEHICLE_SERVICE&issueType=NO_SOURCE');
});
test('keeps building legacy quality hash when requested', () => {
expect(buildAppHash({ page: 'quality', keyword: '粤A', protocol: 'VEHICLE_SERVICE', filters: { issueType: 'NO_SOURCE' } })).toBe('#/quality?keyword=%E7%B2%A4A&protocol=VEHICLE_SERVICE&issueType=NO_SOURCE');
});
@@ -127,6 +142,6 @@ describe('buildAppHash', () => {
});
test('builds page-only hash when keyword is empty', () => {
expect(buildAppHash({ page: 'quality', keyword: '' })).toBe('#/quality');
expect(buildAppHash({ page: 'alert-events', keyword: '' })).toBe('#/alert-events');
});
});

View File

@@ -1,6 +1,6 @@
import type { PageKey } from '../layout/AppShell';
const pageKeys = new Set<PageKey>(['dashboard', 'vehicles', 'map', 'realtime', 'detail', 'history', 'history-query', 'mileage', 'quality', 'notification-rules', 'ops-quality']);
const pageKeys = new Set<PageKey>(['dashboard', 'vehicles', 'map', 'realtime', 'detail', 'history', 'history-query', 'mileage', 'alert-events', 'quality', 'notification-rules', 'ops-quality']);
export type AppRoute = {
page?: PageKey;