import React from 'react'; import PropTypes from 'prop-types'; import { FormGroup } from '@patternfly/react-core'; import { translate as __ } from 'foremanReact/common/I18n'; import { SelectField } from '../form/SelectField'; import { repeatTypes } from '../../JobWizardConstants'; import { RepeatCron } from './RepeatCron'; import { RepeatHour } from './RepeatHour'; import { RepeatMonth } from './RepeatMonth'; import { RepeatDaily } from './RepeatDaily'; import { RepeatWeek } from './RepeatWeek'; export const RepeatOn = ({ repeatType, setRepeatType, repeatData, setRepeatData, setValid, }) => { const getRepeatComponent = () => { switch (repeatType) { case repeatTypes.cronline: return ( ); case repeatTypes.monthly: return ( ); case repeatTypes.weekly: return ( ); case repeatTypes.daily: return ( ); case repeatTypes.hourly: return ( ); default: return null; } }; return ( <> type !== repeatTypes.noRepeat )} setValue={newValue => { setRepeatType(newValue); }} value={repeatType} /> {getRepeatComponent()} ); }; RepeatOn.propTypes = { repeatType: PropTypes.oneOf(Object.values(repeatTypes)).isRequired, setRepeatType: PropTypes.func.isRequired, repeatData: PropTypes.object.isRequired, setRepeatData: PropTypes.func.isRequired, setValid: PropTypes.func.isRequired, };