diff --git a/ui/src/kapacitor/components/DataSection.js b/ui/src/kapacitor/components/DataSection.js index 4261522e6e..007d337a21 100644 --- a/ui/src/kapacitor/components/DataSection.js +++ b/ui/src/kapacitor/components/DataSection.js @@ -7,6 +7,8 @@ import FieldList from 'src/shared/components/FieldList' import {defaultEveryFrequency} from 'src/kapacitor/constants' +import {SourceContext} from 'src/CheckSources' + const makeQueryHandlers = (actions, query) => ({ handleChooseNamespace: namespace => { actions.chooseNamespace(query.id, namespace) @@ -66,28 +68,36 @@ const DataSection = ({ } = makeQueryHandlers(actions, query) return ( -
-
- - - {isDeadman ? null : ( - - )} -
-
+ + {source => ( +
+
+ + + {isDeadman ? null : ( + + )} +
+
+ )} +
) } diff --git a/ui/src/shared/components/FieldList.tsx b/ui/src/shared/components/FieldList.tsx index 81ce2df784..2b0415fb95 100644 --- a/ui/src/shared/components/FieldList.tsx +++ b/ui/src/shared/components/FieldList.tsx @@ -61,18 +61,15 @@ interface Props { addInitialField: (field: Field, groupBy: GroupBy) => void initialGroupByTime: string | null isQuerySupportedByExplorer: boolean + source: Source } interface State { fields: Field[] } -interface Context { - source: Source -} @ErrorHandling class FieldList extends PureComponent { - public static context: Context public static defaultProps: Partial = { isKapacitorRule: false, initialGroupByTime: null, @@ -249,8 +246,7 @@ class FieldList extends PureComponent { private getFields = (): void => { const {database, measurement, retentionPolicy} = this.props.query - const {source} = this.context - const {querySource} = this.props + const {querySource, source} = this.props const proxy = _.get(querySource, ['links', 'proxy'], null) || source.links.proxy