Commit 086c77f5 by Ivana Huckova Committed by GitHub

Loki: Remove showing of unique labels with the empty string value (#30363)

* Remove empty unique label values

* Add test

* Simplify
parent 202f88c6
......@@ -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])}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment