mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki: Fix showing of duplicated label values in dropdown in query builder (#50680)
* Prometheus,Loki: Fix showing of duplicated values in dropdown * Use different more readable solution * Update
This commit is contained in:
parent
95d49711b2
commit
77bdbe1dea
@ -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 (
|
||||
|
Loading…
Reference in New Issue
Block a user