/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React, { ChangeEvent, Component } from "react"; import moment from "moment-timezone"; import { EuiSpacer, EuiCheckbox, EuiRadioGroup, EuiFormRow, EuiSelect, EuiFieldNumber, EuiFlexGroup, EuiFlexItem, EuiTextArea, EuiFormHelpText, EuiText, } from "@elastic/eui"; import { DelayTimeunitOptions, ScheduleIntervalTimeunitOptions } from "../../utils/constants"; import { ContentPanel } from "../../../../components/ContentPanel"; interface ScheduleProps { isEdit: boolean; rollupId: string; rollupIdError: string; jobEnabledByDefault: boolean; continuousJob: string; continuousDefinition: string; interval: number; intervalTimeunit: string; intervalError: string; cronExpression: string; cronTimezone: string; pageSize: number; delayTime: number | string; delayTimeunit: string; onChangeJobEnabledByDefault: () => void; onChangeCron: (e: ChangeEvent) => void; onChangeCronTimezone: (e: ChangeEvent) => void; onChangeDelayTime: (e: ChangeEvent) => void; onChangeIntervalTime: (e: ChangeEvent) => void; onChangePage: (e: ChangeEvent) => void; onChangeContinuousDefinition: (e: ChangeEvent) => void; onChangeContinuousJob: (optionId: string) => void; onChangeDelayTimeunit: (e: ChangeEvent) => void; onChangeIntervalTimeunit: (e: ChangeEvent) => void; } const radios = [ { id: "no", label: "No", }, { id: "yes", label: "Yes", }, ]; const selectInterval = ( interval: number, intervalTimeunit: string, intervalError: string, onChangeInterval: (e: ChangeEvent) => void, onChangeTimeunit: (value: ChangeEvent) => void ) => ( ); const isContinuous = (continuousJob: string, onChangeContinuousJob: (optionId: string) => void) => ( onChangeContinuousJob(id)} name="continuousJob" /> ); const timezones = moment.tz.names().map((tz) => ({ label: tz, text: tz })); export default class Schedule extends Component { constructor(props: ScheduleProps) { super(props); } render() { const { isEdit, jobEnabledByDefault, continuousJob, continuousDefinition, interval, intervalTimeunit, intervalError, cronExpression, cronTimezone, pageSize, delayTime, delayTimeunit, onChangeJobEnabledByDefault, onChangeCron, onChangeCronTimezone, onChangeDelayTime, onChangeIntervalTime, onChangePage, onChangeContinuousDefinition, onChangeContinuousJob, onChangeDelayTimeunit, onChangeIntervalTimeunit, } = this.props; return (
{!isEdit && ( )} {!isEdit && isContinuous(continuousJob, onChangeContinuousJob)} {continuousDefinition == "fixed" ? ( selectInterval(interval, intervalTimeunit, intervalError, onChangeIntervalTime, onChangeIntervalTimeunit) ) : ( )}

Execution delay

– optional
The amount of time the job waits for data ingestion to accommodate any necessary processing time.
); } }