import React from 'react';
import PropTypes from 'prop-types';
import { FormGroup, TextInput, Radio } from '@patternfly/react-core';
import { translate as __ } from 'foremanReact/common/I18n';
import { helpLabel } from '../form/FormHelpers';
import { formatter } from '../form/Formatter';
import { NumberInput } from '../form/NumberInput';
export const EffectiveUserField = ({ value, setValue }) => (
setValue(newValue)}
/>
);
export const TimeoutToKillField = ({ value, setValue }) => (
setValue(newValue),
}}
/>
);
export const PasswordField = ({ value, setValue }) => (
setValue(newValue)}
/>
);
export const KeyPassphraseField = ({ value, setValue }) => (
setValue(newValue)}
/>
);
export const EffectiveUserPasswordField = ({ value, setValue }) => (
setValue(newValue)}
/>
);
export const ConcurrencyLevelField = ({ value, setValue }) => (
setValue(newValue),
}}
/>
);
export const TimeSpanLevelField = ({ value, setValue }) => (
setValue(newValue),
}}
/>
);
export const ExecutionOrderingField = ({ isRandomizedOrdering, setValue }) => (
- Ordered - executes the jobs on hosts in alphabetical order
- Randomized - randomizes the order in which jobs are executed on hosts
'
),
}}
/>,
'effective-user-password'
)}
isInline
>
setValue(false)}
id="execution-order-alphabetical"
label={__('Alphabetical')}
/>
setValue(true)}
id="execution-order-randomized"
label={__('Randomized')}
/>
);
export const TemplateInputsFields = ({ inputs, value, setValue }) => (
<>{inputs?.map(input => formatter(input, value, setValue))}>
);
EffectiveUserField.propTypes = {
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
setValue: PropTypes.func.isRequired,
};
EffectiveUserField.defaultProps = {
value: '',
};
TimeoutToKillField.propTypes = EffectiveUserField.propTypes;
TimeoutToKillField.defaultProps = EffectiveUserField.defaultProps;
PasswordField.propTypes = EffectiveUserField.propTypes;
PasswordField.defaultProps = EffectiveUserField.defaultProps;
KeyPassphraseField.propTypes = EffectiveUserField.propTypes;
KeyPassphraseField.defaultProps = EffectiveUserField.defaultProps;
EffectiveUserPasswordField.propTypes = EffectiveUserField.propTypes;
EffectiveUserPasswordField.defaultProps = EffectiveUserField.defaultProps;
ConcurrencyLevelField.propTypes = EffectiveUserField.propTypes;
ConcurrencyLevelField.defaultProps = EffectiveUserField.defaultProps;
TimeSpanLevelField.propTypes = EffectiveUserField.propTypes;
TimeSpanLevelField.defaultProps = EffectiveUserField.defaultProps;
ExecutionOrderingField.propTypes = {
isRandomizedOrdering: PropTypes.bool,
setValue: PropTypes.func.isRequired,
};
ExecutionOrderingField.defaultProps = {
isRandomizedOrdering: false,
};
TemplateInputsFields.propTypes = {
inputs: PropTypes.array.isRequired,
value: PropTypes.object,
setValue: PropTypes.func.isRequired,
};
TemplateInputsFields.defaultProps = {
value: {},
};