import React, { FormEvent, PureComponent } from 'react'; import { MapDispatchToProps, MapStateToProps } from 'react-redux'; import { selectors } from '@grafana/e2e-selectors'; import { VerticalGroup } from '@grafana/ui'; import { connectWithStore } from 'app/core/utils/connectWithReduxStore'; import { StoreState } from 'app/types'; import { SelectionOptionsEditor } from '../editor/SelectionOptionsEditor'; import { VariableSectionHeader } from '../editor/VariableSectionHeader'; import { VariableTextAreaField } from '../editor/VariableTextAreaField'; import { OnPropChangeArguments, VariableEditorProps } from '../editor/types'; import { changeVariableMultiValue } from '../state/actions'; import { CustomVariableModel, VariableWithMultiSupport } from '../types'; interface OwnProps extends VariableEditorProps {} interface ConnectedProps {} interface DispatchProps { changeVariableMultiValue: typeof changeVariableMultiValue; } export type Props = OwnProps & ConnectedProps & DispatchProps; class CustomVariableEditorUnconnected extends PureComponent { onChange = (event: FormEvent) => { this.props.onPropChange({ propName: 'query', propValue: event.currentTarget.value, }); }; onSelectionOptionsChange = async ({ propName, propValue }: OnPropChangeArguments) => { this.props.onPropChange({ propName, propValue, updateOptions: true }); }; onBlur = (event: FormEvent) => { this.props.onPropChange({ propName: 'query', propValue: event.currentTarget.value, updateOptions: true, }); }; render() { return ( {' '} ); } } const mapStateToProps: MapStateToProps = (state, ownProps) => ({}); const mapDispatchToProps: MapDispatchToProps = { changeVariableMultiValue, }; export const CustomVariableEditor = connectWithStore( CustomVariableEditorUnconnected, mapStateToProps, mapDispatchToProps );