mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Convert2Lens] Carry vis filters to the converted Vis (#151255)
## Summary Closes https://github.com/elastic/kibana/issues/151234 Solves the bug described in the issue. If the visualization has filters/query, when converted the filters are carried to the converted viz (unreleased bug) ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
82c0d6c234
commit
cb03bb67c1
2 changed files with 28 additions and 2 deletions
|
@ -71,9 +71,12 @@ export class EditInLensAction implements Action<EditInLensContext> {
|
|||
if (isVisualizeEmbeddable(embeddable)) {
|
||||
const vis = embeddable.getVis();
|
||||
const navigateToLensConfig = await vis.type.navigateToLens?.(vis, this.timefilter);
|
||||
// Filters and query set on the visualization level
|
||||
const visFilters = vis.data.searchSource?.getField('filter');
|
||||
const visQuery = vis.data.searchSource?.getField('query');
|
||||
const parentSearchSource = vis.data.searchSource?.getParent();
|
||||
const searchFilters = parentSearchSource?.getField('filter');
|
||||
const searchQuery = parentSearchSource?.getField('query');
|
||||
const searchFilters = parentSearchSource?.getField('filter') ?? visFilters;
|
||||
const searchQuery = parentSearchSource?.getField('query') ?? visQuery;
|
||||
const title = vis.title || embeddable.getOutput().title;
|
||||
const updatedWithMeta = {
|
||||
...navigateToLensConfig,
|
||||
|
|
|
@ -75,5 +75,28 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
await dashboard.waitForRenderComplete();
|
||||
expect(await dashboard.isNotificationExists(1)).to.be(false);
|
||||
});
|
||||
|
||||
it('should carry the visualizations filters to Lens', async () => {
|
||||
await dashboardAddPanel.clickEditorMenuButton();
|
||||
await dashboardAddPanel.clickAggBasedVisualizations();
|
||||
await dashboardAddPanel.clickVisType('histogram');
|
||||
await testSubjects.click('savedObjectTitlelogstash-*');
|
||||
await filterBar.addFilter({ field: 'geo.src', operation: 'is', value: 'CN' });
|
||||
await testSubjects.exists('visualizesaveAndReturnButton');
|
||||
await testSubjects.click('visualizesaveAndReturnButton');
|
||||
await dashboard.waitForRenderComplete();
|
||||
|
||||
expect(await dashboard.isNotificationExists(2)).to.be(true);
|
||||
const panel = (await dashboard.getDashboardPanels())[2];
|
||||
await panelActions.convertToLens(panel);
|
||||
await lens.waitForVisualization('xyVisChart');
|
||||
|
||||
const filterCount = await filterBar.getFilterCount();
|
||||
expect(filterCount).to.equal(1);
|
||||
await lens.replaceInDashboard();
|
||||
await dashboard.waitForRenderComplete();
|
||||
|
||||
expect(await dashboard.isNotificationExists(2)).to.be(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue