Skip to content

Commit

Permalink
[8.x] [Lens] Fix filter labels (elastic#211998) (elastic#212287)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Lens] Fix filter labels
(elastic#211998)](elastic#211998)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Nick
Partridge","email":"nicholas.partridge@elastic.co"},"sourceCommit":{"committedDate":"2025-02-24T17:02:48Z","message":"[Lens]
Fix filter labels (elastic#211998)\n\nFixes issue causing filter labels to
render as `undefined`. Filter labels now display
correctly.","sha":"4a8928d5d44dc1e6363389bc0bd1f20049fa86ec","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Team:Visualizations","release_note:skip","v9.0.0","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Lens]
Fix filter
labels","number":211998,"url":"https://github.com/elastic/kibana/pull/211998","mergeCommit":{"message":"[Lens]
Fix filter labels (elastic#211998)\n\nFixes issue causing filter labels to
render as `undefined`. Filter labels now display
correctly.","sha":"4a8928d5d44dc1e6363389bc0bd1f20049fa86ec"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/211998","number":211998,"mergeCommit":{"message":"[Lens]
Fix filter labels (elastic#211998)\n\nFixes issue causing filter labels to
render as `undefined`. Filter labels now display
correctly.","sha":"4a8928d5d44dc1e6363389bc0bd1f20049fa86ec"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co>
  • Loading branch information
kibanamachine and nickofthyme authored Feb 24, 2025
1 parent ce7f4a5 commit 18dd1f4
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 @@ -77,6 +77,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await lens.goToTimeRange();
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 18dd1f4

Please sign in to comment.