Widget Dependencies

Control widget visibility using calendar, threshold, percentage, and custom function conditions.

Overview

Dependencies determine whether a widget appears in a report. There are four types: calendar conditions, threshold conditions, threshold percentage conditions, and custom functions. Prefix any condition with ! to negate it.

Calendar Conditions

Calendar conditions set in MCS can control widget visibility. Use the condition name directly, or prefix with ! for NOT TRUE.

The example below shows the widget only if monday is a true calendar condition AND january is NOT true:

depend: [
    ['monday', '!january']
]

Threshold Conditions

Threshold conditions show or hide a widget based on whether a test result meets a threshold level. For example, show text only if VoIP Jitter is considered good.

The example below is true if Upstream Jitter is good AND Downstream Jitter is NOT bad:

depend: [
    ['voip.jitter|good', '!voip.djitter|bad']
]

Threshold Percentage Conditions

Threshold percentage conditions evaluate whether a group of results falls above or below a set percentage. For example, show text if bad results account for less than 25% of total results for the time period.

True if less than 25% of Upstream Jitter results are bad:

depend: [
    ['!voip.jitter|bad|25']
]

True if more than 75% of Upstream Jitter results are good:

depend: [
    ['voip.jitter|good|75']
]

Custom Function

A JavaScript function that returns true or false can also control widget visibility. Parameters are supported, including metric results.

Both functions below must return true for the dependency to pass:

depend: [
    ['customFunction()', 'otherFunction(||voip.jitter||,"string")']
]

Example function implementation:

function otherFunction(upjitter, str) {
    if (upjitter > 0 && str === 'string') return true;
    return false;
}

Dependency Rules

The dependency array is processed top-down. Conditions within a single inner array are combined with AND. The inner arrays themselves are combined with OR.

AND Example

Both conditions must be true — if either wednesday or march is false, the dependency fails:

depend: [
    ['wednesday', 'march']
]

OR Example

Only one array needs to pass. If wednesday is false, processing moves to the next array — if march is true, the dependency passes:

depend: [
    ['wednesday'],
    ['march']
]

Combining Conditions

Threshold conditions, calendar conditions, and custom functions can be combined freely:

depend: [
    ['wednesday', 'voip.jitter|good'],
    ['march', 'customFunc("test")']
]

The first array tests the wednesday calendar condition and the VoIP Jitter threshold. If either is false, the second array is evaluated — testing the march calendar condition and a custom function.