[Lens] Fix filter labels (#211998)

Fixes issue causing filter labels to render as `undefined`. Filter labels now display correctly.
This commit is contained in:
Nick Partridge 2025-02-24 10:02:48 -07:00 committed by GitHub
parent 46c8c17728
commit 4a8928d5d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -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} />
</>
);
}

View file

@ -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 });
});