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

Add Runtime Dataflow Viewer #1023

Merged
merged 183 commits into from
Oct 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
e0f9b10
Initial commit from Create React App
chengluyu Sep 20, 2019
2ea76c6
Make linter happy
chengluyu Sep 20, 2019
f672b6f
Add chart and scene graph display
chengluyu Sep 20, 2019
41dcca9
Add data flow graph display
chengluyu Sep 21, 2019
b35c855
Fix: remove comment typo
chengluyu Sep 21, 2019
f9f0add
Keep react-vega from update, complete scene graph display
chengluyu Sep 21, 2019
ff32f1f
Extract graphviz rendering as a component
chengluyu Sep 21, 2019
5117aa0
Use react-inspector instead of react-json-view
chengluyu Sep 21, 2019
874750e
Remove unused function to make compiler happy
chengluyu Sep 22, 2019
35ce8dd
Customize the inspector and add highlight feature
chengluyu Sep 22, 2019
29cd24a
Add simple styles to UI
chengluyu Sep 22, 2019
53c9acc
Re-organize files and remove unless stuff
chengluyu Sep 22, 2019
51f10ed
Fix runtime warnings caused by mistypings in inspector"
chengluyu Sep 23, 2019
5c22b8e
SVG is parsed to React rather than set by innerHTML
chengluyu Sep 23, 2019
ea45ab7
Extract highlight routines to a class
chengluyu Sep 23, 2019
0099386
Add data flow graph highlight feature
chengluyu Sep 23, 2019
7ab5494
Hide SVG element in scene graph nodes
chengluyu Sep 23, 2019
57b6e06
Fix transformation of `SVGTitleElement`s
chengluyu Sep 23, 2019
9fbad4c
chore(bundler): use webpack instead of react-scripts
chengluyu Sep 15, 2020
1072db2
refactor(files): re-organize files and remove service worker code
chengluyu Sep 15, 2020
4f1412e
fix(style): use sans-serif as default font-family
chengluyu Sep 15, 2020
ec030db
style: use default config and run format
chengluyu Sep 15, 2020
74eacef
make subcontext nodes display
z-jack Sep 21, 2020
ac9bf62
chore(deps): introduce Tailwind
chengluyu Sep 24, 2020
3553cd9
refactor(title): change title and navbar brand
chengluyu Sep 24, 2020
5eb767f
feat: add source editor and adjust layout and styles
chengluyu Sep 24, 2020
5c4e5d8
feat(logo): add favicon and navbar logo
chengluyu Sep 24, 2020
3d56777
feat(ui): add icons to buttons
chengluyu Sep 24, 2020
0733f9f
feat(dataflow): support display dot source
chengluyu Sep 24, 2020
abc5029
feat(dataflow): use react-svg-pan-zoom to display data flow graph
chengluyu Sep 24, 2020
cff799e
fix(ui): prevent editor overflow and page scrolling
chengluyu Sep 24, 2020
af0b6e7
fix(file): correct a typo in file names
chengluyu Sep 24, 2020
892bbde
refactor(components/common): adjust panel title height
chengluyu Sep 24, 2020
84518c5
refactor(components/common): extract header buttons as a component
chengluyu Sep 24, 2020
ae125e3
feat(dataflow): add support for fullscreen display
chengluyu Sep 24, 2020
7ed2562
fix: fix duplicated operator id & eventstream id
z-jack Sep 28, 2020
98b71ab
feat(dataflow): add a hijack script to intercept dataflow changes
chengluyu Sep 28, 2020
1877cf3
fix(App): capitalize panel headers
chengluyu Sep 29, 2020
3e5ead2
refactor(scenegraph): allow scrolling and enlarge text
chengluyu Sep 29, 2020
5e675e2
refactor(scenegraph): add hover to highlight
chengluyu Sep 29, 2020
3f23e7f
feat(App): add a tutorial pop-up window
chengluyu Sep 29, 2020
803001a
fix(EditorPanel): resolve schema request warning
chengluyu Sep 29, 2020
ac27292
fix: fix missing nodes in dataflow
z-jack Sep 29, 2020
4f2f3cc
Merge branch 'master' of https://github.com/chengluyu/vega-inspector
z-jack Sep 29, 2020
3e572c9
fix: fix missing edges in function call
z-jack Sep 30, 2020
2232f13
fix: fix infinity loop when vega changed data
z-jack Oct 6, 2020
dc0d1da
update: change dataflow graph analyse code
z-jack Oct 6, 2020
ff50066
First go at dataflow viewer
saulshanabrook May 27, 2021
075c9f1
Add support for viewing dataflow runtime
saulshanabrook Jun 3, 2021
a2aee92
Add 'inspector_src/' from commit 'dc0d1da8b8aeef4434924ff558529186439…
saulshanabrook Jun 3, 2021
b97d0ff
Remove unused inspector files and move vega2dot to our utils
saulshanabrook Jun 3, 2021
f072590
Try switching to new graph
saulshanabrook Jun 3, 2021
21f68e7
Add fix for empty fields
saulshanabrook Jun 3, 2021
71f9766
Use AST interpreter
saulshanabrook Jun 6, 2021
4d70ad9
Remove unused vega2dot functions
saulshanabrook Jun 6, 2021
883e2ae
Add types to vega2dot
saulshanabrook Jun 6, 2021
d05e7e8
Fix typings with new streams typings
saulshanabrook Jun 6, 2021
a79a356
Revert "Use AST interpreter"
saulshanabrook Jun 13, 2021
6927299
Add support for merging streams
saulshanabrook Jun 13, 2021
54cdb57
graph event between
saulshanabrook Jun 13, 2021
c567663
Clean up stream view
saulshanabrook Jun 15, 2021
510cf69
Add error handling for graph generation
saulshanabrook Jun 15, 2021
7d81a18
fix bug for pull params
saulshanabrook Jun 15, 2021
5137e59
Improve support for update expressions
saulshanabrook Jun 15, 2021
4f20e08
Switch to cytoscape JS
saulshanabrook Jun 22, 2021
b852f64
Remove some detail temporarily
saulshanabrook Jun 25, 2021
baed065
Merge upstream/master into dataflow
saulshanabrook Jun 25, 2021
a98f1d0
Fix multiple selections, remove cycles, and highlight pulses
saulshanabrook Jul 13, 2021
ba201c0
Merge remote-tracking branch 'upstream/master' into dataflow
saulshanabrook Jul 25, 2021
fb03c37
Make operators different colors
saulshanabrook Jul 25, 2021
84c2424
Remove unused encode nodes
saulshanabrook Jul 25, 2021
7dd8d3b
Fix text overlapping
saulshanabrook Jul 25, 2021
dd0ffd2
Automatically apply ELK patch
saulshanabrook Jul 25, 2021
c94b16e
Switch to using tippy for details
saulshanabrook Jul 26, 2021
45ad36b
Fix callback dependencies
saulshanabrook Jul 26, 2021
fdf7f48
Remove unneccsary dep
saulshanabrook Jul 26, 2021
31ff5f2
Fix hiding parents
saulshanabrook Jul 26, 2021
cda8a64
Fix changing graphs by removing cytoscape-react
saulshanabrook Jul 26, 2021
5bbbe74
Add special signal node
saulshanabrook Jul 27, 2021
af22253
Merge upstream/master into dataflow
saulshanabrook Jul 28, 2021
894ad75
Only add one view node
saulshanabrook Jul 28, 2021
9b6885d
Show types on hover for nodes
saulshanabrook Aug 2, 2021
f303f12
Make updates cyclical again
saulshanabrook Aug 2, 2021
866e955
Render multiple parallel edges properly for updates
saulshanabrook Aug 2, 2021
1da1cdd
Go back to network simplex mode
saulshanabrook Aug 2, 2021
b9ecf2e
Fix displaying stream nodes
saulshanabrook Aug 2, 2021
993935d
Prettify filter code
saulshanabrook Aug 2, 2021
0ad4a83
Make stream appear first
saulshanabrook Aug 3, 2021
6ef2d54
Display datasets in graph
saulshanabrook Aug 3, 2021
f9eab71
Switch to left to right to fix bug
saulshanabrook Aug 11, 2021
0b2f447
Support nested datasets
saulshanabrook Aug 11, 2021
d5acdb5
Switch styles to be closer to original demo
saulshanabrook Aug 11, 2021
03a6a89
Update commented layout in console
saulshanabrook Aug 11, 2021
2d9e727
Update comment
saulshanabrook Aug 11, 2021
05ae430
Show overlay when waiting for layout to finish
saulshanabrook Aug 11, 2021
2e744b9
Remove logs
saulshanabrook Aug 11, 2021
8578e77
Reduce opacity of overlay
saulshanabrook Aug 11, 2021
9b66f2d
Fix selection logic
saulshanabrook Aug 12, 2021
5329cd4
Add support for viewing pulses and move to reducer
saulshanabrook Aug 14, 2021
944268e
Add back partition!
saulshanabrook Aug 16, 2021
d902fef
Remove dataflow editor
saulshanabrook Aug 19, 2021
98d3b6d
Switch pulses to be in redux slice
saulshanabrook Aug 19, 2021
5bc39d4
Fix sorting of pulses
saulshanabrook Aug 19, 2021
bce10cd
Make pulse table scroll
saulshanabrook Aug 20, 2021
ad52c7d
Move selections to new slice and add element selection
saulshanabrook Aug 20, 2021
44ac4c4
Don't save error state or any of the state from the dataflow
saulshanabrook Aug 20, 2021
e0e783a
Add selector and graph slices
saulshanabrook Aug 20, 2021
97f0967
Add support for layouts
saulshanabrook Aug 21, 2021
f034543
Show errors from laying out
saulshanabrook Aug 22, 2021
69897fb
Add initial support for rendering
saulshanabrook Aug 23, 2021
a145e54
Fix getting font sizes
saulshanabrook Aug 23, 2021
5cf9ce8
Fix node positions
saulshanabrook Aug 23, 2021
2e81490
Move ELK to webworker
saulshanabrook Aug 23, 2021
d58ff59
Work around chromium bug
saulshanabrook Aug 23, 2021
3e30b9f
Don't render labels when zoomed out
saulshanabrook Aug 23, 2021
f9fe352
Fix null selections
saulshanabrook Aug 23, 2021
d5e737d
Preserve traceback on filtering errors
saulshanabrook Aug 24, 2021
7815307
Better display for layout errors
saulshanabrook Aug 24, 2021
af93d80
remove unused import
saulshanabrook Aug 24, 2021
6f14205
Fix dataviewer css
saulshanabrook Aug 24, 2021
ca7742d
Compute cytoscape elements based on filtered graph
saulshanabrook Aug 24, 2021
a467c9e
Fix getting pulses from state
saulshanabrook Aug 24, 2021
5fd8cb6
Disable root edge
saulshanabrook Aug 25, 2021
4ceb8d6
Fix primary /secondary edges
saulshanabrook Aug 25, 2021
f45ccdc
Add type switch to sanitizes value and reduce clip length
saulshanabrook Aug 25, 2021
e828076
hide long errors
saulshanabrook Aug 25, 2021
f2aaa8e
Add popup
saulshanabrook Aug 25, 2021
93a42f7
Remove popups after graph changes
saulshanabrook Aug 25, 2021
f1ef0a5
Finish moving edge labels to popups
saulshanabrook Aug 25, 2021
949a5c4
Remove old component code
saulshanabrook Aug 25, 2021
fbebbac
Increase popup width
saulshanabrook Aug 25, 2021
9dfa935
Add support for parents of pulse nodes
saulshanabrook Aug 25, 2021
d6c2dd9
Add tippy dep
saulshanabrook Aug 25, 2021
3577f8e
Merge move-redux into dataflow
saulshanabrook Aug 25, 2021
cd56552
Update yarn and remove patch
saulshanabrook Aug 25, 2021
d4b7286
Almost working with updated cytoscape rendering
saulshanabrook Aug 29, 2021
cf58061
Fix updating graph with selections
saulshanabrook Aug 29, 2021
41dae32
Make tippy scrollable
saulshanabrook Aug 29, 2021
5a45eb5
Rename pulses to sidebar component
saulshanabrook Aug 29, 2021
df0ffcc
Add support for selecting by type
saulshanabrook Aug 30, 2021
d9d4f07
Merge upstream/master into dataflow
saulshanabrook Aug 30, 2021
f21554f
Fix warnings
saulshanabrook Aug 30, 2021
9a06b96
Remove unused import
saulshanabrook Sep 1, 2021
815d5a0
Consolidate to react-tippy for tooltips
saulshanabrook Sep 13, 2021
37341e2
Switch versions deps to semver (^) from exact
saulshanabrook Sep 13, 2021
a8a83f6
Remove unused web worker library
saulshanabrook Sep 13, 2021
e6cef22
Fix shadowed variable
saulshanabrook Sep 13, 2021
2aad0b3
Add animations
saulshanabrook Sep 13, 2021
7a364b4
Hide popup when re-laying out
saulshanabrook Sep 13, 2021
1ff264f
Split CSS into files per component
saulshanabrook Sep 13, 2021
a3e5628
Add grey padding around graph, similar to viz
saulshanabrook Sep 13, 2021
c0131be
Make sidebar look more consistent and explicit
saulshanabrook Sep 13, 2021
969991f
Add unselect elements button
saulshanabrook Sep 13, 2021
1d27d17
Fix layout being removed after resetting pulses
saulshanabrook Sep 13, 2021
637d4a4
Make pulse table scrollable again
saulshanabrook Sep 13, 2021
47ba674
Make selected element darker
saulshanabrook Sep 13, 2021
0c1035f
Dont relayout table when selecting pulse
saulshanabrook Sep 13, 2021
e42adc7
Preserve selection on re-layout by making it controlled
saulshanabrook Sep 13, 2021
1427e01
Use one layout
saulshanabrook Sep 13, 2021
7aec358
unselect by clicking on bg even when selected node not visible
saulshanabrook Sep 13, 2021
b1c9b03
Add more spacing to layout
saulshanabrook Sep 13, 2021
aab5282
Disable compaction to align layers
saulshanabrook Sep 13, 2021
29a1612
Add padding to layout
saulshanabrook Sep 13, 2021
0be6529
Merge upstream/master into dataflow
saulshanabrook Sep 13, 2021
0f282ff
Typo
saulshanabrook Sep 13, 2021
fc99de7
Fix bug where type input shrinks with lots of pulses
saulshanabrook Sep 15, 2021
0e2784a
Constrain zoom range
saulshanabrook Sep 26, 2021
18dd20d
Fixed white gap under tab
saulshanabrook Sep 26, 2021
c5fb17d
Dont animate initial render
saulshanabrook Sep 26, 2021
47320d0
Add labels back to edges from popups
saulshanabrook Sep 26, 2021
3da1d70
Mide fieldset borders lighter
saulshanabrook Sep 26, 2021
27189ad
Update pulse selection text
saulshanabrook Sep 26, 2021
caddb49
Conserve vertical tooltip space
saulshanabrook Sep 26, 2021
af35140
Fix popup centering
saulshanabrook Sep 26, 2021
54a81eb
Merge upstream/master into dataflow
saulshanabrook Sep 26, 2021
141f293
Show data and signals by default
saulshanabrook Sep 30, 2021
6818e2a
Fix pointer on sidebar table
saulshanabrook Sep 30, 2021
b8dbde7
Try running action on PR
saulshanabrook Oct 1, 2021
658098e
Add eslint plugin
saulshanabrook Oct 1, 2021
dd4bf94
Run CI only once on internal branch PRs
saulshanabrook Oct 2, 2021
50a153d
Fix lint errors
saulshanabrook Oct 2, 2021
dab3c61
Merge upstream/master into dataflow
saulshanabrook Oct 2, 2021
5577257
Bump to latest typings
saulshanabrook Oct 22, 2021
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
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Test

on: [push]
on:
push:
branches:
- master
pull_request:

jobs:
publish:
Expand Down
16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"license": "BSD-3-Clause",
"devDependencies": {
"@types/react-select": "^5.0.1",
"autoprefixer": "^10.3.6",
"autoprefixer": "^10.3.4",
"copy-webpack-plugin": "^9.0.1",
"css-loader": "^6.3.0",
"eslint-plugin-prettier": "4.0.0",
"gh-pages": "^3.2.3",
"html-webpack-plugin": "^5.3.2",
"husky": "^7.0.2",
Expand All @@ -25,19 +27,26 @@
"webpack-dev-server": "^4.3.0"
},
"dependencies": {
"@reduxjs/toolkit": "^1.6.1",
"@tippyjs/react": "^4.2.5",
"@types/cytoscape": "^3.14.17",
"@types/d3": "^7.0.0",
"@types/react": "^17.0.26",
"@types/react-redux": "^7.1.18",
"@types/semver": "^7.3.8",
"ajv": "^8.6.3",
"ajv-formats": "^2.1.1",
"cytoscape": "^3.19.0",
"cytoscape-popper": "^2.0.0",
"d3-array": "^3.1.0",
"d3-geo-projection": "^4.0.0",
"d3-scale": "^4.0.2",
"elkjs": "^0.7.1",
"history": "^5.0.1",
"json-stringify-pretty-compact": "^3.0.0",
"lz-string": "^1.4.4",
"monaco-editor": "^0.27.0",
"prettier": "^2.1.x",
"prop-types": "^15.7.2",
"rc-resize-observer": "^1.0.1",
"react": "^17.0.2",
Expand All @@ -51,18 +60,19 @@
"react-router-dom": "^5.3.0",
"react-select": "^4.3.1",
"react-split-pane": "^0.1.92",
"react-tooltip": "^4.2.21",
"redux": "^4.1.1",
"redux-localstorage": "^0.4.1",
"redux-thunk": "^2.3.0",
"tippy.js": "^6.3.1",
"tslib": "^2.3.1",
"vega-cli": "5.21.0",
"vega-datasets": "^2.2.0",
"vega-embed": "^6.19.1",
"vega-lite": "5.1.1",
"vega-schema-url-parser": "^2.2.0",
"vega-themes": "^2.10.0",
"vega-tooltip": "^0.27.0"
"vega-tooltip": "^0.27.0",
"vega-typings": "^0.22.1"
},
"lint-staged": {
"*.{ts,tsx}": [
Expand Down
3 changes: 1 addition & 2 deletions src/actions/editor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as Monaco from 'monaco-editor/esm/vs/editor/editor.api';
import {Renderers, Spec} from 'vega';
import {TopLevelSpec} from 'vega-lite/src/spec';
import {Renderers, Runtime} from 'vega';
import {Mode, View} from '../constants';

export const RECEIVE_CURRENT_USER = 'RECEIVE_CURRENT_USER' as const;
Expand Down
2 changes: 1 addition & 1 deletion src/components/input-panel/compiled-spec-header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {connect} from 'react-redux';
import {RouteComponentProps, withRouter} from 'react-router-dom';
import {bindActionCreators, Dispatch} from 'redux';
import * as EditorActions from '../../../actions/editor';
import {State} from '../../../constants/default-state';
import {COMPILEDPANE} from '../../../constants';
import {State} from '../../../constants/default-state';

const toggleStyle = {
cursor: 'pointer',
Expand Down
2 changes: 1 addition & 1 deletion src/components/input-panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {State} from '../../constants/default-state';
import ConfigEditor from '../config-editor';
import CompiledSpecDisplay from './compiled-spec-display';
import CompiledSpecHeader from './compiled-spec-header';
import './index.css';
import SpecEditor from './spec-editor';
import SpecEditorHeader from './spec-editor-header';
import './index.css';

type Props = ReturnType<typeof mapStateToProps> & ReturnType<typeof mapDispatchToProps>;

Expand Down
4 changes: 2 additions & 2 deletions src/components/input-panel/spec-editor-header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from 'react';
import {connect} from 'react-redux';
import {withRouter, RouteComponentProps} from 'react-router-dom';
import {RouteComponentProps, withRouter} from 'react-router-dom';
import {bindActionCreators, Dispatch} from 'redux';
import * as EditorActions from '../../../actions/editor';
import {SIDEPANE} from '../../../constants';
import {State} from '../../../constants/default-state';
import ConfigEditorHeader from '../../config-editor/config-editor-header';
import './index.css';
import {State} from '../../../constants/default-state';

type Props = ReturnType<typeof mapStateToProps> & ReturnType<typeof mapDispatchToProps> & RouteComponentProps;

Expand Down
9 changes: 9 additions & 0 deletions src/components/popup/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from 'react';

import 'tippy.js/dist/tippy.css';
import 'tippy.js/themes/light-border.css';
import Tippy, {TippyProps} from '@tippyjs/react';

export function Popup(props: TippyProps) {
return <Tippy theme="light-border" {...props} />;
}
4 changes: 4 additions & 0 deletions src/components/renderer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {connect} from 'react-redux';
import {bindActionCreators, Dispatch} from 'redux';
import * as EditorActions from '../../actions/editor';
import {State} from '../../constants/default-state';
import {recordPulse} from '../../features/dataflow/pulsesSlice';
import {setRuntime} from '../../features/dataflow/runtimeSlice';
import Renderer from './renderer';

export function mapStateToProps(state: State) {
Expand All @@ -26,6 +28,8 @@ export function mapDispatchToProps(dispatch: Dispatch<EditorActions.Action>) {
return bindActionCreators(
{
setView: EditorActions.setView,
setRuntime: setRuntime,
recordPulse: recordPulse,
},
dispatch
);
Expand Down
78 changes: 63 additions & 15 deletions src/components/renderer/renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import {Maximize} from 'react-feather';
import {Portal} from 'react-portal';
import {RouteComponentProps, withRouter} from 'react-router-dom';
import ReactTooltip from 'react-tooltip';
import * as vega from 'vega';
import {Config as VgConfig} from 'vega';
import {deepEqual} from 'vega-lite';
Expand All @@ -11,6 +10,7 @@ import {mapDispatchToProps, mapStateToProps} from '.';
import {KEYCODES, Mode} from '../../constants';
import addProjections from '../../utils/addProjections';
import {dispatchingLogger} from '../../utils/logger';
import {Popup} from '../popup';
import './index.css';

// Add additional projections
Expand All @@ -30,6 +30,7 @@ class Editor extends React.PureComponent<Props, State> {
this.handleKeydown = this.handleKeydown.bind(this);
this.onOpenPortal = this.onOpenPortal.bind(this);
this.onClosePortal = this.onClosePortal.bind(this);
this.runAfter = this.runAfter.bind(this);
}

public onOpenPortal() {
Expand Down Expand Up @@ -125,7 +126,17 @@ class Editor extends React.PureComponent<Props, State> {
}

public initView() {
const {vegaSpec, vegaLiteSpec, normalizedVegaLiteSpec, config, baseURL, mode, setView, hoverEnable} = this.props;
const {
vegaSpec,
vegaLiteSpec,
normalizedVegaLiteSpec,
config,
baseURL,
mode,
setView,
setRuntime,
hoverEnable,
} = this.props;

let runtime: vega.Runtime;
if (mode === Mode.VegaLite) {
Expand All @@ -134,6 +145,7 @@ class Editor extends React.PureComponent<Props, State> {
} else {
runtime = vega.parse(vegaSpec, config as VgConfig);
}

const loader = vega.loader();
const originalLoad = loader.load.bind(loader);

Expand All @@ -154,6 +166,10 @@ class Editor extends React.PureComponent<Props, State> {

// Finalize previous view so that memory can be freed
if (this.props.view) {
// Remove run after callback for the previous view
// to disable logging from an evaluate that will run after we finalize it
(this.props.view as any)._postrun = [];

this.props.view.finalize();
}

Expand All @@ -163,6 +179,7 @@ class Editor extends React.PureComponent<Props, State> {
loader,
});

view.runAfter(this.runAfter, true);
(view as any).logger(dispatchingLogger);

const debug = (window as any).VEGA_DEBUG;
Expand All @@ -176,10 +193,38 @@ class Editor extends React.PureComponent<Props, State> {
} else {
debug.vegaLiteSpec = debug.normalizedVegaLiteSpec = undefined;
}

setRuntime(runtime);
setView(view);
}

private runAfter(df: any) {
const clock = df._clock;

// Mapping from ID to value
const values: Record<string, unknown> = {};
const toProcessContexts = new Set<any>([df._runtime]);
const processedContexts = new Set<any>();
while (toProcessContexts.size > 0) {
const context = toProcessContexts.values().next().value;
toProcessContexts.delete(context);
processedContexts.add(context);
for (const [id, operator] of Object.entries(context.nodes as Record<string, any>)) {
if (operator.stamp === clock) {
values[id] = operator.value;
}
}
for (const subContext of (context.subcontext as undefined | any[]) ?? []) {
if (!processedContexts.has(subContext)) {
toProcessContexts.add(subContext);
}
}
}
this.props.recordPulse(clock, values);

// Set it up to run again
df.runAfter(this.runAfter, true, 10);
}

public async renderVega() {
// Selecting chart for rendering vega
const chart = this.state.fullscreen ? (this.refs.fchart as any) : (this.refs.chart as any);
Expand Down Expand Up @@ -292,21 +337,25 @@ class Editor extends React.PureComponent<Props, State> {
return (
<div>
<div className="chart" style={{backgroundColor: this.props.backgroundColor}}>
<div
data-tip={`Click on "Continue Recording" to make the chart interactive`}
data-place="right"
className="chart-overlay"
></div>
<Popup
content={`Click on "Continue Recording" to make the chart interactive`}
placement="right"
// Make skinnier so it fits on the right side of the chart
maxWidth={200}
>
<div className="chart-overlay"></div>
</Popup>
<div aria-label="visualization" ref="chart" style={chartStyle} />
{this.renderResizeHandle()}
</div>
<div className="fullscreen-open">
<Maximize
data-tip="Fullscreen"
onClick={() => {
this.setState({fullscreen: true}, this.onOpenPortal);
}}
/>
<Popup content="Fullscreen" placement="left">
<Maximize
onClick={() => {
this.setState({fullscreen: true}, this.onOpenPortal);
}}
/>
</Popup>
</div>
{this.state.fullscreen && (
<Portal>
Expand All @@ -326,7 +375,6 @@ class Editor extends React.PureComponent<Props, State> {
</div>
</Portal>
)}
<ReactTooltip place="left" type="dark" effect="solid" />
</div>
);
}
Expand Down
14 changes: 14 additions & 0 deletions src/components/viz-pane/debug-pane-header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ class DebugPaneHeader extends React.PureComponent<Props> {
Signal Viewer
</li>
)}
{error === null && (
<li
className={navItem === NAVBAR.DataflowViewer ? 'active-tab' : undefined}
onClick={(e) => {
if (debugPane) {
e.stopPropagation();
}
showLogs(false);
toggleNavbar(NAVBAR.DataflowViewer);
}}
>
Dataflow Viewer
</li>
)}
</ul>
{debugPane ? <ChevronDown /> : <ChevronUp />}
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/components/viz-pane/renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {version as VG_VERSION} from 'vega';
import {version as VL_VERSION} from 'vega-lite';
import {version as TOOLTIP_VERSION} from 'vega-tooltip';
import {COMMIT_HASH} from '../header/help-modal';
import {DataflowViewer} from '../../features/dataflow/DataflowViewer';

const defaultState = {
header: '',
Expand Down Expand Up @@ -98,6 +99,8 @@ export default class VizPane extends React.PureComponent<Props, State> {
return <DataViewer onClickHandler={(header) => this.onClickHandler(header)} />;
case NAVBAR.SignalViewer:
return <SignalViewer onClickHandler={(header) => this.onClickHandler(header)} />;
case NAVBAR.DataflowViewer:
return <DataflowViewer />;
default:
return null;
}
Expand Down
1 change: 1 addition & 0 deletions src/constants/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const NAVBAR = {
DataViewer: 'DataViewer',
Logs: 'Logs',
SignalViewer: 'SignalViewer',
DataflowViewer: 'DataflowViewer',
} as const;

export const SIDEPANE = {
Expand Down
11 changes: 7 additions & 4 deletions src/constants/default-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ import * as Monaco from 'monaco-editor/esm/vs/editor/editor.api';
import {Renderers, Spec} from 'vega';
import {Config, vega} from 'vega-embed';
import {TopLevelSpec as VlSpec} from 'vega-lite';
import {dataflowInitialState} from '../features/dataflow';

import {
COMPILEDPANE,
EDITOR_FOCUS,
GistPrivacy,
LAYOUT,
Mode,
NAVBAR,
SIDEPANE,
VEGA_LITE_START_SPEC,
View,
GistPrivacy,
COMPILEDPANE,
} from './consts';

export interface State {
export type State = {
isAuthenticated: boolean;
baseURL: string;
compiledVegaSpec: boolean;
Expand Down Expand Up @@ -60,7 +62,7 @@ export interface State {
debugs: string[];
themeName: string;
backgroundColor: string;
}
} & typeof dataflowInitialState;

export const DEFAULT_STATE: State = {
baseURL: null,
Expand Down Expand Up @@ -108,4 +110,5 @@ export const DEFAULT_STATE: State = {
debugs: [],
infos: [],
backgroundColor: '#ffffff',
...dataflowInitialState,
};
Loading