diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx index fc0f2ac86f1479..9e5d1ac5eef6f3 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx @@ -204,7 +204,7 @@ export const JsonEditorFlyout: FC = ({ isDisabled, jobEditorMode, datafee > diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/data_view/change_data_view.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/data_view/change_data_view.tsx index d3072cb067e838..236f4d5fc65445 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/data_view/change_data_view.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/data_view/change_data_view.tsx @@ -42,6 +42,11 @@ import { const fixedPageSize: number = 8; +enum STEP { + PICK_DATA_VIEW, + VALIDATE, +} + interface Props { onClose: () => void; } @@ -61,7 +66,7 @@ export const ChangeDataViewModal: FC = ({ onClose }) => { const jobCreator = jc as AdvancedJobCreator; const [validating, setValidating] = useState(false); - const [step, setStep] = useState(0); + const [step, setStep] = useState(STEP.PICK_DATA_VIEW); const [currentDataViewTitle, setCurrentDataViewTitle] = useState(''); const [newDataViewTitle, setNewDataViewTitle] = useState(''); @@ -75,7 +80,7 @@ export const ChangeDataViewModal: FC = ({ onClose }) => { useEffect( function stepChange() { - if (step === 1) { + if (step === STEP.PICK_DATA_VIEW) { setValidationResponse(null); } }, @@ -84,7 +89,7 @@ export const ChangeDataViewModal: FC = ({ onClose }) => { function onDataViewSelected(dataViewId: string) { if (validating === false) { - setStep(2); + setStep(STEP.VALIDATE); validate(dataViewId); } } @@ -131,42 +136,7 @@ export const ChangeDataViewModal: FC = ({ onClose }) => { - {step === 0 && ( - <> - - - - - - - - - - - - - - - - - - - )} - {step === 1 && ( + {step === STEP.PICK_DATA_VIEW && ( <> = ({ onClose }) => { /> )} - {step === 2 && ( + {step === STEP.VALIDATE && ( <> = ({ onClose }) => { @@ -281,7 +251,7 @@ const ValidationMessage: FC<{ > );