Variables: fixes so single value picker closes dropdown on select (#22823)

pull/22829/head
Hugo Häggmark 5 years ago committed by GitHub
parent 2bed1bc2e7
commit 45784f58f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      public/app/features/variables/pickers/OptionsPicker/OptionsPicker.tsx

@ -39,11 +39,17 @@ export class OptionsPickerUnconnected extends PureComponent<Props> {
onHideOptions = () => this.props.commitChangesToVariable();
onToggleOption = (option: VariableOption, clearOthers: boolean) => {
this.props.toggleOption({
option,
clearOthers,
forceSelect: false,
});
const toggleFunc = this.props.variable.multi ? this.onToggleMultiValueVariable : this.onToggleSingleValueVariable;
toggleFunc(option, clearOthers);
};
onToggleSingleValueVariable = (option: VariableOption, clearOthers: boolean) => {
this.props.toggleOption({ option, clearOthers, forceSelect: false });
this.onHideOptions();
};
onToggleMultiValueVariable = (option: VariableOption, clearOthers: boolean) => {
this.props.toggleOption({ option, clearOthers, forceSelect: false });
};
render() {

Loading…
Cancel
Save