;
@@ -84,6 +85,7 @@ export class Embeddable
private subscription: Subscription;
private autoRefreshFetchSubscription: Subscription;
private isInitialized = false;
+ private activeData: LensInspectorAdapters | undefined;
private externalSearchContext: {
timeRange?: TimeRange;
@@ -131,6 +133,10 @@ export class Embeddable
}
}
+ public getInspectorAdapters() {
+ return this.activeData;
+ }
+
async initializeSavedVis(input: LensEmbeddableInput) {
const attributes:
| LensSavedObjectAttributes
@@ -175,6 +181,13 @@ export class Embeddable
}
}
+ private updateActiveData = (
+ data: unknown,
+ inspectorAdapters?: LensInspectorAdapters | undefined
+ ) => {
+ this.activeData = inspectorAdapters;
+ };
+
/**
*
* @param {HTMLElement} domNode
@@ -194,6 +207,7 @@ export class Embeddable
variables={input.palette ? { theme: { palette: input.palette } } : {}}
searchSessionId={this.input.searchSessionId}
handleEvent={this.handleEvent}
+ onData$={this.updateActiveData}
renderMode={input.renderMode}
/>,
domNode
diff --git a/x-pack/plugins/lens/public/editor_frame_service/embeddable/expression_wrapper.tsx b/x-pack/plugins/lens/public/editor_frame_service/embeddable/expression_wrapper.tsx
index d18372246b0e..464542089831 100644
--- a/x-pack/plugins/lens/public/editor_frame_service/embeddable/expression_wrapper.tsx
+++ b/x-pack/plugins/lens/public/editor_frame_service/embeddable/expression_wrapper.tsx
@@ -15,6 +15,7 @@ import {
import { ExecutionContextSearch } from 'src/plugins/data/public';
import { RenderMode } from 'src/plugins/expressions';
import { getOriginalRequestErrorMessage } from '../error_helper';
+import { LensInspectorAdapters } from '../types';
export interface ExpressionWrapperProps {
ExpressionRenderer: ReactExpressionRendererType;
@@ -23,6 +24,7 @@ export interface ExpressionWrapperProps {
searchContext: ExecutionContextSearch;
searchSessionId?: string;
handleEvent: (event: ExpressionRendererEvent) => void;
+ onData$: (data: unknown, inspectorAdapters?: LensInspectorAdapters | undefined) => void;
renderMode?: RenderMode;
}
@@ -33,6 +35,7 @@ export function ExpressionWrapper({
variables,
handleEvent,
searchSessionId,
+ onData$,
renderMode,
}: ExpressionWrapperProps) {
return (
@@ -60,6 +63,7 @@ export function ExpressionWrapper({
expression={expression}
searchContext={searchContext}
searchSessionId={searchSessionId}
+ onData$={onData$}
renderMode={renderMode}
renderError={(errorMessage, error) => (
diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts
index 2f9310ee24ae..24075facb68e 100644
--- a/x-pack/plugins/lens/public/plugin.ts
+++ b/x-pack/plugins/lens/public/plugin.ts
@@ -5,13 +5,16 @@
*/
import { AppMountParameters, CoreSetup, CoreStart } from 'kibana/public';
-import { DataPublicPluginSetup, DataPublicPluginStart } from 'src/plugins/data/public';
-import { EmbeddableSetup, EmbeddableStart } from 'src/plugins/embeddable/public';
-import { DashboardStart } from 'src/plugins/dashboard/public';
-import { ExpressionsSetup, ExpressionsStart } from 'src/plugins/expressions/public';
-import { VisualizationsSetup, VisualizationsStart } from 'src/plugins/visualizations/public';
-import { NavigationPublicPluginStart } from 'src/plugins/navigation/public';
-import { UrlForwardingSetup } from 'src/plugins/url_forwarding/public';
+import { DataPublicPluginSetup, DataPublicPluginStart } from '../../../../src/plugins/data/public';
+import { EmbeddableSetup, EmbeddableStart } from '../../../../src/plugins/embeddable/public';
+import { DashboardStart } from '../../../../src/plugins/dashboard/public';
+import { ExpressionsSetup, ExpressionsStart } from '../../../../src/plugins/expressions/public';
+import {
+ VisualizationsSetup,
+ VisualizationsStart,
+} from '../../../../src/plugins/visualizations/public';
+import { NavigationPublicPluginStart } from '../../../../src/plugins/navigation/public';
+import { UrlForwardingSetup } from '../../../../src/plugins/url_forwarding/public';
import { GlobalSearchPluginSetup } from '../../global_search/public';
import { ChartsPluginSetup, ChartsPluginStart } from '../../../../src/plugins/charts/public';
import { EditorFrameService } from './editor_frame_service';
@@ -64,6 +67,7 @@ export interface LensPluginStartDependencies {
charts: ChartsPluginStart;
savedObjectsTagging?: SavedObjectTaggingPluginStart;
}
+
export class LensPlugin {
private datatableVisualization: DatatableVisualization;
private editorFrameService: EditorFrameService;
diff --git a/x-pack/test/functional/apps/lens/dashboard.ts b/x-pack/test/functional/apps/lens/dashboard.ts
index 17b70b8510f0..c332d0503925 100644
--- a/x-pack/test/functional/apps/lens/dashboard.ts
+++ b/x-pack/test/functional/apps/lens/dashboard.ts
@@ -140,5 +140,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const hasGeoSrcFilter = await filterBar.hasFilter('geo.src', 'US', true, true);
expect(hasGeoSrcFilter).to.be(true);
});
+
+ it('CSV export action exists in panel context menu', async () => {
+ const ACTION_ID = 'ACTION_EXPORT_CSV';
+ const ACTION_TEST_SUBJ = `embeddablePanelAction-${ACTION_ID}`;
+ await PageObjects.common.navigateToApp('dashboard');
+ await PageObjects.dashboard.clickNewDashboard();
+ await dashboardAddPanel.clickOpenAddPanel();
+ await dashboardAddPanel.filterEmbeddableNames('lnsPieVis');
+ await find.clickByButtonText('lnsPieVis');
+ await dashboardAddPanel.closeAddPanel();
+
+ await panelActions.openContextMenu();
+ await panelActions.clickContextMenuMoreItem();
+ await testSubjects.existOrFail(ACTION_TEST_SUBJ);
+ });
});
}