diff --git a/x-pack/legacy/plugins/lens/public/app_plugin/app.tsx b/x-pack/legacy/plugins/lens/public/app_plugin/app.tsx
index 16860142e28d0..0e469dbeb5634 100644
--- a/x-pack/legacy/plugins/lens/public/app_plugin/app.tsx
+++ b/x-pack/legacy/plugins/lens/public/app_plugin/app.tsx
@@ -13,11 +13,7 @@ import { NativeRenderer } from '../native_renderer';
export function App({ editorFrame }: { editorFrame: EditorFrameInstance }) {
return (
-
-
Lens
-
-
-
+
);
}
diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/frame_layout.tsx b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/frame_layout.tsx
index cae1b6b90ccd9..18f619f9d54db 100644
--- a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/frame_layout.tsx
+++ b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/frame_layout.tsx
@@ -5,7 +5,7 @@
*/
import React from 'react';
-import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
+import { EuiPage, EuiPageSideBar, EuiPageBody } from '@elastic/eui';
import { RootDragDropProvider } from '../../drag_drop';
export interface FrameLayoutProps {
@@ -18,15 +18,16 @@ export interface FrameLayoutProps {
export function FrameLayout(props: FrameLayoutProps) {
return (
-
- {/* TODO style this and add workspace prop and loading flags */}
- {props.dataPanel}
- {props.workspacePanel}
-
+
+ {props.dataPanel}
+
+ {props.workspacePanel}
+
+
{props.configPanel}
{props.suggestionsPanel}
-
-
+
+
);
}
diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/index.scss b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/index.scss
index 182e36df61797..d384c03195538 100644
--- a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/index.scss
+++ b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/index.scss
@@ -1,2 +1,76 @@
-@import './workspace_panel.scss';
+
+.lnsPage {
+ padding: 0;
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ overflow: hidden;
+}
+
+.lnsSidebar {
+ @include euiScrollBar;
+ overflow: hidden auto;
+ padding: $euiSize;
+ margin: 0;
+ flex: 1 0 18%;
+ min-width: ($euiSize * 16);
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
+.lnsSidebar--right {
+ min-width: ($euiSize * 18);
+}
+
+.lnsPageBody {
+ @include euiScrollBar;
+ padding-top: $euiSize;
+ padding-bottom: $euiSize;
+ overflow: hidden auto;
+
+ &:first-child {
+ padding-left: $euiSize;
+ }
+
+ .lnsPageContent {
+ padding: 0;
+ display: flex;
+ flex-direction: column;
+
+ .lnsPageContentHeader {
+ padding: $euiSize;
+ border-bottom: $euiBorderThin;
+ margin-bottom: 0;
+ }
+
+ .lnsPageContentBody {
+ flex-grow: 1;
+ padding: $euiSizeXL;
+ display: flex;
+ align-items: stretch;
+ justify-content: stretch;
+
+ > * {
+ flex: 1 1 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ overflow-x: hidden;
+ }
+ }
+ }
+}
+
+.lnsExpressionOutput {
+ width: 100%;
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ overflow-x: hidden;
+}
+
@import './suggestion_panel.scss';
\ No newline at end of file
diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/workspace_panel.scss b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/workspace_panel.scss
deleted file mode 100644
index 03c3534e1e12b..0000000000000
--- a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/workspace_panel.scss
+++ /dev/null
@@ -1,3 +0,0 @@
- .lnsChartWrapper {
- height: 500px;
- }
\ No newline at end of file
diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/workspace_panel.test.tsx b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/workspace_panel.test.tsx
index 1b5d89f50bdd4..ef8b152ee9a1e 100644
--- a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/workspace_panel.test.tsx
+++ b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/workspace_panel.test.tsx
@@ -17,6 +17,7 @@ import {
import { WorkspacePanel, WorkspacePanelProps } from './workspace_panel';
import { mountWithIntl as mount } from 'test_utils/enzyme_helpers';
import { ReactWrapper } from 'enzyme';
+import { DragDrop } from '../../drag_drop';
const waitForPromises = () => new Promise(resolve => setTimeout(resolve));
@@ -318,7 +319,7 @@ Object {
},
]);
- instance.childAt(0).prop('onDrop')({
+ instance.find(DragDrop).prop('onDrop')!({
name: '@timestamp',
type: 'date',
searchable: false,
@@ -378,7 +379,7 @@ Object {
},
]);
- instance.childAt(0).prop('onDrop')({
+ instance.find(DragDrop).prop('onDrop')!({
name: '@timestamp',
type: 'date',
searchable: false,
@@ -396,7 +397,7 @@ Object {
});
it("should do nothing when the visualization can't use the suggestions", () => {
- instance.childAt(0).prop('onDrop')({
+ instance.find(DragDrop).prop('onDrop')!({
name: '@timestamp',
type: 'date',
searchable: false,
diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/workspace_panel.tsx b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/workspace_panel.tsx
index b65941e1838c2..d17b06c3b1a9e 100644
--- a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/workspace_panel.tsx
+++ b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/workspace_panel.tsx
@@ -4,15 +4,23 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import React, { useState, useEffect, useMemo } from 'react';
+import React, { useState, useEffect, useMemo, useContext } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
-import { EuiCodeBlock, EuiSpacer } from '@elastic/eui';
+import {
+ EuiCodeBlock,
+ EuiSpacer,
+ EuiPageContent,
+ EuiPageContentHeader,
+ EuiPageContentHeaderSection,
+ EuiTitle,
+ EuiPageContentBody,
+} from '@elastic/eui';
import { toExpression } from '@kbn/interpreter/common';
import { ExpressionRenderer } from '../../../../../../../src/legacy/core_plugins/data/public';
import { Action } from './state_management';
import { Datasource, Visualization, DatasourcePublicAPI } from '../../types';
-import { DragDrop } from '../../drag_drop';
+import { DragDrop, DragContext } from '../../drag_drop';
import { getSuggestions, toSwitchAction } from './suggestion_helpers';
import { buildExpression } from './expression_helpers';
@@ -37,6 +45,7 @@ export function WorkspacePanel({
dispatch,
ExpressionRenderer: ExpressionRendererComponent,
}: WorkspacePanelProps) {
+ const dragDropContext = useContext(DragContext);
function onDrop(item: unknown) {
const datasourceSuggestions = activeDatasource.getDatasourceSuggestionsForField(
datasourceState,
@@ -138,7 +147,7 @@ export function WorkspacePanel({
} else {
return (
{
setExpressionError(e);
@@ -149,8 +158,19 @@ export function WorkspacePanel({
}
return (
-
- {renderVisualization()}
-
+
+
+
+
+ New Visualization
+
+
+
+
+
+ {renderVisualization()}
+
+
+
);
}
diff --git a/x-pack/legacy/plugins/lens/public/native_renderer/native_renderer.test.tsx b/x-pack/legacy/plugins/lens/public/native_renderer/native_renderer.test.tsx
index 9b29174a06d69..07642e7936d25 100644
--- a/x-pack/legacy/plugins/lens/public/native_renderer/native_renderer.test.tsx
+++ b/x-pack/legacy/plugins/lens/public/native_renderer/native_renderer.test.tsx
@@ -121,6 +121,24 @@ describe('native_renderer', () => {
expect(containerElement.nodeName).toBe('DIV');
});
+ it('should pass regular html attributes to the wrapping element', () => {
+ const renderSpy = jest.fn();
+ const testProps = { a: 'abc' };
+
+ renderAndTriggerHooks(
+ ,
+ mountpoint
+ );
+ const containerElement: HTMLElement = mountpoint.firstElementChild! as HTMLElement;
+ expect(containerElement.className).toBe('testClass');
+ expect(containerElement.dataset.testSubj).toBe('container');
+ });
+
it('should render a specified element as container', () => {
const renderSpy = jest.fn();
const testProps = { a: 'abc' };
diff --git a/x-pack/legacy/plugins/lens/public/native_renderer/native_renderer.tsx b/x-pack/legacy/plugins/lens/public/native_renderer/native_renderer.tsx
index 3bc042660e646..08464dd65f67e 100644
--- a/x-pack/legacy/plugins/lens/public/native_renderer/native_renderer.tsx
+++ b/x-pack/legacy/plugins/lens/public/native_renderer/native_renderer.tsx
@@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import React from 'react';
+import React, { HTMLAttributes } from 'react';
-export interface NativeRendererProps {
+export interface NativeRendererProps extends HTMLAttributes {
render: (domElement: Element, props: T) => void;
nativeProps: T;
tag?: string;
@@ -20,8 +20,9 @@ export interface NativeRendererProps {
*
* @param props
*/
-export function NativeRenderer({ render, nativeProps, tag }: NativeRendererProps) {
+export function NativeRenderer({ render, nativeProps, tag, ...rest }: NativeRendererProps) {
return React.createElement(tag || 'div', {
+ ...rest,
ref: el => el && render(el, nativeProps),
});
}