mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* [ML] Retain _meta on clone * [ML] Fix validation on schema to only check it it's defined/not null * [ML] Remove validation because es should handle the validation already * Change type to unknown Co-authored-by: Quynh Nguyen <43350163+qn895@users.noreply.github.com>
This commit is contained in:
parent
02faf630b0
commit
bd75d8047a
5 changed files with 20 additions and 0 deletions
|
@ -94,6 +94,13 @@ function transformConfigPayloadValidator<
|
|||
}
|
||||
}
|
||||
|
||||
export const _metaSchema = schema.object(
|
||||
{},
|
||||
{
|
||||
unknowns: 'allow',
|
||||
}
|
||||
);
|
||||
|
||||
// PUT transforms/{transformId}
|
||||
export const putTransformsRequestSchema = schema.object(
|
||||
{
|
||||
|
@ -112,6 +119,11 @@ export const putTransformsRequestSchema = schema.object(
|
|||
settings: schema.maybe(settingsSchema),
|
||||
source: sourceSchema,
|
||||
sync: schema.maybe(syncSchema),
|
||||
/**
|
||||
* This _meta field stores an arbitrary key-value map
|
||||
* where keys are strings and values are arbitrary objects (possibly also maps).
|
||||
*/
|
||||
_meta: schema.maybe(_metaSchema),
|
||||
},
|
||||
{
|
||||
validate: transformConfigPayloadValidator,
|
||||
|
|
|
@ -24,6 +24,7 @@ export type TransformBaseConfig = PutTransformsRequestSchema & {
|
|||
create_time?: number;
|
||||
version?: string;
|
||||
alerting_rules?: TransformHealthAlertRule[];
|
||||
_meta?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export interface PivotConfigDefinition {
|
||||
|
|
|
@ -242,6 +242,7 @@ export const getCreateTransformRequestBody = (
|
|||
},
|
||||
}
|
||||
: {}),
|
||||
...(transformDetailsState._meta ? { _meta: transformDetailsState._meta } : {}),
|
||||
// conditionally add additional settings
|
||||
...getCreateTransformSettingsRequestBody(transformDetailsState),
|
||||
});
|
||||
|
|
|
@ -27,6 +27,7 @@ export interface StepDetailsExposedState {
|
|||
transformSettingsDocsPerSecond?: number;
|
||||
valid: boolean;
|
||||
indexPatternTimeField?: string | undefined;
|
||||
_meta?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
const defaultContinuousModeDelay = '60s';
|
||||
|
@ -94,6 +95,10 @@ export function applyTransformConfigToDetailsState(
|
|||
state.transformSettingsDocsPerSecond = transformConfig.settings.docs_per_second;
|
||||
}
|
||||
}
|
||||
|
||||
if (transformConfig._meta) {
|
||||
state._meta = transformConfig._meta;
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -289,6 +289,7 @@ export const StepDetailsForm: FC<StepDetailsFormProps> = React.memo(
|
|||
touched: true,
|
||||
valid,
|
||||
indexPatternTimeField,
|
||||
_meta: defaults._meta,
|
||||
});
|
||||
// custom comparison
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue