influxdb: flux-editor: fix html.onchange bug with angular, improve types (#31765)

* influxdb: flux-editor: fix html.onchange bug with angular, improve types

* influx: flux: simplified bug-fix
This commit is contained in:
Gábor Farkas 2021-03-11 17:24:48 +01:00 committed by GitHub
parent ee547b4410
commit 3139a60012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import React, { PureComponent } from 'react';
import coreModule from 'app/core/core_module';
import { InfluxQuery } from '../types';
import { SelectableValue, QueryEditorProps } from '@grafana/data';
import { SelectableValue } from '@grafana/data';
import { cx, css } from 'emotion';
import {
InlineFormLabel,
@ -14,8 +14,16 @@ import {
import { getTemplateSrv } from '@grafana/runtime';
import InfluxDatasource from '../datasource';
// @ts-ignore -- complicated since the datasource is not really reactified yet!
type Props = QueryEditorProps<InfluxDatasource, InfluxQuery>;
type Props = {
onChange: (query: InfluxQuery) => void;
onRunQuery: () => void;
query: InfluxQuery;
// `datasource` is not used internally, but this component is used at some places
// directly, where the `datasource` prop has to exist. later, when the whole
// query-editor gets converted to react we can stop using this component directly
// and then we can probably remove the datasource attribute.
datasource: InfluxDatasource;
};
const samples: Array<SelectableValue<string>> = [
{ label: 'Show buckets', description: 'List the available buckets (table)', value: 'buckets()' },

View File

@ -2,7 +2,7 @@
<query-editor-row ng-if="ctrl.datasource.isFlux" query-ctrl="ctrl" can-collapse="true" has-text-edit-mode="true">
<flux-query-editor
query="ctrl.target"
onChange="ctrl.onChange"
on-change="ctrl.onChange"
onRunQuery="ctrl.onRunQuery"
></flux-query-editor>
</query-editor-row>
@ -237,4 +237,4 @@
</div>
</div>
</div>
</query-editor-row>
</query-editor-row>