mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-12 12:46:23 +01:00
feat: remove save the last query to local storage (#1853)
This commit is contained in:
parent
500945499f
commit
d0313b9401
@ -2,7 +2,6 @@ import {useEffect, useMemo, useState} from "react";
|
|||||||
import {getQueryRangeUrl, getQueryUrl} from "../../../api/query-range";
|
import {getQueryRangeUrl, getQueryUrl} from "../../../api/query-range";
|
||||||
import {useAppState} from "../../../state/common/StateContext";
|
import {useAppState} from "../../../state/common/StateContext";
|
||||||
import {InstantMetricResult, MetricResult} from "../../../api/types";
|
import {InstantMetricResult, MetricResult} from "../../../api/types";
|
||||||
import {saveToStorage} from "../../../utils/storage";
|
|
||||||
import {isValidHttpUrl} from "../../../utils/url";
|
import {isValidHttpUrl} from "../../../utils/url";
|
||||||
import {useAuthState} from "../../../state/auth/AuthStateContext";
|
import {useAuthState} from "../../../state/auth/AuthStateContext";
|
||||||
import {TimeParams} from "../../../types";
|
import {TimeParams} from "../../../types";
|
||||||
@ -56,7 +55,6 @@ export const useFetchQuery = (): {
|
|||||||
try {
|
try {
|
||||||
const response = await fetch(fetchUrl, { headers });
|
const response = await fetch(fetchUrl, { headers });
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
saveToStorage("LAST_QUERY", query);
|
|
||||||
const resp = await response.json();
|
const resp = await response.json();
|
||||||
setError(undefined);
|
setError(undefined);
|
||||||
displayType === "chart" ? setGraphData(resp.data.result) : setLiveData(resp.data.result);
|
displayType === "chart" ? setGraphData(resp.data.result) : setLiveData(resp.data.result);
|
||||||
|
@ -46,7 +46,7 @@ export type Action =
|
|||||||
|
|
||||||
const duration = getQueryStringValue("g0.range_input", "1h") as string;
|
const duration = getQueryStringValue("g0.range_input", "1h") as string;
|
||||||
const endInput = formatDateToLocal(getQueryStringValue("g0.end_input", getDateNowUTC()) as Date);
|
const endInput = formatDateToLocal(getQueryStringValue("g0.end_input", getDateNowUTC()) as Date);
|
||||||
const query = getQueryStringValue("g0.expr", getFromStorage("LAST_QUERY") as string || "\n") as string;
|
const query = getQueryStringValue("g0.expr", "") as string;
|
||||||
|
|
||||||
export const initialState: AppState = {
|
export const initialState: AppState = {
|
||||||
serverUrl: getDefaultServer(),
|
serverUrl: getDefaultServer(),
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
export type StorageKeys = "LAST_QUERY"
|
export type StorageKeys = "BASIC_AUTH_DATA"
|
||||||
| "BASIC_AUTH_DATA"
|
|
||||||
| "BEARER_AUTH_DATA"
|
| "BEARER_AUTH_DATA"
|
||||||
| "AUTH_TYPE"
|
| "AUTH_TYPE"
|
||||||
| "AUTOCOMPLETE"
|
| "AUTOCOMPLETE"
|
||||||
|
Loading…
Reference in New Issue
Block a user