Chore(loki-query-field): destructure all props

This commit is contained in:
Matias Chomicki 2022-10-05 16:34:12 +02:00
parent 21e4390857
commit 7b9180c0a1

View File

@ -186,6 +186,9 @@ export class LokiQueryField extends React.PureComponent<LokiQueryFieldProps, Lok
app, app,
datasource, datasource,
placeholder = 'Enter a Loki query (run with Shift+Enter)', placeholder = 'Enter a Loki query (run with Shift+Enter)',
history,
onRunQuery,
onBlur,
} = this.props; } = this.props;
const { labelsLoaded, labelBrowserVisible } = this.state; const { labelsLoaded, labelBrowserVisible } = this.state;
@ -213,11 +216,11 @@ export class LokiQueryField extends React.PureComponent<LokiQueryFieldProps, Lok
<div className="gf-form gf-form--grow flex-shrink-1 min-width-15"> <div className="gf-form gf-form--grow flex-shrink-1 min-width-15">
{config.featureToggles.lokiMonacoEditor ? ( {config.featureToggles.lokiMonacoEditor ? (
<MonacoQueryFieldWrapper <MonacoQueryFieldWrapper
runQueryOnBlur={this.props.app !== CoreApp.Explore} runQueryOnBlur={app !== CoreApp.Explore}
languageProvider={datasource.languageProvider} languageProvider={datasource.languageProvider}
history={this.props.history ?? []} history={history ?? []}
onChange={this.onChangeQuery} onChange={this.onChangeQuery}
onRunQuery={this.props.onRunQuery} onRunQuery={onRunQuery}
initialValue={query.expr ?? ''} initialValue={query.expr ?? ''}
/> />
) : ( ) : (
@ -228,8 +231,8 @@ export class LokiQueryField extends React.PureComponent<LokiQueryFieldProps, Lok
onTypeahead={this.onTypeahead} onTypeahead={this.onTypeahead}
onWillApplySuggestion={willApplySuggestion} onWillApplySuggestion={willApplySuggestion}
onChange={this.onChangeQuery} onChange={this.onChangeQuery}
onBlur={this.props.onBlur} onBlur={onBlur}
onRunQuery={this.props.onRunQuery} onRunQuery={onRunQuery}
placeholder={placeholder} placeholder={placeholder}
portalOrigin="loki" portalOrigin="loki"
/> />