feat(platform): open raw evidence from vehicle detail
This commit is contained in:
@@ -11,6 +11,17 @@ describe('parseAppHash', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('parses history tab from hash query', () => {
|
||||
expect(parseAppHash('#/history?keyword=VIN001&protocol=JT808&tab=raw')).toEqual({
|
||||
page: 'history',
|
||||
keyword: 'VIN001',
|
||||
protocol: 'JT808',
|
||||
filters: {
|
||||
tab: 'raw'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test('parses vehicle list filters from hash query', () => {
|
||||
expect(parseAppHash('#/vehicles?coverage=multi&serviceStatus=degraded&online=online&bindingStatus=bound&missingProtocol=YUTONG_MQTT')).toEqual({
|
||||
page: 'vehicles',
|
||||
@@ -45,6 +56,10 @@ describe('buildAppHash', () => {
|
||||
expect(buildAppHash({ page: 'history', keyword: '粤AG18312', protocol: 'GB32960' })).toBe('#/history?keyword=%E7%B2%A4AG18312&protocol=GB32960');
|
||||
});
|
||||
|
||||
test('builds shareable raw history hash', () => {
|
||||
expect(buildAppHash({ page: 'history', keyword: 'VIN001', protocol: 'JT808', filters: { tab: 'raw' } })).toBe('#/history?keyword=VIN001&protocol=JT808&tab=raw');
|
||||
});
|
||||
|
||||
test('builds shareable vehicle list hash with filters', () => {
|
||||
expect(buildAppHash({ page: 'vehicles', filters: { coverage: 'multi', serviceStatus: 'degraded', missingProtocol: 'YUTONG_MQTT' } })).toBe('#/vehicles?coverage=multi&serviceStatus=degraded&missingProtocol=YUTONG_MQTT');
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ export type AppRoute = {
|
||||
filters?: Record<string, string>;
|
||||
};
|
||||
|
||||
const filterKeys = ['coverage', 'serviceStatus', 'online', 'bindingStatus', 'missingProtocol', 'issueType'] as const;
|
||||
const filterKeys = ['coverage', 'serviceStatus', 'online', 'bindingStatus', 'missingProtocol', 'issueType', 'tab'] as const;
|
||||
|
||||
export function parseAppHash(hash: string): AppRoute {
|
||||
const normalized = hash.trim().replace(/^#\/?/, '');
|
||||
|
||||
Reference in New Issue
Block a user