mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-12 12:46:23 +01:00
fix: return query for app mode (#1954)
This commit is contained in:
parent
5bd4e47a9e
commit
7d32ca9ed3
@ -1,6 +1,5 @@
|
||||
import qs from "qs";
|
||||
import get from "lodash.get";
|
||||
import {getAppModeEnable} from "./app-mode";
|
||||
|
||||
const stateToUrlParams = {
|
||||
"time.duration": "range_input",
|
||||
@ -9,8 +8,6 @@ const stateToUrlParams = {
|
||||
"displayType": "tab"
|
||||
};
|
||||
|
||||
const appModeEnable = getAppModeEnable();
|
||||
|
||||
// TODO need function for detect types.
|
||||
// const decoder = (value: string) => {
|
||||
// This function does not parse dates
|
||||
@ -34,16 +31,12 @@ const appModeEnable = getAppModeEnable();
|
||||
export const setQueryStringWithoutPageReload = (qsValue: string): void => {
|
||||
const w = window;
|
||||
if (w) {
|
||||
const newurl = `${w.location.protocol}//${w.location.host}${w.location.pathname}${qsValue ? "?" : ""}${qsValue}`;
|
||||
const newurl = `${w.location.protocol}//${w.location.host}${w.location.pathname}?${qsValue}`;
|
||||
w.history.pushState({ path: newurl }, "", newurl);
|
||||
}
|
||||
};
|
||||
|
||||
export const setQueryStringValue = (newValue: Record<string, unknown>): void => {
|
||||
if (appModeEnable) {
|
||||
setQueryStringWithoutPageReload("");
|
||||
return;
|
||||
}
|
||||
const queryMap = new Map(Object.entries(stateToUrlParams));
|
||||
const query = get(newValue, "query", "") as string[];
|
||||
const newQsValue: string[] = [];
|
||||
|
Loading…
Reference in New Issue
Block a user