[APM] Service map Popover and Node Details with react flow#251055
Conversation
|
Pinging @elastic/obs-presentation-team (Team:obs-presentation) |
| ? `${selectedEdge.source} → ${selectedEdge.target}` | ||
| : selectedNodeId ?? ''; | ||
|
|
||
| const trigger = <div style={{ width: 1, height: 1, visibility: 'hidden' }} />; |
There was a problem hiding this comment.
Should we add an aria-hidden here?
| const trigger = <div style={{ width: 1, height: 1, visibility: 'hidden' }} />; | |
| const trigger = <div style={{ width: 1, height: 1, visibility: 'hidden' }} aria-hidden="true"/>; |
There was a problem hiding this comment.
Nice, thanks. added ✅
| [SPAN_TYPE]: 'spanType' in nodeData ? nodeData.spanType : undefined, | ||
| spanType: 'spanType' in nodeData ? nodeData.spanType : undefined, |
There was a problem hiding this comment.
maybe we can store 'spanType' in nodeData ? nodeData.spanType : undefined in a variable and reuse it?
also, do we need SPAN_TYPE and spanType
| /** Currently focused service name (for service-specific map) */ | ||
| serviceName?: string; | ||
| /** Environment filter */ | ||
| environment: Environment; | ||
| /** KQL filter */ | ||
| kuery: string; | ||
| /** Start time */ | ||
| start: string; | ||
| /** End time */ | ||
| end: string; |
There was a problem hiding this comment.
nit: do we need these comments?
| setSelectedNodeForPopover(null); | ||
| setSelectedEdgeForPopover(null); |
There was a problem hiding this comment.
Q: why do we need to set both edge and node? Wouldn't edge be sufficient?
There was a problem hiding this comment.
I don't think I understand the question: I think we should reset both by design if I understood the requirements correctly 🤔
| excludeEdges, | ||
| }); | ||
|
|
||
| const handleDiagnoseClick = () => setIsDiagnosticFlyoutOpen(true); |
| if (nodeData.isService) { | ||
| const serviceData = nodeData as ServiceNodeData; |
There was a problem hiding this comment.
Should we use type guards here? I think we already have one for this case, right?
| if ('isGrouped' in nodeData && nodeData.isGrouped) { | ||
| const groupedData = nodeData as GroupedNodeData; |
There was a problem hiding this comment.
We could use type guards here too
| const viewport = reactFlowInstance.getViewport(); | ||
| const zoom = viewport.zoom; |
There was a problem hiding this comment.
Is the intention here to not recalculate the style when the viewport changes? Asking because if we need to reclaculate we probably need to pass the viewport as a dependency of this useMemo. We could probably use the useViewPort hook from react flow if we want to do that
There was a problem hiding this comment.
I like the look and fill if we keep the same position and don't recalculate the viewport also performance-wise is better. But if you see a benefit in doing so I am Ok to change it - just that it will have a "jumping" behaviour if we do so and now it feels smoother IMO (from a UX point of view, also using the buttons to zoom will close the flyout anyway and I also need to fix the other bug you found with the focus change when moving/dragging the map position) This is the current version:
zoom_sm.mov
| const reactFlowInstance = useReactFlow(); | ||
|
|
||
| const nodeData = selectedNode?.data; | ||
| const selectedNodeId = selectedNode?.id; |
There was a problem hiding this comment.
nit: selectedNodeId is only used once. we could use selectedNode?.id directly
There was a problem hiding this comment.
I use it 2 times (line 203 and 213) 🤔
| stroke: isHighlighted ? primaryColor : defaultEdgeColor, | ||
| strokeWidth: isHighlighted ? HIGHLIGHTED_STROKE_WIDTH : DEFAULT_STROKE_WIDTH, |
There was a problem hiding this comment.
if edge.style has other attributes, we're losing them.
| stroke: isHighlighted ? primaryColor : defaultEdgeColor, | |
| strokeWidth: isHighlighted ? HIGHLIGHTED_STROKE_WIDTH : DEFAULT_STROKE_WIDTH, | |
| ...edge.style, | |
| stroke: isHighlighted ? primaryColor : defaultEdgeColor, | |
| strokeWidth: isHighlighted ? HIGHLIGHTED_STROKE_WIDTH : DEFAULT_STROKE_WIDTH, |
There was a problem hiding this comment.
Good catch, thank you! Added ✅
|
@crespocarlos Thank you for reviewing! I am going through the comments and I have a QQ: Where do you see the arrow, on edge lite it is not visible (IMO it looks better without it and maybe it got removed but we can discuss if we need it. It could be a bug on edge that it is not visible - should we check with design, wdyt?) |
I checked it in the Overview cluster. I don't see it on the edge either, but I don't remember if anything changed on the popover recently |
jennypavlova
left a comment
There was a problem hiding this comment.
@crespocarlos Thanks you for the review! I also fixed the issue with moving the map not closing the popovers, good catch there!
map_move_fix.mov
( I am investigating the undefined (undefined) issue - I guess it's the key format difference of Cytoscape/React flow, I don't know how I missed that 🤦♀️ )
| stroke: isHighlighted ? primaryColor : defaultEdgeColor, | ||
| strokeWidth: isHighlighted ? HIGHLIGHTED_STROKE_WIDTH : DEFAULT_STROKE_WIDTH, |
There was a problem hiding this comment.
Good catch, thank you! Added ✅
| const viewport = reactFlowInstance.getViewport(); | ||
| const zoom = viewport.zoom; |
There was a problem hiding this comment.
I like the look and fill if we keep the same position and don't recalculate the viewport also performance-wise is better. But if you see a benefit in doing so I am Ok to change it - just that it will have a "jumping" behaviour if we do so and now it feels smoother IMO (from a UX point of view, also using the buttons to zoom will close the flyout anyway and I also need to fix the other bug you found with the focus change when moving/dragging the map position) This is the current version:
zoom_sm.mov
smith
left a comment
There was a problem hiding this comment.
Code looks good. Tried locally (didn't test anomalies or externals grouping.) See my note about drag behavior.
|
@smith Good catch, thanks! Fixed ✅: fix_node_drag.mov |
…ils-with-react-flow
…ils-with-react-flow
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
History
|







Closes #250209
Summary
This PR adds all popovers in service map:
Service Node popover
Dependecy Node popover
Edge/Connection popover
Group popover

How to test
xpack.apm.featureFlags.serviceMapUseReactFlow: trueto thekibana.dev.ymlHow to run the scout tests