-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Adding validation to the edit job flyout (#21041)
* [ML] Adding validation to the edit job flyout * removing a bit of lodash * tiny code clean up * fixing validation check
- Loading branch information
1 parent
d6453fa
commit bf6cc70
Showing
7 changed files
with
183 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
x-pack/plugins/ml/public/jobs/jobs_list_new/components/edit_job_flyout/validate_job.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* 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 { newJobLimits } from 'plugins/ml/jobs/new_job/utils/new_job_defaults'; | ||
import { populateValidationMessages } from 'plugins/ml/jobs/new_job/simple/components/utils/validate_job'; | ||
|
||
import { | ||
validateModelMemoryLimit as validateModelMemoryLimitUtils, | ||
validateGroupNames as validateGroupNamesUtils, | ||
} from 'plugins/ml/../common/util/job_utils'; | ||
|
||
export function validateModelMemoryLimit(mml) { | ||
const limits = newJobLimits(); | ||
const tempJob = { | ||
analysis_limits: { | ||
model_memory_limit: mml | ||
} | ||
}; | ||
const validationResults = validateModelMemoryLimitUtils(tempJob, limits); | ||
const { valid } = validationResults; | ||
|
||
const modelMemoryLimit = { | ||
valid, | ||
message: '', | ||
}; | ||
|
||
populateValidationMessages(validationResults, { modelMemoryLimit }); | ||
|
||
return modelMemoryLimit; | ||
} | ||
|
||
export function validateGroupNames(groups) { | ||
const tempJob = { | ||
groups | ||
}; | ||
|
||
const validationResults = validateGroupNamesUtils(tempJob); | ||
const { valid } = validationResults; | ||
|
||
const groupIds = { | ||
valid, | ||
message: '', | ||
}; | ||
|
||
populateValidationMessages(validationResults, { groupIds }); | ||
|
||
return groupIds; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters