Alerts Technical Reference

Summary

  • Alerts are configured i the Alert section of Adaptable State
  • Alert Options contains many properties to enable fine-tuned configuring of Alerts
  • Run-time access to Alerts is primarily available through Alert API
  • The Alert Fired event is published every time an Alert is fired in AdapTable

Alert State

The Alert section of Adaptable State contains a collection of AlertDefinition objects:

PropertyTypeDescription
AlertDefinitionsAlertDefinition[]Alert Definitions - will trigger Alerts when rule is met

Each Alert Definition can be one of two types:

  • RuleBasedAlertDefinition
  • ScheduledAlertDefinition

Base Properties

Both inherit from Alert Definition Base which is defined as follows:

PropertyTypeDescription
MessageHeaderstringTitle of displayed Alert Message
MessageTextstringTitle of displayed Alert Message; if null, AdapTable creates dynamically using Rule & Scope
MessageTypeAdaptableMessageTypeType of Alert: 'Info', 'Success', 'Warning', 'Error'; influences Alert colour, icon and logging
NamestringName of the Alert Definition
IsReadOnlybooleanSets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')
IsSuspendedbooleanSuspends (i.e. turns off) an Adaptable Object

And both contain an AlertProperties object which derives from Alert Presentation Properties and defines some optional behaviour for the Alert:

PropertyTypeDescription
DisplayNotificationbooleanDisplays a notification when Alert is triggered
DisplaySystemStatusMessagebooleanShows the alert message in the System Status panel
LogToConsolebooleanLogs the Alert message to the console
NotificationDurationNotificationsOptions['duration']Notifiction duration(defaults to NotificationOptions.duration)
ShowInDivbooleanShows Alert text in the div specificed in alertContainer property of Container Options

Rule Based Alert Definition

The Rules Based Alert Definition is used for Alerts with Expressions and Scope:

PropertyTypeDescription
AlertFormstring |AlertButtonFormForm to display in Alert with buttons and inputs
AlertPropertiesRuleAlertPropertiesProperties which set what happens when the Alert is triggered (notification and grid behaviours)
RuleAlertRuleWhen Alert should be triggered
ScopeColumnScopeWhere Alert can be triggered: one, some or all columns or DataTypes
IsReadOnlybooleanSets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')
IsSuspendedbooleanSuspends (i.e. turns off) an Adaptable Object

And it has these Alert Properties of type RuleAlertProperties defined as follows:

PropertyTypeDescriptionDefault
HighlightCellboolean |AdaptableStyleColours updated Row using MessageType of triggering Alert Definition
HighlightRowboolean |AdaptableStyleColours updated Row using MessageType of triggering Alert Definition
JumpToCellbooleanGrid will 'jump' to the changed cell which triggered the Alert
JumpToRowbooleanGrid will 'jump' to the newly added row which triggered the Alert
PreventEditbooleanAutomatically prevent any cell edit which triggered the Alert (i.e. validation)false

Schedule Based Alert Definition

The Schedule Alert Definition is used for Alerts that run on a Schedule:

PropertyTypeDescription
AlertPropertiesScheduledAlertPropertiesNotification properties for scheduled alerts (no grid behaviours)
ScheduleScheduleWhen the alert should run
IsReadOnlybooleanSets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')
IsSuspendedbooleanSuspends (i.e. turns off) an Adaptable Object

And it has these Alert Properties of type ScheduledAlertProperties defined as follows:

PropertyTypeDescription
IncludeSuspendButtonbooleanWhen true, the scheduled notification includes a Suspend button

Alert Options

PropertyTypeDescriptionDefault
alertFormsAlertForm<TData>[]Full definitions of Alert Forms - the names of which are provided in Alert State
alertMessageHeader(alertMessageContext:AlertMessageContext<TData>) => string | undefinedFunction providing Header to display in Alert; if empty, AdapTable provides dynamically
alertMessageText(alertMessageContext:AlertMessageContext<TData>) => string | undefinedFunction providing Message to display in Alert; if empty, AdapTable provides dynamically
cellHighlightDurationnumberHow long (in ms) a Cell will be highlighted when an Alert fires2000
commandHandlersCommandHandler<TData>[]Custom onClick Handlers for Buttons (displayed in Alert Forms)
dataChangeDetectionPolicyDataChangeDetectionPolicyWhether Alert rule is evaluated against the rawValue or formattedValue of the changed cell data'rawValue'
maxAlertsInStorenumberHow many alerts held in State at any one time; when limit is breached, oldest alert will be removed20
rowHighlightDurationnumberHow long (in ms) a Row will be highlighted when an Alert Fires4000
showMissingPrimaryKeyAlertbooleanShows Alert if Primary Key column in Adaptable Options is not present or incorrectfalse
statusbarHighlightDurationnumberHow long (in ms) Alert panel in Status Bar highlights when an Alert Fires2000

Alert API

Full programmatic access to Alerts and related features is available in Alert API.

This enables Alerts to be accessed, created, edited, deleted and shared programmatically.

MethodReturnsDescription
addAlertDefinition(alertDefinition)AlertDefinitionAdds given Alert Definition to Adaptable State
applyScheduledAlertDefinition(alertDefinition)voidFires a scheduled alert definition (notification, system status, etc.)
deleteAlertDefinition(alertDefinition)voidDeletes given Alert Definition from Adaptable State
displayAdaptableAlert(alertToShow)Promise<void>Displays the given Adaptable Alert
displayAdaptableAlertNotification(alert)voidDisplays given Alert as a Toast
editAlertDefinition(alertDefinition)AlertDefinitionUpdates given Alert Definition in Adaptable State
evaluateAlertDefinitions(alertDefinitions)voidEvaluates the given Alert Definitions - will fire Alert if rule is met
findAlertDefinitions(alertLookupCriteria)AlertDefinition[]Find all Alert Definitions which match the given criteria
getActiveAlertDefinitions(config)AlertDefinition[]Retrieves all Alert Definitions which are currently active
getAlertDefinitionById(id, config)AlertDefinitionRetrieves alert definition by the technical ID (from AlertState)
getAlertDefinitionByName(name)AlertDefinition | undefinedRetrieves an Alert Definition by its Name
getAlertDefinitions(config)AlertDefinition[]Retrieves all Alert Definitions in Alert State
getAlertState()AlertStateRetrieves Alert section from Adaptable State
getSuspendedAlertDefinitions(config)AlertDefinition[]Retrieves all Alert Definitions which are currently suspended
openAlertSettingsPanel()voidOpens Settings Panel with Alert section selected and visible
showAlert(alertHeader, alertMessage, messageType, alertProperties)Promise<void>Creates Alert based on given parameters and displays it.
showAlertError(alertHeader, alertMessage)Promise<void>Creates an Adaptable Alert based on given parameters and displays it as Error Alert.
showAlertInfo(alertHeader, alertMessage)Promise<void>Creates an Adaptable Alert based on given parameters and displays it as Info Alert.
showAlertSuccess(alertHeader, alertMessage)Promise<void>Creates an Adaptable Alert based on given parameters and displays it as Succcess Alert.
showAlertWarning(alertHeader, alertMessage)Promise<void>Creates an Adaptable Alert based on given parameters and displays it as Warning Alert.
suspendAlertDefinition(alertDefinition)AlertDefinitionSuspends Alert Definition
suspendAllAlertDefinition()voidSuspends all Alert Definitions
unSuspendAlertDefinition(alertDefinition)AlertDefinitionActivates a suspended Alert Definition
unSuspendAllAlertDefinition()voidActivates all suspended Alert Definition

Alert Fired Event

The Alert Fired Event is published by AdapTable whenever an Alert is fired.