Overriding Universal Topology Graphs

Learn how to override Oracle Communications Unified Assurance Universal Topology graphs.

You can override the data itself, for example, to apply custom styling, or the actions that occur when you interact with nodes or vertices on the Universal Topology graph. You can also create custom functions that you can call from topology tools in the UI.

Before overriding Universal Topology, you must be familiar with the following:

The overrides described in this section are specific to Universal Topology. They do not apply to other Unified Assurance UIs.

The class path for controlling the Universal Topology graph view is Graph.graphs.crud.controller.GraphsPanelViewController. The controller file is located in the $A1BASEDIR/www/packages/graph/src/graphs/crud/controller directory.

Overriding Data

To override the data, you can add overrides in the following GraphsPanelViewController methods, which are called at different stages of processing:

You can apply overrides to any of the methods, as relevant to your implementation.

The sample GraphsPanelViewControllerOverride.js available in the sdk-lib package illustrates all three data override types.

Overriding UI Interactions

To override the actions that occur when you interact with nodes or vertices on the Universal Topology graph, you can add overrides in a subset of the Ogma events defined in GraphsPanelViewController. You can add overrides in the following event handlers:

You can use one or more of the handlers as needed to achieve your goals. For example, you could override onKeydown to initiate the Ogma lasso selection tool when a user presses the Ctrl key, onKeyup to end lasso selection, and onBeforeKeydown to prevent the lasso selection from initiating if the mouse is hovering over a node.

In the default GraphsPanelViewController, the click event handlers are structured as follows:

  view.ogma.events.on('click', function(event) {
    if (me.onBeforeClick(event) !== false) {
        me.onClick(event);
        me.onAfterClick(event);
    }
  }, me);

The sample GraphsPanelViewControllerOverride.js available in the sdk-lib package illustrates several UI interaction overrides.

Supported Ogma Event Overrides

You can override the following Ogma events in GraphsPanelViewController:

See Events in the Ogma documentation for more information about these events.

Implementing Custom Functions with Topology Tools

You can create custom functions as overrides and call them from topology tools in context menus in Universal Topology graphs.

  1. Create a custom function in the override file. You can use the following parameters in the function:

    • Vertex:

      • Name

      • VertexID

      • VertexClass

      • Any properties set for the vertex

    • Edge

      • id

      • EdgeClass

      • Any properties set for the vertex

    For example, the sample GraphsPanelViewControllerOverride.js contains overrides that create a pulse effect. To create a tool that clears the pulse effect when selected from the context menu, you would add the following function to the override file:

    clearPulse: function(menuItem) {
        var me         = this,
            view       = this.getView(),
            name       = menuItem.Name,
            id         = menuItem.VertexID;
    
        if (this.intervalHandlers) {
            let handler = this.intervalHandlers[id];
    
            if (handler) {
                clearInterval(handler);
                delete this.intervalHandlers[id];
    
                a1.AN5.toastSuccess(tr('Device') + ' (' + name + ') ' + tr('alarm is reset'));
            }
        }
    }
    

    The example uses the Name and VertexID properties of the selected vertex.

  2. Apply the override as described in Overriding a User Interface

  3. Create a custom topology tool. See Tools in Unified Assurance User's Guide for information about the UI for creating topology tools.

    Set Path Type to Function and specify the custom function name in Path.

    To call the function created in the example, you would set Path to clearPulse.

  4. Add the custom tool to the topology menu. See Menus in Unified Assurance User's Guide for information about the UI for creating topology menus.

Overriding Ogma Node Grouping and Geo Clustering transformations

This section will describe how to use an override to enable and disable Node Grouping and Geo Clustering transformations in Ogma, as well as how to customise the functionality.

By default, only the out-of-the-box Node Grouping functionality is enabled so no Geo Clustering will occur.

To change this you will need to create an override of the GraphsPanelViewController file and set the clusteringMode variable to either "geocluster" to have only Geo Clustering enabled or "mixed" to have both Node Grouping and Geo Clustering enabled.

Supported Ogma Transformation Overrides

There are several functions and variables made available to override in the GraphsPanelViewController.

All the functions and variables below are optional, except when Geo Clustering is enabled then geoClusteringNodeGenerator and geoClusteringEdgeGenerator must be defined as a minimum.

For more details on the parameters passed into functions and the expected return data's formats, see the Ogma API documentation.

General Variables

You can override the general variables described in the following table.

Variable Name Default Value Description
clusteringMode default Used to decide which transformations are enabled. Options are default, geocluster, and mixed.

Node Grouping Variables and Functions

Caution:

Overriding any of these variables or functions will affect the default node grouping functionality.

You can override the node grouping variables described in the following table.

Variable Name Default Value Description
nodeGroupingPadding 10 Padding applied to groups showing their content. If a function is passed, each MetaNode will get a padding depending on that function.
nodeGroupingDuration 600 Animation time in milliseconds. The animation will be played once after the creation of the group.

You can override the node grouping functions described in the following table.

Function Name Parameters Expected Return Type Description
nodeGroupingGroupIdFunction function(node: Node) string|undefined Given a node, must return a string identifying a group. All nodes for which the function returns the same value will be grouped together. By default, group all the nodes that were selected together. Returning undefined means that the node should not be grouped.
nodeGroupingShowContents function(metaNode: Node) boolean Function that would define if the contents of the group node should be hidden or not. This is called on every transformation update.
nodeGroupingGroupIdFunction function(nodes: NodeList, groupId: string, transformation: Transformation) NodeDataAndAttributes Given a list of nodes that should be grouped together, must return the new node (meta-node) to be added. GeoClustering will compute automatically the coordinate of the clusters.

Geo Clustering Variables and Functions

You can override the geo clustering variables described in the following table.

Variable Name Default Value Description
geoClusteringRadius 60 The radius in which a node gets grouped to another one.
geoClusteringGroupEdges true Indicates if parallel edges that end up having at least one meta-node extremity should be grouped together (to reduce cluttering).
geoClusteringSeparateEdgesByDirection false By default, edges that have opposite source and target are grouped together (resulting source and target not deterministic). If this option is true, they will not be grouped together.
geoClusteringGroupSelfLoopEdges false If true, edges for which the two extremities end up being grouped into the same node will be displayed as a self-loop edge, instead of not being displayed at all.

You can override the geo clustering functions described in the following table.

Function Name Parameters Expected Return Type Description
geoClusteringSelector function(node: Node) node: Node Only nodes that match this criteria will be grouped with other nodes. By default, all the nodes will be assigned a group.
geoClusteringNodeGenerator function(nodes: NodeList, groupId: string, transformation: Transformation) NodeDataAndAttributes|null Given a list of nodes that should be grouped together, must return the new node (meta-node) to be added. The latitude and longitude of the meta-node will be the average of the latitude and longitude of the nodes. If null is returned, the meta-node will not be created.
geoClusteringEdgeGenerator function(edges: EdgeList, groupId: string, transformation: Transformation) EdgeDataAndAttributes|null If groupEdges is true, indicates the function used to generate the new edges from the sub-edges. Ignored if groupEdges is false. If returned null, the meta edge will not be created.
geoClusteringOnCreated function(metaNode: Node, showContents: boolean, subNodes: NodeList, subEdges: EdgeList) Promise This is a callback called after a new group is created.
geoClusteringGroupIdFunction function(node: Node) string|undefined Given a node, must return a string identifying a group. All nodes for which the function returns the same value will be grouped together. By default, group all the nodes that were selected together.

Example Universal Topology Overrides

The sdk-lib package includes an example of a Universal Topology override. To review it, after installing the sdk-lib package, open the following file:

$A1BASEDIR/www/ui/customExampleOverrides/controller/GraphsPanelViewControllerOverride.js

The example includes overrides in:

You can deploy this override in your test environment to verify the behavior in the UI. See Overriding a User Interface.