mirror of
https://github.com/grafana/grafana.git
synced 2025-09-23 05:43:19 +08:00
Loki: Cleanup some code for default editorMode (#49431)
This commit is contained in:
@ -24,6 +24,8 @@ export const LokiQueryEditorSelector = React.memo<LokiQueryEditorProps>((props)
|
||||
const [dataIsStale, setDataIsStale] = useState(false);
|
||||
|
||||
const query = getQueryWithDefaults(props.query);
|
||||
// This should be filled in from the defaults by now.
|
||||
const editorMode = query.editorMode!;
|
||||
|
||||
const onEditorModeChange = useCallback(
|
||||
(newEditorMode: QueryEditorMode) => {
|
||||
@ -54,8 +56,6 @@ export const LokiQueryEditorSelector = React.memo<LokiQueryEditorProps>((props)
|
||||
onChange({ ...query, rawQuery: isEnabled });
|
||||
};
|
||||
|
||||
// If no expr (ie new query) then default to builder
|
||||
const editorMode = query.editorMode ?? (query.expr ? QueryEditorMode.Code : QueryEditorMode.Builder);
|
||||
return (
|
||||
<>
|
||||
<ConfirmModal
|
||||
|
@ -26,6 +26,7 @@ export const PromQueryEditorSelector = React.memo<PromQueryEditorProps>((props)
|
||||
const [dataIsStale, setDataIsStale] = useState(false);
|
||||
|
||||
const query = getQueryWithDefaults(props.query, app);
|
||||
// This should be filled in from the defaults by now.
|
||||
const editorMode = query.editorMode!;
|
||||
|
||||
const onEditorModeChange = useCallback(
|
||||
|
Reference in New Issue
Block a user