Configuring relationship types

You can customize the styles and labels for specified relationship types using the Relationship Types page. You can also delete existing, or create new relationship type styles.

You customize styles in two steps. First, you identify the relationship type to be customized, or create a relationship type. Then, you can customize the style elements for the relationship type. To customize the style, you can set the relationship line color, thickness, style, and label.

Any resource or relationship properties that are used in custom relationship styles must be added as required properties to the Advanced topology settings. If the properties do not exist in the advanced topology settings, you are prompted to add the properties when you save a new relationship style. For more information, see Advanced topology settings.

Procedure

  1. Log in to the IBM Cloud Pak for AIOps console.

  2. From the main navigation, expand Operate and click Topology viewer.

  3. From the topology navigation toolbar, expand Settings, and click Topology configuration.

  4. On the Relationship types card, click Configure.

    The Relationship types page is displayed and lists all of your existing customized relationship types in a table with sortable columns. The table also displays the last updated timestamp, and indicates whether a relationship type has a custom label, custom color, or custom width defined. From here, you can choose to delete or edit configurations. You can also create a relationship type configuration.

    Tips: To reduce the number of items displayed in the table, use the Filter table text field. The table is filtered as you enter the search text. You can click Refresh (top right) to reload the items displayed, which can be useful if other users are customizing them. You can select more than one relationship type and reset them to their default values, or perform a batch edit.

  5. Select the action that you want to complete:

    • To delete a relationship type, select them in the table and click Delete relationship settings.
    • To revert to default settings, select an item in the table and click Reset to defaults.
    • To edit existing relationship types, select them in the table and click Edit relationship type (or Batch edit relationship types). The Configure relationship type page is displayed.
    • To create a new relationship type, click New. The Configure relationship type page is displayed.
  6. Select the Identification tab on the Configure relationship type page.

    • Relationship Type

      Choose the relationship type that you want to configure from the dropdown list.

      Note: Only relationship types that exist in your topology database are listed.

    • Label Function

      Example of a JavaScript function to define a label for the relationship using the resource properties:

      return asmProperties.labelText;
      
  7. Select the Style tab on the Configure relationship type page.

    Warning: If you use the advanced JavaScript format to define colors, do not define a numeric value instead of an actual color, as this will prevent the topology rendering from being completed.

    • Line Color Function

      Example JavaScript function to define link color:

      return 'blue';
      

      Default function:

      return '#171717';
      
    • Line Width Function

      Example JavaScript function to define line width for the relationship using the source resource properties:

      return asmSourceProperties.myProp > 10 ? '9px' : '1.5px';
      

      Default function:

      return '0.5px';
      
    • Line Pattern Function

      Example of a JavaScript function to define the line pattern:

      return '3 4 5';
      

      Default function:

      return null;
      
  8. Click Save.

    If any resource or link properties are not defined in the Advanced topology settings, you are prompted to save the properties now.

The relationship style and label for the specified relationship type is customized.

Style restrictions

  • The line color (strokeWidth) property can have a maximum value of 9px. Any higher value can cause styling problems.

  • The label (linkLabel) property must return a valid string to be displayed alongside the relationship.

For detailed SVG style definition information, see:

Accessing properties for styling functions

When you are defining styles, you can access dynamic properties of the relationship or connected resources.

  • To access the properties of resources, use the asmProperties JavaScript object.

  • To access the properties of relationships, use the asmSourceProperties or asmTargetProperties JavaScript objects.

    Remember: The arrows indicating a relationship point from the source to the target.

  • To access the highest open severity status from the source or target resource, use the asmSourceProperties._hasStatus or asmTargetProperties._hasStatus JavaScript objects. The following example uses the _hasStatus parameter to modify the relationship label:

    if (asmSourceProperties._hasStatus || asmTargetProperties._hasStatus) {
        // object of all ASM's status severities
        let severityRank = {
            clear: 0,
            indeterminate: 1,
            information: 2,
            warning: 3,
            minor: 4,
            major: 5,
            critical: 6
        };
        let sourceSeverityRank = severityRank[asmSourceProperties._hasStatus] || 0;
        let targetSeverityRank = severityRank[asmTargetProperties._hasStatus] || 0;
        let labelString = asmProperties._edgeType;
        // Show highest Status on relationship label
        if(sourceSeverityRank > targetSeverityRank) {
            labelString += ': Status = ' + asmSourceProperties._hasStatus;
        } else {
            labelString += ': Status = ' + asmTargetProperties._hasStatus;
        }
        return labelString;
    } else {
        // No status for source or target resources use plain label
        return asmProperties._edgeType;
    }