Skip to content

Commit fc01a5b

Browse files
committed
Added focus control to cron editor
1 parent 744d680 commit fc01a5b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ interface Props {
6767
fieldToPreferredValueMap: FieldToValueMap;
6868
frequency: Frequency;
6969
}) => void;
70+
autoFocus: boolean;
7071
}
7172

7273
type State = FieldToValueMap;
@@ -234,6 +235,7 @@ export class CronEditor extends Component<Props, State> {
234235
fullWidth
235236
>
236237
<EuiSelect
238+
autoFocus={this.props.autoFocus}
237239
options={excludeBlockListedFrequencies(UNITS, frequencyBlockList)}
238240
value={frequency}
239241
onChange={(e: React.ChangeEvent<HTMLSelectElement>) =>

x-pack/plugins/rollup/public/crud_app/sections/job_create/steps/step_logistics.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ export class StepLogistics extends Component {
4545
hasMatchingIndices: PropTypes.bool.isRequired,
4646
indexPatternAsyncErrors: PropTypes.array,
4747
};
48+
state = { cronFocus: false };
4849

4950
showAdvancedCron = () => {
51+
this.setState({ cronFocus: true });
5052
const { onFieldsChange } = this.props;
5153

5254
onFieldsChange({
@@ -55,6 +57,7 @@ export class StepLogistics extends Component {
5557
};
5658

5759
hideAdvancedCron = () => {
60+
this.setState({ cronFocus: true });
5861
const { onFieldsChange, fields } = this.props;
5962
const { simpleRollupCron } = fields;
6063

@@ -156,6 +159,7 @@ export class StepLogistics extends Component {
156159
fullWidth
157160
>
158161
<EuiFieldText
162+
autoFocus={this.state.cronFocus}
159163
value={rollupCron}
160164
onChange={(e) => onFieldsChange({ rollupCron: e.target.value })}
161165
isInvalid={Boolean(areStepErrorsVisible && errorRollupCron)}
@@ -181,6 +185,7 @@ export class StepLogistics extends Component {
181185
return (
182186
<Fragment>
183187
<CronEditor
188+
autoFocus={this.state.cronFocus}
184189
fieldToPreferredValueMap={fieldToPreferredValueMap}
185190
cronExpression={rollupCron}
186191
frequency={cronFrequency}

0 commit comments

Comments
 (0)