-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Lens] Basic layouting #39587
Merged
Merged
[Lens] Basic layouting #39587
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c2b00cf
add basic layout
flash1293 754b29f
fix basic styling issues
flash1293 b87f18e
fix tests
flash1293 ed3cf75
remove unused import
flash1293 2634b9d
Merge branch 'feature/lens' into lens/styling
flash1293 0dcc1f4
PR review fixes
flash1293 e10488d
remove important marker
flash1293 68d50ca
size right side bar correctly
flash1293 d89743b
Merge branch 'feature/lens' into lens/styling
flash1293 094fa73
Merge branch 'feature/lens' into lens/styling
flash1293 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/editor_frame.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
.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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
|
@@ -137,6 +146,7 @@ export function WorkspacePanel({ | |
} else { | ||
return ( | ||
<ExpressionRendererComponent | ||
className="lnsExpressionOutput" | ||
expression={expression!} | ||
onRenderFailure={(e: unknown) => { | ||
setExpressionError(e); | ||
|
@@ -147,8 +157,19 @@ export function WorkspacePanel({ | |
} | ||
|
||
return ( | ||
<DragDrop draggable={false} droppable={true} onDrop={onDrop}> | ||
{renderVisualization()} | ||
</DragDrop> | ||
<EuiPageContent className="lnsPageContent"> | ||
<EuiPageContentHeader className="lnsPageContentHeader"> | ||
<EuiPageContentHeaderSection> | ||
<EuiTitle size="xs"> | ||
<h2>New Visualization</h2> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This text should be localized. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’m waiting for your save/load PR here, @chrisdavies As soon as that one is merged, we can show the actual name instead |
||
</EuiTitle> | ||
</EuiPageContentHeaderSection> | ||
</EuiPageContentHeader> | ||
<EuiPageContentBody className="lnsPageContentBody"> | ||
<DragDrop draggable={false} droppable={Boolean(dragDropContext.dragging)} onDrop={onDrop}> | ||
{renderVisualization()} | ||
</DragDrop> | ||
</EuiPageContentBody> | ||
</EuiPageContent> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_expression.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
.lnsChart { | ||
// TODO style this dependent on the screen height (see POC) | ||
height: 500px; | ||
height: 100%; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're adding
overflow: hidden
here, please also add a scrollbar to the data panel- without a scrollbar it's cutting off labels both horizontally and vertically.