mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki: Remove showing of unique labels with the empty string value (#30363)
* Remove empty unique label values * Add test * Simplify
This commit is contained in:
parent
202f88c610
commit
086c77f5e3
@ -20,4 +20,9 @@ describe('<LogLabels />', () => {
|
||||
expect(wrapper.text()).not.toContain('42');
|
||||
expect(wrapper.text()).not.toContain('13');
|
||||
});
|
||||
it('excludes labels with empty string values', () => {
|
||||
const wrapper = shallow(<LogLabels labels={{ foo: 'bar', baz: '' }} theme={getTheme()} />);
|
||||
expect(wrapper.text()).toContain('bar');
|
||||
expect(wrapper.html()).not.toContain('baz');
|
||||
});
|
||||
});
|
||||
|
@ -59,6 +59,9 @@ export const UnThemedLogLabels: FunctionComponent<Props> = ({ labels, theme }) =
|
||||
<span className={cx([styles.logsLabels])}>
|
||||
{displayLabels.sort().map(label => {
|
||||
const value = labels[label];
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
const tooltip = `${label}: ${value}`;
|
||||
return (
|
||||
<span key={label} className={cx([styles.logsLabel])}>
|
||||
|
Loading…
Reference in New Issue
Block a user