prometheus: query-field: monaco: implement open-help-by-default (#41112)

* prometheus: query-field: monaco: implement open-help-by-default

* better comment

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

* fixed typo in comment

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

* better log-message

* fixed comment spelling

Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>

* better setting

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
This commit is contained in:
Gábor Farkas
2021-11-03 10:55:07 +01:00
committed by GitHub
parent a5f747104c
commit 244e149c34
2 changed files with 120 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import { useLatest } from 'react-use';
import { promLanguageDefinition } from 'monaco-promql';
import { getCompletionProvider } from './monaco-completion-provider';
import { Props } from './MonacoQueryFieldProps';
import { getOverrideServices } from './getOverrideServices';
const options: monacoTypes.editor.IStandaloneEditorConstructionOptions = {
codeLens: false,
@@ -75,6 +76,8 @@ const getStyles = (theme: GrafanaTheme2) => {
};
const MonacoQueryField = (props: Props) => {
// we need only one instance of `overrideServices` during the lifetime of the react component
const overrideServicesRef = useRef(getOverrideServices());
const containerRef = useRef<HTMLDivElement>(null);
const { languageProvider, history, onBlur, onRunQuery, initialValue } = props;
@@ -102,6 +105,7 @@ const MonacoQueryField = (props: Props) => {
ref={containerRef}
>
<ReactMonacoEditor
overrideServices={overrideServicesRef.current}
options={options}
language="promql"
value={initialValue}