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

UI: add full graph toggle #2569

Merged
merged 7 commits into from
Aug 8, 2023

Conversation

jlukenoff
Copy link
Contributor

@jlukenoff jlukenoff commented Aug 5, 2023

Problem

There are some reasonable scenarios where users would want to view only the direct successors and predecessors of the current selected node in the lineage graph. This PR enables users to toggle a "Full Graph" view, when deselected, the graph will render only the nodes that are along the selected paths. When deselected and changing selected nodes, we expect that the graph should re-render with any new nodes that weren't along the selected path previously.

Closes: #2558

Solution

  • Add a showFullGraph property to the lineage state and enables a toggle on the UI.
  • Add a removeUnselectedNodes method to Lineage that can remove any unselected nodes from the graph.

Screen Recording 2023-08-05 at 9 13 18 AM

One-line summary: add a toggle to the Lineage UI to let users switch between viewing the full graph and a view with only the selected paths.

Checklist

  • You've signed-off your work
  • Your changes are accompanied by tests (if relevant)
  • Your change contains a small diff and is self-contained
  • You've updated any relevant documentation (if relevant)
  • You've included a one-line summary of your change for the CHANGELOG.md (Depending on the change, this may not be necessary).
  • You've versioned your .sql database schema migration according to Flyway's naming convention (if relevant)
  • You've included a header in any source code files (if relevant)

@boring-cyborg boring-cyborg bot added the web label Aug 5, 2023
@codecov
Copy link

codecov bot commented Aug 5, 2023

Codecov Report

Merging #2569 (34ae39b) into main (1d46b66) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main    #2569   +/-   ##
=========================================
  Coverage     83.26%   83.26%           
  Complexity     1286     1286           
=========================================
  Files           243      243           
  Lines          5934     5934           
  Branches        279      279           
=========================================
  Hits           4941     4941           
  Misses          846      846           
  Partials        147      147           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@davidsharp7
Copy link
Member

Yeah looks good - only suggestion I would make is to change the background colour of the toggle to Marquez Green when its on so its a little easier to determine state.

@jlukenoff
Copy link
Contributor Author

Yeah looks good - only suggestion I would make is to change the background colour of the toggle to Marquez Green when its on so its a little easier to determine state.

Good idea, updated it to use the primary green color when enabled.

image

@davidsharp7
Copy link
Member

Yeah looks good - only suggestion I would make is to change the background colour of the toggle to Marquez Green when its on so its a little easier to determine state.

Good idea, updated it to use the primary green color when enabled.

image

Yeah perfect! Might need to get wider feedback but I wonder if its worth inverting the toggle so that by default its shows everything and activating the toggle shows only the critical path.

@jlukenoff
Copy link
Contributor Author

That’s a good point, that may make more sense since the full graph has always been the default and this is something new users can enable. I’m having trouble thinking of a label for the switch that would make sense that isn’t too wordy though. Perhaps “Simple Graph” or something like that?

Agree it would be great to get some wider feedback.

@davidsharp7
Copy link
Member

That’s a good point, that may make more sense since the full graph has always been the default and this is something new users can enable. I’m having trouble thinking of a label for the switch that would make sense that isn’t too wordy though. Perhaps “Simple Graph” or something like that?

Agree it would be great to get some wider feedback.

What about “Show Critical Path”?

@davidsharp7
Copy link
Member

Yeah I think we can just reverse the logic and it should work fine

I've added the sections that can be reversed on your branch (could be wrong as this the first time I have ever looked at typescript/react/node)

}

const initialState: ILineageState = {
lineage: { graph: [] },
selectedNode: null,
bottomBarHeight: (window.innerHeight - HEADER_HEIGHT) / 3,
depth: 5
depth: 5,
showFullGraph: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showFullGraph: false

@@ -57,7 +57,8 @@ i18next
lineage: {
empty_title: 'No node selected',
empty_body: 'Try selecting a node through search or the jobs or datasets page.',
graph_depth_title: 'Graph Depth'
graph_depth_title: 'Graph Depth',
full_graph_label: 'Full Graph'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

full_graph_label: 'Show Critical Path'

Copy link
Contributor Author

@jlukenoff jlukenoff Aug 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh, this just starts to feel like a lot of words to express something relatively simple. I tend to err on the side of "less is more" with these things. I really like the ArgoCD version of this where the text labels show up as a tooltip when you hover over the options. I think that helps preserve the real-estate the configs take up. Maybe we want to think about something like that if we plan to add more configs to this part of the screen.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I’m in two minds about that. Like the idea of having a pop up on hover to display basic ( maybe even facets like data quality?) info about the node. Maybe we need an additional menu on the header for global type variables like display and depth?

Copy link
Member

@wslulciuc wslulciuc Aug 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the discussion here! My hot take is I would agree with @jlukenoff on the wordiness of the lineage graph options (they'll be more added in the future). We know we are interacting with the lineage graph, so I think we can go one step further to address the wordiness of the options:

  1. Full - toggle between critical path and the full graph overlaid on top of critical path graph (default: false)
  2. Depth - full graph traversal depth

I added shortening "Graph Depth", but that can be a follow up PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a follow up, the lineage API should support the different graph options (Full, Critical) to avoid filtering on the UI. But, in the UI is a great first step!


// Always rebuild the graph if the selected node changes and we aren't showing the full graph
// Since there may be more or less nodes to change
if (this.props.selectedNode !== prevProps.selectedNode && !this.props.showFullGraph) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    if (this.props.selectedNode !== prevProps.selectedNode && this.props.showFullGraph) {
      this.buildGraphAll(this.props.lineage.graph)
    }

@@ -215,6 +240,11 @@ export class Lineage extends React.Component<LineageProps, LineageState> {
g.setEdge(graph[i].inEdges[j].origin, graph[i].id)
}
}

if (!this.props.showFullGraph) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    if (this.props.showFullGraph) {
      this.removeUnselectedNodes()
    }

@davidsharp7
Copy link
Member

Promise this is my last comment - there is a slight bug when you select "etl_delivery_7_days" - notice that there are 2 connected nodes even though they are not on the critical path. I think its because technically you can't filter out those nodes because they are part of the critical path at some point. I think a work around is to add something like this

    this.setState({
      graph: g,
      edges: this.props.showFullGraph ? this.getEdges().filter(edge => edge.isSelected === true) : this.getEdges(),
      nodes: g.nodes().map(v => g.node(v))
    })
Screenshot 2023-08-06 at 9 52 20 pm

@jlukenoff
Copy link
Contributor Author

jlukenoff commented Aug 6, 2023

Promise this is my last comment - there is a slight bug when you select "etl_delivery_7_days" - notice that there are 2 connected nodes even though they are not on the critical path. I think its because technically you can't filter out those nodes because they are part of the critical path at some point. I think a work around is to add something like this

I'm not sure I understand, doesn't the fact that they are connected by the selected path mean they are on the critical path? Could you point out which nodes in your screenshot you think shouldn't be displayed?

@jlukenoff
Copy link
Contributor Author

jlukenoff commented Aug 6, 2023

Had to do a pretty big refactor to account for #2563 but the functionality is still the same. Plus it's worth it to inherit the react upgrade 😄

@davidsharp7
Copy link
Member

davidsharp7 commented Aug 6, 2023

Promise this is my last comment - there is a slight bug when you select "etl_delivery_7_days" - notice that there are 2 connected nodes even though they are not on the critical path. I think its because technically you can't filter out those nodes because they are part of the critical path at some point. I think a work around is to add something like this

I'm not sure I understand, doesn't the fact that they are connected by the selected path mean they are on the critical path? Could you point out which nodes in your screenshot you think shouldn't be displayed?

So if you select etl_delivery_7_days notice how there is a grey line between public.customers and email_discounts. Given the job selected that is not on the critical path and shouldn’t appear. Simplest solution is to also filter out anything where isSelected is False.

Screenshot 2023-08-07 at 6 25 57 pm

Filter out isSelected is False if "Full Graph" is off.

Screenshot 2023-08-07 at 6 38 00 pm

@jlukenoff
Copy link
Contributor Author

So if you select etl_delivery_7_days notice how there is a grey line between public.customers and email_discounts. Given the job selected that is not on the critical path and shouldn’t appear. Simplest solution is to also filter out anything where isSelected is False.

I think I see your point but as a user I would prefer to see edges that exist in this view if the relevant nodes are being displayed. I think not doing so obfuscates potentially useful information from the user without drastically simplifying the experience compared to displaying the relationship between nodes along the critical path even if those relationships aren't part of the critical path.

@wslulciuc
Copy link
Member

So if you select etl_delivery_7_days notice how there is a grey line between public.customers and email_discounts. Given the job selected that is not on the critical path and shouldn’t appear. Simplest solution is to also filter out anything where isSelected is False.

@davidsharp7 I wanted to add to @jlukenoff response. In the Full graph mode, we'll want to show all dataset and job dependencies, but the connections between nodes in the graph don't need to be expanded by default. That is, they can be grouped and collapsed, allowing the user to discover and explore the graph as needed. For some insight into where I see the interaction of the graph going, see #2014

@@ -85,7 +90,7 @@ describe('Lineage Component', () => {

beforeEach(() => {
g = initGraph()
buildGraphAll(g, mockGraphWithCycle, (gResult: graphlib.Graph<MqNode>) => {
buildGraphAll(g, mockGraphWithCycle, false, selectedNode, (gResult: graphlib.Graph<MqNode>) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test case here for the node count on the fullGraph option?

@davidsharp7
Copy link
Member

So if you select etl_delivery_7_days notice how there is a grey line between public.customers and email_discounts. Given the job selected that is not on the critical path and shouldn’t appear. Simplest solution is to also filter out anything where isSelected is False.

@davidsharp7 I wanted to add to @jlukenoff response. In the Full graph mode, we'll want to show all dataset and job dependencies, but the connections between nodes in the graph don't need to be expanded by default. That is, they can be grouped and collapsed, allowing the user to discover and explore the graph as needed. For some insight into where I see the interaction of the graph going, see #2014

Yeah I don't think its even a binary choice as each of those views is legitimate i.e

  1. I am changing dataset X I just need to see the critical path to understand impacts.
  2. I am changing dataset X and I want to explore my lineage - expand/collapse
  3. I want to see my entire data eco system.

@wslulciuc
Copy link
Member

@davidsharp7 I think you make good points, and agree a more broad discussion on the graph view can be had, but I would move the discussion to an issue. Mind opening an issue to elaborate on the graph view in the UI and ways to improve the user expereince?

As for this PR, being able to toggle between a "Full" and "Critical Path" view is the main feature added, so I would merge as is with pending feedback from @phixMe. It's a start and we can follow up with improvements!

Copy link
Member

@wslulciuc wslulciuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some minor feedback on labeling the graph options, but otherwise 👍

jlukenoff and others added 5 commits August 8, 2023 09:01
Signed-off-by: John Lukenoff <[email protected]>
Signed-off-by: John Lukenoff <[email protected]>
Signed-off-by: John Lukenoff <[email protected]>
Signed-off-by: John Lukenoff <[email protected]>
Signed-off-by: John Lukenoff <[email protected]>
Copy link
Member

@phixMe phixMe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the unit test. Looks great!

Comment on lines +137 to +140
for (let i = 0; i < predecessors.length; i++) {
if (predecessors[i]) {
paths.push([predecessors[i] as unknown as string, node])
getPredecessors(predecessors[i] as unknown as string)
paths.push([(predecessors[i] as unknown) as string, node])
getPredecessors((predecessors[i] as unknown) as string)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how long we've been doing this but it looks like we've been iterating over the characters in the node id 😬 ? Update this to traverse the predecessors array and did the same for getSuccessors

Signed-off-by: John Lukenoff <[email protected]>
@jlukenoff
Copy link
Contributor Author

Just made a few styling tweaks that I found after adjusting to shorter labels for these configs. This should be good to merge once tests pass (I don't have access to merge yet)

@wslulciuc wslulciuc merged commit 86f957f into MarquezProject:main Aug 8, 2023
3 checks passed
@jlukenoff jlukenoff deleted the web/add-full-graph-toggle branch August 8, 2023 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing critical lineage path view on Marquez UI
4 participants