/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React, { ChangeEvent, Component } from "react"; import { EuiSpacer, EuiCheckbox, EuiRadioGroup, EuiFormRow, EuiFieldNumber, EuiAccordion, EuiHorizontalRule } from "@elastic/eui"; import { ContentPanel } from "../../../../components/ContentPanel"; import { selectInterval } from "../../../Transforms/utils/metadataHelper"; interface ScheduleProps { isEdit: boolean; transformId: string; transformIdError: string; jobEnabledByDefault: boolean; continuousJob: string; pageSize: number; onChangeJobEnabledByDefault: () => void; interval: number; intervalTimeunit: string; intervalError: string; onChangeContinuousJob: (optionId: string) => void; onChangeIntervalTime: (e: ChangeEvent) => void; onChangeIntervalTimeunit: (e: ChangeEvent) => void; onChangePage: (e: ChangeEvent) => void; } const radios = [ { id: "no", label: "No", }, { id: "yes", label: "Yes", }, ]; const isContinuous = (continuousJob: string, onChangeContinuousJob: (optionId: string) => void) => ( onChangeContinuousJob(id)} name="continuousJob" /> ); export default class Schedule extends Component { constructor(props: ScheduleProps) { super(props); } render() { const { isEdit, jobEnabledByDefault, continuousJob, interval, intervalTimeunit, intervalError, pageSize, onChangeJobEnabledByDefault, onChangeContinuousJob, onChangeIntervalTime, onChangeIntervalTimeunit, onChangePage, } = this.props; return (
{!isEdit && ( )} {!isEdit && isContinuous(continuousJob, onChangeContinuousJob)} {/* TODO: Replace with switch block when define by cron expressions is supported. */} {selectInterval(interval, intervalTimeunit, intervalError, onChangeIntervalTime, onChangeIntervalTimeunit)}
); } }