mirror of
https://github.com/grafana/grafana.git
synced 2024-11-23 09:26:43 -06:00
Node Graph: Always show context menu (#56876)
* Ensure context menu always appears * Close the context menu after selecting the alternative layout Co-authored-by: Hamas Shafiq <hamas.shafiq@grafana.com>
This commit is contained in:
parent
73c215ae41
commit
52dbd67a11
@ -28,17 +28,25 @@ export function useContextMenu(
|
||||
|
||||
const onNodeOpen = useCallback(
|
||||
(event: MouseEvent<SVGElement>, node: NodeDatum) => {
|
||||
const extraNodeItem = config.gridLayout
|
||||
? [
|
||||
{
|
||||
label: 'Show in Graph layout',
|
||||
onClick: (node: NodeDatum) => {
|
||||
setFocusedNodeId(node.id);
|
||||
setConfig({ ...config, gridLayout: false });
|
||||
},
|
||||
},
|
||||
]
|
||||
: undefined;
|
||||
let label = 'Show in Grid layout';
|
||||
let showGridLayout = true;
|
||||
|
||||
if (config.gridLayout) {
|
||||
label = 'Show in Graph layout';
|
||||
showGridLayout = false;
|
||||
}
|
||||
|
||||
const extraNodeItem = [
|
||||
{
|
||||
label: label,
|
||||
onClick: (node: NodeDatum) => {
|
||||
setFocusedNodeId(node.id);
|
||||
setConfig({ ...config, gridLayout: showGridLayout });
|
||||
setMenu(undefined);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const renderer = getItemsRenderer(getLinks(nodes, node.dataFrameRowIndex), node, extraNodeItem);
|
||||
|
||||
if (renderer) {
|
||||
|
Loading…
Reference in New Issue
Block a user