Fix PromQuery cascader when selected option has no children (#23835)

This commit is contained in:
Ivana Huckova 2020-04-24 09:45:44 +02:00 committed by GitHub
parent e18e4cf015
commit 47c6bd6963
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,8 +199,9 @@ class PromQueryField extends React.PureComponent<PromQueryFieldProps, PromQueryF
onChangeMetrics = (values: string[], selectedOptions: CascaderOption[]) => {
let query;
if (selectedOptions.length === 1) {
if (selectedOptions[0].children.length === 0) {
query = selectedOptions[0].value;
const selectedOption = selectedOptions[0];
if (!selectedOption.children || selectedOption.children.length === 0) {
query = selectedOption.value;
} else {
// Ignore click on group
return;