mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user