@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
31 lines (30 loc) • 1.49 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { isScheduledAlertDefinition } from '../../../Utilities/Helpers/Scheduling/ScheduledAlertHelper';
import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard';
import { isScheduleValid, ScheduleBuilderWizard, } from '../../Schedule/Wizard/ScheduleScheduleWizard';
import { Tag } from '../../../components/Tag';
import { SummaryText } from '../../Wizard/OnePageAdaptableWizard';
import UIHelper from '../../../View/UIHelper';
import { Flex } from '../../../components/Flex';
export const isScheduledAlertTimeValid = (alert) => {
if (!isScheduledAlertDefinition(alert)) {
return 'Schedule is not specified';
}
return isScheduleValid({ Schedule: alert.Schedule });
};
export const renderAlertScheduledSummary = (data) => {
if (!isScheduledAlertDefinition(data)) {
return null;
}
return (_jsxs(SummaryText, { children: ["Schedule: ", _jsx(Tag, { children: UIHelper.getScheduleDescription(data.Schedule) })] }));
};
export const AlertScheduledWizardSection = (props) => {
const { data } = useOnePageAdaptableWizardContext();
const handleScheduleChange = (scheduleData) => {
props.onChange({
...data,
Schedule: scheduleData.Schedule,
});
};
return (_jsx(Flex, { flexDirection: "column", className: "twa:gap-3 twa:p-3", children: _jsx(ScheduleBuilderWizard, { onChange: handleScheduleChange }) }));
};