diff --git a/client/app/components/ParameterMappingInput.jsx b/client/app/components/ParameterMappingInput.jsx index 42ef2e371e..ad455b8a6b 100644 --- a/client/app/components/ParameterMappingInput.jsx +++ b/client/app/components/ParameterMappingInput.jsx @@ -16,8 +16,7 @@ import Form from 'antd/lib/form'; import Tooltip from 'antd/lib/tooltip'; import { ParameterValueInput } from '@/components/ParameterValueInput'; import { ParameterMappingType } from '@/services/widget'; -import { clientConfig } from '@/services/auth'; -import { Query, Parameter } from '@/services/query'; +import { Parameter } from '@/services/query'; import { HelpTrigger } from '@/components/HelpTrigger'; import './ParameterMappingInput.less'; @@ -120,8 +119,6 @@ export class ParameterMappingInput extends React.Component { mapping: PropTypes.object, // eslint-disable-line react/forbid-prop-types existingParamNames: PropTypes.arrayOf(PropTypes.string), onChange: PropTypes.func, - clientConfig: PropTypes.any, // eslint-disable-line react/forbid-prop-types - Query: PropTypes.any, // eslint-disable-line react/forbid-prop-types inputError: PropTypes.string, }; @@ -129,8 +126,6 @@ export class ParameterMappingInput extends React.Component { mapping: {}, existingParamNames: [], onChange: () => {}, - clientConfig: null, - Query: null, inputError: null, }; @@ -159,6 +154,10 @@ export class ParameterMappingInput extends React.Component { updateParamMapping = (update) => { const { onChange, mapping } = this.props; const newMapping = extend({}, mapping, update); + if (newMapping.value !== mapping.value) { + newMapping.param = newMapping.param.clone(); + newMapping.param.setValue(newMapping.value); + } onChange(newMapping); }; @@ -228,9 +227,8 @@ export class ParameterMappingInput extends React.Component { value={mapping.param.normalizedValue} enumOptions={mapping.param.enumOptions} queryId={mapping.param.queryId} + parameter={mapping.param} onSelect={value => this.updateParamMapping({ value })} - clientConfig={this.props.clientConfig} - Query={this.props.Query} /> ); } @@ -345,8 +343,6 @@ class MappingEditor extends React.Component { mapping={mapping} existingParamNames={this.props.existingParamNames} onChange={this.onChange} - clientConfig={clientConfig} - Query={Query} inputError={inputError} />