Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -78,7 +78,10 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
const isRegOrClassJob =
jobType === ANALYSIS_CONFIG_TYPE.REGRESSION || jobType === ANALYSIS_CONFIG_TYPE.CLASSIFICATION;

const mmlInvalid = modelMemoryLimitValidationResult !== null;
const mmlInvalid =
modelMemoryLimitValidationResult !== null &&
(modelMemoryLimitValidationResult.invalidUnits !== undefined ||
modelMemoryLimitValidationResult.required === true);

const isStepInvalid =
mmlInvalid ||
Expand Down Expand Up @@ -340,7 +343,7 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
label={i18n.translate('xpack.ml.dataframe.analytics.create.modelMemoryLimitLabel', {
defaultMessage: 'Model memory limit',
})}
isInvalid={mmlInvalid}
isInvalid={modelMemoryLimitValidationResult !== null}
error={mmlErrors}
helpText={i18n.translate(
'xpack.ml.dataframe.analytics.create.modelMemoryLimitHelpText',
Expand All @@ -359,7 +362,7 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
disabled={isJobCreated}
value={modelMemoryLimit || ''}
onChange={(e) => setFormState({ modelMemoryLimit: e.target.value })}
isInvalid={mmlInvalid}
isInvalid={modelMemoryLimitValidationResult !== null}
data-test-subj="mlAnalyticsCreateJobWizardModelMemoryInput"
/>
</EuiFormRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function getModelMemoryLimitErrors(mmlValidationResult: any): string[] |
if (errorKey === 'min') {
acc.push(
i18n.translate('xpack.ml.dataframe.analytics.create.modelMemoryUnitsMinError', {
defaultMessage: 'Model memory limit cannot be lower than {mml}',
defaultMessage: 'Model memory limit is lower than estimated value {mml}',
values: {
mml: mmlValidationResult.min.minValue,
},
Expand Down Expand Up @@ -425,12 +425,15 @@ const validateForm = (state: State): State => {
dependentVariable === '';

const mmlValidationResult = validateMml(estimatedModelMemoryLimit, modelMemoryLimit);
const mmlInvalid =
mmlValidationResult !== null &&
(mmlValidationResult.invalidUnits !== undefined || mmlValidationResult.required === true);

state.form.modelMemoryLimitValidationResult = mmlValidationResult;

state.isValid =
!jobTypeEmpty &&
!mmlValidationResult &&
!mmlInvalid &&
!jobIdEmpty &&
jobIdValid &&
!jobIdExists &&
Expand Down