Skip to content

Commit 2ec87e1

Browse files
committed
disabling switch when running
1 parent ced6f1b commit 2ec87e1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

x-pack/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/start_datafeed_switch/start_datafeed_switch.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ import { EuiSwitch, EuiFormRow, EuiSpacer } from '@elastic/eui';
1010
interface Props {
1111
startDatafeed: boolean;
1212
setStartDatafeed(start: boolean): void;
13+
disabled?: boolean;
1314
}
1415

15-
export const StartDatafeedSwitch: FC<Props> = ({ startDatafeed, setStartDatafeed }) => {
16+
export const StartDatafeedSwitch: FC<Props> = ({
17+
startDatafeed,
18+
setStartDatafeed,
19+
disabled = false,
20+
}) => {
1621
return (
1722
<>
1823
<EuiSpacer />
@@ -31,6 +36,7 @@ export const StartDatafeedSwitch: FC<Props> = ({ startDatafeed, setStartDatafeed
3136
})}
3237
checked={startDatafeed}
3338
onChange={(e) => setStartDatafeed(e.target.checked)}
39+
disabled={disabled}
3440
/>
3541
</EuiFormRow>
3642
</>

x-pack/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/summary.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export const SummaryStep: FC<StepProps> = ({ setCurrentStep, isCurrentStep }) =>
6161
}, []);
6262

6363
async function start() {
64+
setCreatingJob(true);
6465
if (isAdvanced) {
6566
await createAdvancedJob();
6667
} else if (startDatafeed === true) {
@@ -71,7 +72,6 @@ export const SummaryStep: FC<StepProps> = ({ setCurrentStep, isCurrentStep }) =>
7172
}
7273

7374
async function createAndStartJob() {
74-
setCreatingJob(true);
7575
try {
7676
const jr = await jobCreator.createAndStartJob();
7777
setJobRunner(jr);
@@ -81,7 +81,6 @@ export const SummaryStep: FC<StepProps> = ({ setCurrentStep, isCurrentStep }) =>
8181
}
8282

8383
async function createAdvancedJob(showStartModal: boolean = true) {
84-
setCreatingJob(true);
8584
try {
8685
await jobCreator.createJob();
8786
await jobCreator.createDatafeed();
@@ -139,6 +138,7 @@ export const SummaryStep: FC<StepProps> = ({ setCurrentStep, isCurrentStep }) =>
139138
<StartDatafeedSwitch
140139
startDatafeed={startDatafeed}
141140
setStartDatafeed={setStartDatafeed}
141+
disabled={creatingJob}
142142
/>
143143
)}
144144

0 commit comments

Comments
 (0)