UNPKG

@adaptabletools/adaptable

Version:

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

32 lines (31 loc) 915 B
import ObjectFactory from '../../../Utilities/ObjectFactory'; import { AlertType } from './getAlertType'; /** * This logic should be moved into Object factory once we have types on alert definitions * @param type AlertType */ export const getDefaultAlertDefinition = (alertDefinition, type) => { const newAlert = { ...ObjectFactory.CreateEmptyAlertDefinition(), Uuid: alertDefinition.Uuid, }; // can only be all 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, }; } return newAlert; };