mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Make backwards compatible (#29212)
This commit is contained in:
parent
2dc260a486
commit
c94e8e61a9
@ -59,6 +59,20 @@ describe('state functions', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not return a query for mode in the url', () => {
|
||||||
|
// Previous versions of Grafana included "Explore mode" in the URL; this should not be treated as a query.
|
||||||
|
const paramValue =
|
||||||
|
'["now-1h","now","x-ray-datasource",{"queryType":"getTraceSummaries"},{"mode":"Metrics"},{"ui":[true,true,true,"none"]}]';
|
||||||
|
expect(parseUrlState(paramValue)).toMatchObject({
|
||||||
|
datasource: 'x-ray-datasource',
|
||||||
|
queries: [{ queryType: 'getTraceSummaries' }],
|
||||||
|
range: {
|
||||||
|
from: 'now-1h',
|
||||||
|
to: 'now',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should return queries if queryType is present in the url', () => {
|
it('should return queries if queryType is present in the url', () => {
|
||||||
const paramValue =
|
const paramValue =
|
||||||
'["now-1h","now","x-ray-datasource",{"queryType":"getTraceSummaries"},{"ui":[true,true,true,"none"]}]';
|
'["now-1h","now","x-ray-datasource",{"queryType":"getTraceSummaries"},{"ui":[true,true,true,"none"]}]';
|
||||||
|
@ -243,7 +243,7 @@ export function parseUrlState(initial: string | undefined): ExploreUrlState {
|
|||||||
};
|
};
|
||||||
const datasource = parsed[ParseUrlStateIndex.Datasource];
|
const datasource = parsed[ParseUrlStateIndex.Datasource];
|
||||||
const parsedSegments = parsed.slice(ParseUrlStateIndex.SegmentsStart);
|
const parsedSegments = parsed.slice(ParseUrlStateIndex.SegmentsStart);
|
||||||
const queries = parsedSegments.filter(segment => !isSegment(segment, 'ui', 'originPanelId'));
|
const queries = parsedSegments.filter(segment => !isSegment(segment, 'ui', 'originPanelId', 'mode'));
|
||||||
|
|
||||||
const originPanelId = parsedSegments.filter(segment => isSegment(segment, 'originPanelId'))[0];
|
const originPanelId = parsedSegments.filter(segment => isSegment(segment, 'originPanelId'))[0];
|
||||||
return { datasource, queries, range, originPanelId };
|
return { datasource, queries, range, originPanelId };
|
||||||
|
Loading…
Reference in New Issue
Block a user