Skip to content

Commit

Permalink
[Lens] Fix filter labels (elastic#211998)
Browse files Browse the repository at this point in the history
Fixes issue causing filter labels to render as `undefined`. Filter labels now display correctly.
  • Loading branch information
nickofthyme authored and JoseLuisGJ committed Feb 27, 2025
1 parent 9e2a5c4 commit f45edf6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ export interface FilterContentProps {
}

export function FilterContent({ filter, valueLabel, fieldLabel, hideAlias }: FilterContentProps) {
if (!hideAlias && filter.meta.alias !== null) {
if (!hideAlias && filter.meta.alias != null) {
return (
<>
<Prefix prefix={filter.meta.negate} />
<FilterValue value={`${filter.meta.alias}`} />
<FilterValue value={filter.meta.alias} />
</>
);
}
Expand Down
8 changes: 8 additions & 0 deletions x-pack/test/functional/apps/lens/group4/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardAddPanel.closeAddPanel();
await retry.try(async () => {
await clickInChart(30, 5); // hardcoded position of bar, depends heavy on data and charts implementation
const filters = await find.allByCssSelector('.euiCheckbox');
expect(filters).length(2);
const [timeFilter, ipFilter] = filters;
expect(await timeFilter.getVisibleText()).to.be(
'@timestamp: Sep 21, 2015 @ 09:00:00.000 to Sep 21, 2015 @ 12:00:00.000'
);
expect(await ipFilter.getVisibleText()).to.be('ip: 97.220.3.248');

await testSubjects.existOrFail('applyFiltersPopoverButton', { timeout: 2500 });
});

Expand Down

0 comments on commit f45edf6

Please sign in to comment.