UNPKG

@adaptabletools/adaptable

Version:

Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

35 lines (34 loc) 1.11 kB
import ObjectFactory from '../../../Utilities/ObjectFactory'; import { CreateEmptyScheduledAlertDefinition } from '../../../Utilities/Helpers/Scheduling/ScheduledAlertHelper'; import { AlertType } from './getAlertType'; export const getDefaultAlertDefinition = (alertDefinition, type) => { const newAlert = { ...ObjectFactory.CreateEmptyAlertDefinition(), Uuid: alertDefinition.Uuid, }; if (type === AlertType.Observable || type === AlertType.Aggregation || type === AlertType.RowChange) { newAlert.Scope = { All: true, }; } if (type === AlertType.RowChange) { newAlert.Rule = { ObservableExpression: 'ROW_ADDED()', }; } if (type === AlertType.Validation) { newAlert.AlertProperties = { PreventEdit: true, }; } if (type === AlertType.Scheduled) { return { ...CreateEmptyScheduledAlertDefinition(alertDefinition.Name), Uuid: alertDefinition.Uuid, Name: alertDefinition.Name, }; } return newAlert; };