feat(platform): preserve missing source filters
This commit is contained in:
@@ -12,13 +12,14 @@ describe('parseAppHash', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('parses vehicle list filters from hash query', () => {
|
test('parses vehicle list filters from hash query', () => {
|
||||||
expect(parseAppHash('#/vehicles?coverage=multi&serviceStatus=degraded&online=online&bindingStatus=bound')).toEqual({
|
expect(parseAppHash('#/vehicles?coverage=multi&serviceStatus=degraded&online=online&bindingStatus=bound&missingProtocol=YUTONG_MQTT')).toEqual({
|
||||||
page: 'vehicles',
|
page: 'vehicles',
|
||||||
filters: {
|
filters: {
|
||||||
coverage: 'multi',
|
coverage: 'multi',
|
||||||
serviceStatus: 'degraded',
|
serviceStatus: 'degraded',
|
||||||
online: 'online',
|
online: 'online',
|
||||||
bindingStatus: 'bound'
|
bindingStatus: 'bound',
|
||||||
|
missingProtocol: 'YUTONG_MQTT'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -45,7 +46,7 @@ describe('buildAppHash', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('builds shareable vehicle list hash with filters', () => {
|
test('builds shareable vehicle list hash with filters', () => {
|
||||||
expect(buildAppHash({ page: 'vehicles', filters: { coverage: 'multi', serviceStatus: 'degraded' } })).toBe('#/vehicles?coverage=multi&serviceStatus=degraded');
|
expect(buildAppHash({ page: 'vehicles', filters: { coverage: 'multi', serviceStatus: 'degraded', missingProtocol: 'YUTONG_MQTT' } })).toBe('#/vehicles?coverage=multi&serviceStatus=degraded&missingProtocol=YUTONG_MQTT');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('builds shareable quality hash with filters', () => {
|
test('builds shareable quality hash with filters', () => {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export type AppRoute = {
|
|||||||
filters?: Record<string, string>;
|
filters?: Record<string, string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const filterKeys = ['coverage', 'serviceStatus', 'online', 'bindingStatus', 'issueType'] as const;
|
const filterKeys = ['coverage', 'serviceStatus', 'online', 'bindingStatus', 'missingProtocol', 'issueType'] as const;
|
||||||
|
|
||||||
export function parseAppHash(hash: string): AppRoute {
|
export function parseAppHash(hash: string): AppRoute {
|
||||||
const normalized = hash.trim().replace(/^#\/?/, '');
|
const normalized = hash.trim().replace(/^#\/?/, '');
|
||||||
|
|||||||
Reference in New Issue
Block a user