diff --git a/web/ui/mantine-ui/src/pages/query/QueryPanel.tsx b/web/ui/mantine-ui/src/pages/query/QueryPanel.tsx index 6dac332af..a73045e0b 100644 --- a/web/ui/mantine-ui/src/pages/query/QueryPanel.tsx +++ b/web/ui/mantine-ui/src/pages/query/QueryPanel.tsx @@ -6,8 +6,6 @@ import { Box, SegmentedControl, Stack, - Select, - TextInput, } from "@mantine/core"; import { IconChartAreaFilled, @@ -21,7 +19,6 @@ import { useAppDispatch, useAppSelector } from "../../state/hooks"; import { GraphDisplayMode, GraphResolution, - getEffectiveResolution, removePanel, setExpr, setVisualizer, @@ -31,10 +28,7 @@ import TimeInput from "./TimeInput"; import RangeInput from "./RangeInput"; import ExpressionInput from "./ExpressionInput"; import Graph from "./Graph"; -import { - formatPrometheusDuration, - parsePrometheusDuration, -} from "../../lib/formatTime"; +import ResolutionInput from "./ResolutionInput"; export interface PanelProps { idx: number; @@ -51,40 +45,8 @@ const QueryPanel: FC = ({ idx, metricNames }) => { const [retriggerIdx, setRetriggerIdx] = useState(0); const panel = useAppSelector((state) => state.queryPage.panels[idx]); - const resolution = panel.visualizer.resolution; const dispatch = useAppDispatch(); - const [customResolutionInput, setCustomResolutionInput] = useState( - formatPrometheusDuration( - getEffectiveResolution(resolution, panel.visualizer.range) - ) - ); - - const setResolution = (res: GraphResolution) => { - dispatch( - setVisualizer({ - idx, - visualizer: { - ...panel.visualizer, - resolution: res, - }, - }) - ); - }; - - const onChangeCustomResolutionInput = (resText: string): void => { - const newResolution = parsePrometheusDuration(resText); - if (newResolution === null) { - setCustomResolutionInput( - formatPrometheusDuration( - getEffectiveResolution(resolution, panel.visualizer.range) - ) - ); - } else { - setResolution({ type: "custom", value: newResolution }); - } - }; - return ( = ({ idx, metricNames }) => { ) } /> - -