[Rollup Jobs] Added autofocus to cron editor (#86324)

This commit is contained in:
Yulia Čech 2020-12-19 01:53:09 +01:00 committed by GitHub
parent 94b49451ef
commit f7ace5e16d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -67,6 +67,7 @@ interface Props {
fieldToPreferredValueMap: FieldToValueMap;
frequency: Frequency;
}) => void;
autoFocus?: boolean;
}
type State = FieldToValueMap;
@ -234,6 +235,7 @@ export class CronEditor extends Component<Props, State> {
fullWidth
>
<EuiSelect
autoFocus={this.props.autoFocus}
options={excludeBlockListedFrequencies(UNITS, frequencyBlockList)}
value={frequency}
onChange={(e: React.ChangeEvent<HTMLSelectElement>) =>

View file

@ -45,8 +45,10 @@ export class StepLogistics extends Component {
hasMatchingIndices: PropTypes.bool.isRequired,
indexPatternAsyncErrors: PropTypes.array,
};
state = { cronFocus: false };
showAdvancedCron = () => {
this.setState({ cronFocus: true });
const { onFieldsChange } = this.props;
onFieldsChange({
@ -55,6 +57,7 @@ export class StepLogistics extends Component {
};
hideAdvancedCron = () => {
this.setState({ cronFocus: true });
const { onFieldsChange, fields } = this.props;
const { simpleRollupCron } = fields;
@ -156,6 +159,7 @@ export class StepLogistics extends Component {
fullWidth
>
<EuiFieldText
autoFocus={this.state.cronFocus}
value={rollupCron}
onChange={(e) => onFieldsChange({ rollupCron: e.target.value })}
isInvalid={Boolean(areStepErrorsVisible && errorRollupCron)}
@ -181,6 +185,7 @@ export class StepLogistics extends Component {
return (
<Fragment>
<CronEditor
autoFocus={this.state.cronFocus}
fieldToPreferredValueMap={fieldToPreferredValueMap}
cronExpression={rollupCron}
frequency={cronFrequency}