* Prometheus,Loki: Fix showing of duplicated values in dropdown
* Use different more readable solution
* Update
(cherry picked from commit 77bdbe1dea)
Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
This commit is contained in:
co-authored by
Ivana Huckova
parent
001f3709ae
commit
da76c87bfe
@@ -1,3 +1,4 @@
|
||||
import { uniqBy } from 'lodash';
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import { SelectableValue, toOption } from '@grafana/data';
|
||||
@@ -38,7 +39,11 @@ export function LabelFilterItem({ item, defaultOp, onChange, onDelete, onGetLabe
|
||||
};
|
||||
|
||||
const getOptions = (): SelectableValue[] => {
|
||||
return [...getSelectOptionsFromString(item?.value).map(toOption), ...(state.labelValues ?? [])];
|
||||
const labelValues = state.labelValues ? [...state.labelValues] : [];
|
||||
const selectedOptions = getSelectOptionsFromString(item?.value).map(toOption);
|
||||
|
||||
// Remove possible duplicated values
|
||||
return uniqBy([...selectedOptions, ...labelValues], 'value');
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user