Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Always enable next button in advanced job validation #78931

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { JobCreatorContext } from '../job_creator_context';
import { ml } from '../../../../../services/ml_api_service';
import { ValidateJob } from '../../../../../components/validate_job';
import { JOB_TYPE } from '../../../../../../../common/constants/new_job';
import { ValidationWarningCallout } from './validation_warning_callout';

const idFilterList = [
'job_id_valid',
Expand Down Expand Up @@ -56,7 +57,7 @@ export const ValidationStep: FC<StepProps> = ({ setCurrentStep, isCurrentStep })
// caught in previous basic checks
function setIsValid(valid: boolean) {
jobValidator.advancedValid = valid;
setNextActive(valid);
setNextActive(jobCreator.type === JOB_TYPE.ADVANCED || valid);
}

return (
Expand All @@ -71,6 +72,7 @@ export const ValidationStep: FC<StepProps> = ({ setCurrentStep, isCurrentStep })
setIsValid={setIsValid}
idFilterList={idFilterList}
/>
{jobCreator.type === JOB_TYPE.ADVANCED && <ValidationWarningCallout />}
<WizardNav
previous={() => setCurrentStep(WIZARD_STEPS.JOB_DETAILS)}
next={() => setCurrentStep(WIZARD_STEPS.SUMMARY)}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React, { FC, useContext, useEffect, useState } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiCallOut } from '@elastic/eui';
import { JobCreatorContext } from '../job_creator_context';
import { JOB_TYPE } from '../../../../../../../common/constants/new_job';

export const ValidationWarningCallout: FC = () => {
const { jobCreator, jobValidator, jobValidatorUpdated } = useContext(JobCreatorContext);
const [valid, setValid] = useState(false);

useEffect(() => {
setValid(jobValidator.validationSummary.advanced);
}, [jobValidatorUpdated]);

return jobCreator.type === JOB_TYPE.ADVANCED && valid === false ? (
<EuiCallOut
title={
<FormattedMessage
id="xpack.ml.newJob.wizard.validationStep.validationWarning.title"
defaultMessage="Validation failed"
/>
}
color="warning"
iconType="alert"
>
<FormattedMessage
id="xpack.ml.newJob.wizard.validationStep.validationWarning.message"
defaultMessage="Job validation has failed, however for the advanced wizard it is still possible to continue to create the job.
Please be aware the this job may encounter problems when running."
/>
</EuiCallOut>
) : null;
};