File

widgets/implementations/alarms/alarm-widget.service.ts

Index

Methods

Constructor

constructor(alarmsViewService: AlarmsViewService)
Parameters :
Name Type Optional
alarmsViewService AlarmsViewService No

Methods

addAllMissingSeverityTypes
addAllMissingSeverityTypes(severity: SeverityFilter)

Adds any missing severity types to the provided severity object with a default value of false.

Example :
            - Missing severity types will be added to this object.
     that were missing with a value of `false`.
Parameters :
Name Type Optional Description
severity SeverityFilter No
  • A record object where keys are severity type strings and values are boolean.
  • Missing severity types will be added to this object.
Returns : SeverityFilter

The modified severity object, which includes all predefined severity types, adding any that were missing with a value of false.

allValuesFalse
allValuesFalse(obj: literal type)

Determines if all values in the given object are false.

This function checks every value in the provided object to see if they are all false.

Parameters :
Name Type Optional Description
obj literal type No
  • An object with boolean values.
Returns : boolean
  • Returns true if all values in the object are false, otherwise false.
extractFilterParams
extractFilterParams(obj: SeverityFilter | AlarmStatusSettings)

Extracts and concatenates filter parameters from a given object.

This function takes an object containing filter settings (either SeverityFilter or AlarmStatusSettings) and returns a string of all keys where the corresponding value is true. If the object is empty or null, an empty string is returned.

Parameters :
Name Type Optional Description
obj SeverityFilter | AlarmStatusSettings No
  • The object containing filter settings.
Returns : string
  • A concatenated string of keys with true values, separated by commas.
filterAlarmsByStatusSeverityAndType
filterAlarmsByStatusSeverityAndType(alarm: number | IAlarm, alarms: IAlarm[], config?: AlarmListWidgetConfig)

Filters alarms based on their status, severity, and type.

This method determines if a given alarm, identified either by a numeric ID or an IAlarm object, matches specific criteria defined in alarms and optionally config.

Example :
            filtering criteria.

     If `alarm` is a number, it always returns `false`.
     If `config` is not provided, it uses a legacy filter for critical alarms.
  • When alarm is a numeric ID, the function returns false as it cannot match against type and severity.
  • If config is not provided, the function assumes a legacy scenario for filtering all critical alarms.
Parameters :
Name Type Optional Description
alarm number | IAlarm No
  • The alarm to check, represented either by a numeric ID or an IAlarm object.
alarms IAlarm[] No
  • An array of IAlarm objects against which the given alarm is evaluated.
config AlarmListWidgetConfig Yes
  • Optional. Configuration for the alarm list widget, used to define additional filtering criteria.
Returns : boolean

true if the alarm matches the specified criteria; otherwise, false. If alarm is a number, it always returns false. If config is not provided, it uses a legacy filter for critical alarms.

getOrderParameters
getOrderParameters(order: AlarmOrderType)

Constructs a string of order parameters for a query based on the specified alarm order.

This function takes an alarm order and maps it to a corresponding set of order parameters. It supports different ordering types, such as BY_ACTIVE, BY_SEVERITY, and BY_DATE_ASCENDING. The order parameters are used to construct a query string that determines the order in which alarms are retrieved or displayed.

Parameters :
Name Type Optional Description
order AlarmOrderType No
  • The specified order for sorting alarms (e.g., BY_ACTIVE).
Returns : string
  • A string of order parameters to be used in a query, or an empty string if the order type is unrecognized.
getPredefinedConfiguration
getPredefinedConfiguration(isIntervalRefresh: boolean, widgetId?: string)

Creates predefined widget configuration object.

This method creates a new configuration object based on a widgets ID (that determines if is a legacy Recent or Critical alarms widget).

Parameters :
Name Type Optional Description
isIntervalRefresh boolean No
  • determines a type of a refresh.
widgetId string Yes
  • determines if a config should be done for Recent or Critical alarms widget.

The new, predefined configuration object.

hasExistingAlarmChangedStatus
hasExistingAlarmChangedStatus(existingAlarms: IAlarm[], incomingRealtimeAlarm: IAlarm)

Determines if an incoming real-time alarm has a different status than an existing alarm.

This function checks if the provided incoming real-time alarm's status differs from that of an existing alarm with the same ID in the given array of alarms.

Parameters :
Name Type Optional Description
existingAlarms IAlarm[] No
  • The array of existing alarms.
incomingRealtimeAlarm IAlarm No
  • The incoming real-time alarm to check.
Returns : boolean
  • True if the existing alarm's status has changed, otherwise false.
isContainingAllSeverityTypes
isContainingAllSeverityTypes(severity: SeverityFilter)

Checks if the provided severity object contains all the predefined severity types.

Example :
            - This object is checked against the predefined severity types.
Parameters :
Name Type Optional Description
severity SeverityFilter No
  • A record object where keys are severity type strings and values are boolean.
  • This object is checked against the predefined severity types.
Returns : boolean

true if all predefined severity types are present in the severity object; otherwise, false.

isOldAlarmConfigStructure
isOldAlarmConfigStructure(data: LegacyAlarmListConfig | AlarmListWidgetConfig)

Checks if the provided data follows the LegacyAlarmConfig structure.

This function determines if a given data object is an instance of LegacyAlarmConfig by checking for the presence of the 'options' property.

Parameters :
Name Type Optional Description
data LegacyAlarmListConfig | AlarmListWidgetConfig No
  • The data object to be checked.
  • Returns true if the data object is a LegacyAlarmConfig, otherwise false.
isTypesMatching
isTypesMatching(config: AlarmListWidgetConfig, alarm: IAlarm)

Checks if the configuration's types array contains only empty string or includes a specific alarm type.

Parameters :
Name Type Optional Description
config AlarmListWidgetConfig No
  • The configuration object with a types property.
alarm IAlarm No
  • The alarm object with a type property to check against the config's types.
Returns : boolean

true if the config's types array contains only empty string or includes the alarm's type, otherwise false.

mapConfigToQueryFilter
mapConfigToQueryFilter(config: AlarmListWidgetConfig, pageSize?: number)

Maps an AlarmListWidgetConfig object to an AlarmQueryFilter.

This function converts the provided AlarmListWidgetConfig into a format suitable for querying alarms.

Parameters :
Name Type Optional Description
config AlarmListWidgetConfig No
  • The configuration object for the alarm list widget.
pageSize number Yes
  • Optional number specifying the size of the pages to be returned in the query.
Returns : AlarmQueryFilter
  • The query filter object constructed from the provided configuration.
mapToNewConfigStructure
mapToNewConfigStructure(oldConfig: LegacyAlarmListConfig, isIntervalRefresh: boolean)

Transforms a LegacyAlarmConfig object into an AlarmListWidgetConfig object.

This function maps the properties from an old configuration structure (LegacyAlarmConfig) to a new configuration structure (AlarmListWidgetConfig).

Parameters :
Name Type Optional Description
oldConfig LegacyAlarmListConfig No
  • The old configuration object to be transformed.
isIntervalRefresh boolean No
  • The new configuration object mapped from the old one.

results matching ""

    No results matching ""