mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ML] Transforms: Extend editing and creation options. (#77370)
Extends the available options in the edit transform flyout and the wizard details step.
This commit is contained in:
parent
4b49e5a1c8
commit
4e7b7bf65f
24 changed files with 933 additions and 321 deletions
|
@ -8,12 +8,18 @@ import { schema, TypeOf } from '@kbn/config-schema';
|
|||
|
||||
import { TransformPivotConfig } from '../types/transform';
|
||||
|
||||
import { destSchema, settingsSchema, sourceSchema, syncSchema } from './transforms';
|
||||
import { settingsSchema, sourceSchema, syncSchema } from './transforms';
|
||||
|
||||
// POST _transform/{transform_id}/_update
|
||||
export const postTransformsUpdateRequestSchema = schema.object({
|
||||
description: schema.maybe(schema.string()),
|
||||
dest: schema.maybe(destSchema),
|
||||
// we cannot reuse `destSchema` because `index` is optional for the update request
|
||||
dest: schema.maybe(
|
||||
schema.object({
|
||||
index: schema.string(),
|
||||
pipeline: schema.maybe(schema.string()),
|
||||
})
|
||||
),
|
||||
frequency: schema.maybe(schema.string()),
|
||||
settings: schema.maybe(settingsSchema),
|
||||
source: schema.maybe(sourceSchema),
|
||||
|
|
|
@ -17,3 +17,21 @@ export const getNestedProperty = (
|
|||
|
||||
return value;
|
||||
};
|
||||
|
||||
export const setNestedProperty = (obj: Record<string, any>, accessor: string, value: any) => {
|
||||
let ref = obj;
|
||||
const accessors = accessor.split('.');
|
||||
const len = accessors.length;
|
||||
for (let i = 0; i < len - 1; i++) {
|
||||
const attribute = accessors[i];
|
||||
if (ref[attribute] === undefined) {
|
||||
ref[attribute] = {};
|
||||
}
|
||||
|
||||
ref = ref[attribute];
|
||||
}
|
||||
|
||||
ref[accessors[len - 1]] = value;
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue