Skip to content
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

feat(flows): draggable visualizations #18486

Merged
merged 5 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: implement resizer for Visualizations
  • Loading branch information
alexpaxton committed Jun 12, 2020
commit 4b38d6226d9f57996b5398ff2feb224dd2ce1117
2 changes: 2 additions & 0 deletions ui/src/notebooks/pipes/Visualization/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ register({
component: View,
button: 'Visualization',
initial: {
panelVisibility: 'visible',
panelHeight: 200,
properties: {
type: 'xy',
position: 'overlaid',
Expand Down
8 changes: 4 additions & 4 deletions ui/src/notebooks/pipes/Visualization/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
.notebook-visualization {
background-color: $g2-kevlar;
border-radius: $cf-radius;
border: $cf-border solid $g2-kevlar;
display: flex;
align-items: stretch;
height: 100%;
}

.notebook-visualization--header {
Expand All @@ -14,15 +14,15 @@
}

.notebook-visualization--view {
flex: 1 0 0;
border-radius: $cf-radius - 1px;
width: 100%;
border-radius: $cf-radius-sm;
background-color: $g0-obsidian;
min-height: 200px;
padding: $cf-marg-b + $cf-marg-a;

.empty-graph-error {
height: 200px;
}

.time-machine-tables {
height: 200px;
}
Expand Down
49 changes: 29 additions & 20 deletions ui/src/notebooks/pipes/Visualization/view.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
// Libraries
import React, {FC, useContext} from 'react'
import {PipeProp} from 'src/notebooks'

// Components
import EmptyQueryView, {ErrorFormat} from 'src/shared/components/EmptyQueryView'
import ViewSwitcher from 'src/shared/components/ViewSwitcher'
import {ViewTypeDropdown} from 'src/timeMachine/components/view_options/ViewTypeDropdown'
import Resizer from 'src/notebooks/pipes/Query/Resizer'

// Utilities
import {checkResultsLength} from 'src/shared/utils/vis'
import {ViewType} from 'src/types'
import {createView} from 'src/views/helpers'

// Types
import {PipeProp} from 'src/notebooks'
import {ViewType} from 'src/types'

// NOTE we dont want any pipe component to be directly dependent
// to any notebook concepts as this'll limit future reusability
// but timezone seems like an app setting, and its existance within
Expand Down Expand Up @@ -89,25 +97,26 @@ const Visualization: FC<PipeProp> = ({

return (
<Context controls={controls}>
<div className="notebook-visualization">
<div className="notebook-visualization--header" />
<div className="notebook-visualization--view">
<EmptyQueryView
loading={loading}
errorMessage={results.error}
errorFormat={ErrorFormat.Scroll}
hasResults={checkResultsLength(results.parsed)}
>
<ViewSwitcher
giraffeResult={results.parsed}
files={[results.raw]}
properties={data.properties}
timeZone={timeZone}
theme="dark"
/>
</EmptyQueryView>
<Resizer data={data} onUpdate={onUpdate} resizingEnabled={!!results.raw}>
<div className="notebook-visualization">
<div className="notebook-visualization--view">
<EmptyQueryView
loading={loading}
errorMessage={results.error}
errorFormat={ErrorFormat.Scroll}
hasResults={checkResultsLength(results.parsed)}
>
<ViewSwitcher
giraffeResult={results.parsed}
files={[results.raw]}
properties={data.properties}
timeZone={timeZone}
theme="dark"
/>
</EmptyQueryView>
</div>
</div>
</div>
</Resizer>
</Context>
)
}
Expand Down