Loki Query Editor: Make Monaco the default editor (#62247)

* feat(loki-editor): remove slate and make Monaco the default editor

* feat(loki-editor): remove unsupported usages of onBlur

* feat(loki-editor): remove monaco feature flag

* Chore: remove unused import
This commit is contained in:
Matias Chomicki
2023-02-06 11:18:01 +01:00
committed by GitHub
parent 4d268cbcdb
commit 57369915f5
12 changed files with 22 additions and 191 deletions

View File

@@ -1,8 +1,6 @@
import { render, screen } from '@testing-library/react';
import React from 'react';
import { config } from '@grafana/runtime';
import { createLokiDatasource } from '../../mocks';
import { LokiQuery } from '../../types';
@@ -27,10 +25,6 @@ const createDefaultProps = () => {
return props;
};
beforeAll(() => {
config.featureToggles.lokiMonacoEditor = true;
});
describe('LokiQueryCodeEditor', () => {
it('shows explain section when showExplain is true', async () => {
const props = createDefaultProps();

View File

@@ -1,7 +1,7 @@
import { css } from '@emotion/css';
import React from 'react';
import { CoreApp, GrafanaTheme2 } from '@grafana/data';
import { GrafanaTheme2 } from '@grafana/data';
import { useStyles2 } from '@grafana/ui';
import { testIds } from '../../components/LokiQueryEditor';
@@ -27,15 +27,6 @@ export function LokiQueryCodeEditor({
}: Props) {
const styles = useStyles2(getStyles);
// the inner QueryField works like this when a blur event happens:
// - if it has an onBlur prop, it calls it
// - else it calls onRunQuery (some extra conditions apply)
//
// we want it to not do anything when a blur event happens in explore mode,
// so we set an empty-function in such case. otherwise we set `undefined`,
// which will cause it to run the query when blur happens.
const onBlur = app === CoreApp.Explore ? () => undefined : undefined;
return (
<div className={styles.wrapper}>
<LokiQueryField
@@ -44,7 +35,6 @@ export function LokiQueryCodeEditor({
range={range}
onRunQuery={onRunQuery}
onChange={onChange}
onBlur={onBlur}
history={history}
data={data}
app={app}