@@ -14,7 +14,7 @@ import {
14
14
import { QueryEditorProps , SelectableValue } from "@grafana/data" ;
15
15
import { DataSource } from "../datasource" ;
16
16
import { MongoDataSourceOptions , MongoQuery , QueryLanguage , QueryType , DEFAULT_QUERY } from "../types" ;
17
- import { parseJsQuery , parseJsQueryLegacy , validateJsonQueryText } from "../utils" ;
17
+ import { parseJsQuery , parseJsQueryLegacy , validateJsonQueryText } from "../utils" ;
18
18
import * as monacoType from "monaco-editor/esm/vs/editor/editor.api" ;
19
19
20
20
type Props = QueryEditorProps < DataSource , MongoQuery , MongoDataSourceOptions > ;
@@ -37,7 +37,7 @@ export function QueryEditor({ query, onChange, onRunQuery }: Props) {
37
37
const [ queryTextError , setQueryTextError ] = useState < string | null > ( null ) ;
38
38
39
39
const optionsLanguage = [
40
- { label : "JSON" , value : QueryLanguage . JSON } ,
40
+ { label : "JSON" , value : QueryLanguage . JSON } ,
41
41
{ label : "JavaScript" , value : QueryLanguage . JAVASCRIPT , description : "javascript legacy" } ,
42
42
{ label : "JavaScriptShadow" , value : QueryLanguage . JAVASCRIPT_SHADOW , description : "javascript with evaluation" }
43
43
] ;
@@ -47,7 +47,7 @@ export function QueryEditor({ query, onChange, onRunQuery }: Props) {
47
47
// parse the JavaScript query
48
48
const { error, collection } = query . queryLanguage === QueryLanguage . JAVASCRIPT_SHADOW ? parseJsQuery ( queryText ) : parseJsQueryLegacy ( queryText ) ;
49
49
// let the same query text as it is
50
- onChange ( { ...query , queryText : queryText , ...( collection ? { collection} : { } ) } ) ;
50
+ onChange ( { ...query , queryText : queryText , ...( collection ? { collection } : { } ) } ) ;
51
51
setQueryTextError ( error ) ;
52
52
if ( ! error ) {
53
53
onRunQuery ( ) ;
@@ -95,7 +95,7 @@ export function QueryEditor({ query, onChange, onRunQuery }: Props) {
95
95
< Select id = "query-editor-query-type" options = { queryTypes } value = { query . queryType || QueryType . TIMESERIES } onChange = { onQueryTypeChange } > </ Select >
96
96
</ InlineField >
97
97
< InlineField label = "Collection" tooltip = "Enter the collection to query"
98
- error = "Please enter the collection" invalid = { ! query . collection } >
98
+ error = "Please enter the collection" invalid = { ! query . collection } >
99
99
< Input id = "query-editor-collection" onChange = { onCollectionChange } value = { query . collection } required />
100
100
</ InlineField >
101
101
</ InlineFieldRow >
@@ -106,7 +106,7 @@ export function QueryEditor({ query, onChange, onRunQuery }: Props) {
106
106
< Field label = "Query Text" description = { `Enter the Mongo Aggregation Pipeline (${ query . queryLanguage } )` }
107
107
error = { queryTextError } invalid = { queryTextError != null } >
108
108
< CodeEditor onEditorDidMount = { onCodeEditorDidMount } width = "100%" height = { 300 } language = { query . queryLanguage === QueryLanguage . JAVASCRIPT || query . queryLanguage === QueryLanguage . JAVASCRIPT_SHADOW ? "javascript" : "json" }
109
- onBlur = { onQueryTextChange } value = { query . queryText || "" } showMiniMap = { false } showLineNumbers = { true } />
109
+ onBlur = { onQueryTextChange } value = { query . queryText || "" } showMiniMap = { false } showLineNumbers = { true } monacoOptions = { { fontSize : 14 } } />
110
110
</ Field >
111
111
< Button onClick = { onFormatQueryText } > Format</ Button >
112
112
</ >
0 commit comments