(node: Node, sceneElement)
| 325 | * Returns the d3 context menu specification for the provided node. |
| 326 | */ |
| 327 | export function getContextMenu(node: Node, sceneElement) { |
| 328 | let menu = [ |
| 329 | { |
| 330 | title: (d): string => { |
| 331 | return getIncludeNodeButtonString(node.include); |
| 332 | }, |
| 333 | action: (elm, d, i) => { |
| 334 | sceneElement.fire('node-toggle-extract', {name: node.name}); |
| 335 | }, |
| 336 | }, |
| 337 | ]; |
| 338 | if (sceneElement.nodeContextMenuItems) { |
| 339 | // Add these additional context menu items. |
| 340 | menu = menu.concat(sceneElement.nodeContextMenuItems); |
| 341 | } |
| 342 | if (canBeInSeries(node)) { |
| 343 | menu.push({ |
| 344 | title: (d) => { |
| 345 | return getGroupSettingLabel(node); |
| 346 | }, |
| 347 | action: (elm, d, i) => { |
| 348 | sceneElement.fire('node-toggle-seriesgroup', { |
| 349 | name: getSeriesName(node), |
| 350 | }); |
| 351 | }, |
| 352 | }); |
| 353 | } |
| 354 | return menu; |
| 355 | } |
| 356 | /** Returns if a node can be part of a grouped series */ |
| 357 | export function canBeInSeries(node: Node) { |
| 358 | return getSeriesName(node) !== null; |
no test coverage detected
searching dependent graphs…