mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
25 lines
624 B
TypeScript
25 lines
624 B
TypeScript
import type {Location} from 'history';
|
|
|
|
import {decodeInteger} from 'sentry/utils/queryString';
|
|
|
|
export const ZOOM_START = 'startDuration';
|
|
export const ZOOM_END = 'endDuration';
|
|
|
|
export function decodeHistogramZoom(location: Location) {
|
|
let min: number | undefined = undefined;
|
|
let max: number | undefined = undefined;
|
|
|
|
if (ZOOM_START in location.query) {
|
|
min = decodeInteger(location.query[ZOOM_START], 0);
|
|
}
|
|
|
|
if (ZOOM_END in location.query) {
|
|
const decodedMax = decodeInteger(location.query[ZOOM_END]);
|
|
if (typeof decodedMax === 'number') {
|
|
max = decodedMax;
|
|
}
|
|
}
|
|
|
|
return {min, max};
|
|
}
|