-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[ui] Dagre changes to support more flexible asset graph rendering #20525
Conversation
9c2119a
to
c33f5da
Compare
export function useLastSavedZoomLevel( | ||
viewportEl: MutableRefObject<SVGViewport | undefined>, | ||
layout: import('../asset-graph/layout').AssetGraphLayout | null, | ||
assetGraphId: string, | ||
) { | ||
useEffect(() => { | ||
if (viewportEl.current && layout) { | ||
const lastZoomLevel = Number(getJSONForKey(LINEAGE_GRAPH_ZOOM_LEVEL)); | ||
viewportEl.current.autocenter(false, lastZoomLevel); | ||
viewportEl.current.focus(); | ||
} | ||
}, [viewportEl, layout, assetGraphId]); |
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.
You didn't actually use the assetGraphId here? I imagine the intent was to persist the zoom levels of different graphs independently?
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.
Ahh interesting... let me dig into this a bit, I think we may have been trying to make sure the zoom resets to the saved zoom when you select assets
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.
It looks like that was the case - i renamed this var so it's more obvious what it's doing here!
js_modules/dagster-ui/packages/ui-core/src/assets/lineage/useColumnLineageDataForAssets.tsx
Outdated
Show resolved
Hide resolved
js_modules/dagster-ui/packages/ui-core/src/assets/lineage/useColumnLineageDataForAssets.tsx
Show resolved
Hide resolved
c33f5da
to
579cb49
Compare
fc6a86e
to
3fb3117
Compare
This reverts commit 4d77c2a.
); | ||
}; | ||
|
||
export function useColumnLineageDataForAssets(assetKeys: AssetKeyInput[]) { |
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.
Should this use LiveDataProvider for the batching/chunking polling benefits?
## Summary & Motivation This PR adds a new "Column" selector to the Asset > Lineage page for assets that emit `lineage` materialization event metadata. Choosing a column switches you to a column-oriented version of the graph, which supports the same upstream/downstream scoping + navigation as the normal lineage view, but shows column-level arrows and info. This PR makes a few changes to our asset layout system in order to support this new DAG styling: - The asset layout engine takes a wider range of it's hardcoded constants as configuration (previously just `direction`), and you can override Dagre layout settings. This allows us to run asset layout (with the worker, indexdb caching, etc), but with smaller `column` nodes. The options were already part of the cache keys, so this all works pretty smoothly! - I found an open PR on Dagre that fixes the issue with asset groups overlapping occasionally because the layout engine could not account for the presence of the "title bar" we render on them! I added the adjustments to our existing `dagre.patch` file. This is important in this PR because the nodes are the columns and the groups are the assets, so they overlap badly without this fix. ## How I Tested These Changes <img width="1728" alt="image" src="https://github.com/dagster-io/dagster/assets/1037212/0f5aebfd-cb5b-436e-b344-23b6a8f85870"> <img width="1563" alt="image" src="https://github.com/dagster-io/dagster/assets/1037212/4eccf376-4835-42b1-ad2c-590cb3917b1a"> <img width="1205" alt="image" src="https://github.com/dagster-io/dagster/assets/1037212/16f659a9-cb90-489b-b0ce-03a09a4e1a9c"> --------- Co-authored-by: bengotow <[email protected]>
## Summary & Motivation This PR adds a new "Column" selector to the Asset > Lineage page for assets that emit `lineage` materialization event metadata. Choosing a column switches you to a column-oriented version of the graph, which supports the same upstream/downstream scoping + navigation as the normal lineage view, but shows column-level arrows and info. This PR makes a few changes to our asset layout system in order to support this new DAG styling: - The asset layout engine takes a wider range of it's hardcoded constants as configuration (previously just `direction`), and you can override Dagre layout settings. This allows us to run asset layout (with the worker, indexdb caching, etc), but with smaller `column` nodes. The options were already part of the cache keys, so this all works pretty smoothly! - I found an open PR on Dagre that fixes the issue with asset groups overlapping occasionally because the layout engine could not account for the presence of the "title bar" we render on them! I added the adjustments to our existing `dagre.patch` file. This is important in this PR because the nodes are the columns and the groups are the assets, so they overlap badly without this fix. ## How I Tested These Changes <img width="1728" alt="image" src="https://github.com/dagster-io/dagster/assets/1037212/0f5aebfd-cb5b-436e-b344-23b6a8f85870"> <img width="1563" alt="image" src="https://github.com/dagster-io/dagster/assets/1037212/4eccf376-4835-42b1-ad2c-590cb3917b1a"> <img width="1205" alt="image" src="https://github.com/dagster-io/dagster/assets/1037212/16f659a9-cb90-489b-b0ce-03a09a4e1a9c"> --------- Co-authored-by: bengotow <[email protected]>
Summary & Motivation
The asset layout engine takes a wider range of it's hardcoded constants as configuration (previously just
direction
), and you can override Dagre layout settings. This allows us to run asset layout (with the worker, indexdb caching, etc), but with smallercolumn
nodes. The options were already part of the cache keys, so this all works pretty smoothly!I found an open PR on Dagre that fixes the issue with asset groups overlapping occasionally because the layout engine could not account for the presence of the "title bar" we render on them! I added the adjustments to our existing
dagre.patch
file. This is important in this PR because the nodes are the columns and the groups are the assets, so they overlap badly without this fix.