-
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 job cloning to new wizards (#42370)
* [ML] Adding job cloing to new wizards * refactor * renaming CombinedJobConfig * moving cloning to jobCreator classes * using job service cloner to remove stats * making overrideConfigs protected * changing duration to timeRange
- Loading branch information
1 parent
95175e9
commit 459514f
Showing
14 changed files
with
233 additions
and
37 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
24 changes: 24 additions & 0 deletions
24
x-pack/legacy/plugins/ml/public/jobs/new_job_new/common/job_creator/configs/combined_job.ts
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,24 @@ | ||
/* | ||
* 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 { cloneDeep } from 'lodash'; | ||
import { Datafeed } from './datafeed'; | ||
import { Job } from './job'; | ||
|
||
// in older implementations of the job config, the datafeed was placed inside the job | ||
// for convenience. | ||
export interface CombinedJob extends Job { | ||
datafeed_config: Datafeed; | ||
} | ||
|
||
export function expandCombinedJobConfig(combinedJob: CombinedJob) { | ||
const combinedJobClone = cloneDeep(combinedJob); | ||
const job = combinedJobClone; | ||
const datafeed = combinedJobClone.datafeed_config; | ||
delete job.datafeed_config; | ||
|
||
return { job, datafeed }; | ||
} |
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 |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
|
||
export * from './job'; | ||
export * from './datafeed'; | ||
export * from './combined_job'; |
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
26 changes: 26 additions & 0 deletions
26
x-pack/legacy/plugins/ml/public/jobs/new_job_new/common/job_creator/util/general.ts
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,26 @@ | ||
/* | ||
* 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 { Detector } from '../configs'; | ||
import { newJobCapsService } from '../../../../../services/new_job_capabilities_service'; | ||
|
||
// populate the detectors with Field and Agg objects loaded from the job capabilities service | ||
export function getRichDetectors(detectors: Detector[]) { | ||
return detectors.map(d => { | ||
return { | ||
agg: newJobCapsService.getAggById(d.function), | ||
field: d.field_name !== undefined ? newJobCapsService.getFieldById(d.field_name) : null, | ||
byField: | ||
d.by_field_name !== undefined ? newJobCapsService.getFieldById(d.by_field_name) : null, | ||
overField: | ||
d.over_field_name !== undefined ? newJobCapsService.getFieldById(d.over_field_name) : null, | ||
partitionField: | ||
d.partition_field_name !== undefined | ||
? newJobCapsService.getFieldById(d.partition_field_name) | ||
: null, | ||
}; | ||
}); | ||
} |
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
Oops, something went wrong.