diff --git a/client/app/components/ParameterMappingInput.jsx b/client/app/components/ParameterMappingInput.jsx index 05c2f80925..e978b8cb42 100644 --- a/client/app/components/ParameterMappingInput.jsx +++ b/client/app/components/ParameterMappingInput.jsx @@ -17,7 +17,7 @@ import Form from 'antd/lib/form'; import Tooltip from 'antd/lib/tooltip'; import ParameterValueInput from '@/components/ParameterValueInput'; import { ParameterMappingType } from '@/services/widget'; -import { Parameter } from '@/services/query'; +import { Parameter } from '@/services/parameters'; import HelpTrigger from '@/components/HelpTrigger'; import './ParameterMappingInput.less'; @@ -545,11 +545,11 @@ export class ParameterMappingListInput extends React.Component { param = param.clone().setValue(mapping.value); } - let value = Parameter.getValue(param); + let value = Parameter.getExecutionValue(param); // in case of dynamic value display the name instead of value if (param.hasDynamicValue) { - value = param.dynamicValue.name; + value = param.normalizedValue.name; } return this.getStringValue(value); diff --git a/client/app/components/ParameterValueInput.jsx b/client/app/components/ParameterValueInput.jsx index feb3ece900..7f28ad33a8 100644 --- a/client/app/components/ParameterValueInput.jsx +++ b/client/app/components/ParameterValueInput.jsx @@ -5,7 +5,7 @@ import Input from 'antd/lib/input'; import InputNumber from 'antd/lib/input-number'; import DateParameter from '@/components/dynamic-parameters/DateParameter'; import DateRangeParameter from '@/components/dynamic-parameters/DateRangeParameter'; -import { toString } from 'lodash'; +import { isEqual } from 'lodash'; import { QueryBasedParameterInput } from './QueryBasedParameterInput'; import './ParameterValueInput.less'; @@ -59,7 +59,7 @@ class ParameterValueInput extends React.Component { } onSelect = (value) => { - const isDirty = toString(value) !== toString(this.props.value); + const isDirty = !isEqual(value, this.props.value); this.setState({ value, isDirty }); this.props.onSelect(value, isDirty); } @@ -96,13 +96,15 @@ class ParameterValueInput extends React.Component { const { enumOptions, parameter } = this.props; const { value } = this.state; const enumOptionsArray = enumOptions.split('\n').filter(v => v !== ''); + // Antd Select doesn't handle null in multiple mode + const normalize = val => (parameter.multiValuesOptions && val === null ? [] : val); return (