* [ML] Fixing use_null setting in advanced job wizard * fixing types * fixing false checks for detector fields Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: James Gowdy <jgowdy@elastic.co>
This commit is contained in:
parent
98992e6250
commit
7c6b5b4a37
|
@ -32,6 +32,7 @@ export interface RichDetector {
|
|||
excludeFrequent: estypes.ExcludeFrequent | null;
|
||||
description: string | null;
|
||||
customRules: CustomRule[] | null;
|
||||
useNull: boolean | null;
|
||||
}
|
||||
|
||||
export class AdvancedJobCreator extends JobCreator {
|
||||
|
@ -58,7 +59,8 @@ export class AdvancedJobCreator extends JobCreator {
|
|||
overField: SplitField,
|
||||
partitionField: SplitField,
|
||||
excludeFrequent: estypes.ExcludeFrequent | null,
|
||||
description: string | null
|
||||
description: string | null,
|
||||
useNull: boolean | null
|
||||
) {
|
||||
// addDetector doesn't support adding new custom rules.
|
||||
// this will be added in the future once it's supported in the UI
|
||||
|
@ -71,7 +73,8 @@ export class AdvancedJobCreator extends JobCreator {
|
|||
partitionField,
|
||||
excludeFrequent,
|
||||
description,
|
||||
customRules
|
||||
customRules,
|
||||
useNull
|
||||
);
|
||||
|
||||
this._addDetector(detector, agg, field);
|
||||
|
@ -86,7 +89,8 @@ export class AdvancedJobCreator extends JobCreator {
|
|||
partitionField: SplitField,
|
||||
excludeFrequent: estypes.ExcludeFrequent | null,
|
||||
description: string | null,
|
||||
index: number
|
||||
index: number,
|
||||
useNull: boolean | null
|
||||
) {
|
||||
const customRules =
|
||||
this._detectors[index] !== undefined ? this._detectors[index].custom_rules || null : null;
|
||||
|
@ -99,7 +103,8 @@ export class AdvancedJobCreator extends JobCreator {
|
|||
partitionField,
|
||||
excludeFrequent,
|
||||
description,
|
||||
customRules
|
||||
customRules,
|
||||
useNull
|
||||
);
|
||||
|
||||
this._editDetector(detector, agg, field, index);
|
||||
|
@ -117,7 +122,8 @@ export class AdvancedJobCreator extends JobCreator {
|
|||
partitionField: SplitField,
|
||||
excludeFrequent: estypes.ExcludeFrequent | null,
|
||||
description: string | null,
|
||||
customRules: CustomRule[] | null
|
||||
customRules: CustomRule[] | null,
|
||||
useNull: boolean | null
|
||||
): { detector: Detector; richDetector: RichDetector } {
|
||||
const detector: Detector = createBasicDetector(agg, field);
|
||||
|
||||
|
@ -139,6 +145,9 @@ export class AdvancedJobCreator extends JobCreator {
|
|||
if (customRules !== null) {
|
||||
detector.custom_rules = customRules;
|
||||
}
|
||||
if (useNull !== null) {
|
||||
detector.use_null = useNull;
|
||||
}
|
||||
|
||||
const richDetector: RichDetector = {
|
||||
agg,
|
||||
|
@ -149,6 +158,7 @@ export class AdvancedJobCreator extends JobCreator {
|
|||
excludeFrequent,
|
||||
description,
|
||||
customRules,
|
||||
useNull,
|
||||
};
|
||||
|
||||
return { detector, richDetector };
|
||||
|
@ -209,7 +219,8 @@ export class AdvancedJobCreator extends JobCreator {
|
|||
dtr.overField,
|
||||
dtr.partitionField,
|
||||
dtr.excludeFrequent,
|
||||
dtr.description
|
||||
dtr.description,
|
||||
dtr.useNull
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -79,8 +79,9 @@ export function getRichDetectors(
|
|||
byField,
|
||||
overField,
|
||||
partitionField,
|
||||
excludeFrequent: d.exclude_frequent || null,
|
||||
description: d.detector_description || null,
|
||||
excludeFrequent: d.exclude_frequent ?? null,
|
||||
description: d.detector_description ?? null,
|
||||
useNull: d.use_null ?? null,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -177,6 +177,7 @@ export const AdvancedDetectorModal: FC<Props> = ({
|
|||
: null,
|
||||
description: descriptionOption !== '' ? descriptionOption : null,
|
||||
customRules: null,
|
||||
useNull: null,
|
||||
};
|
||||
setDetector(dtr);
|
||||
setDescriptionPlaceholder(dtr);
|
||||
|
|
|
@ -29,6 +29,7 @@ const emptyRichDetector: RichDetector = {
|
|||
excludeFrequent: null,
|
||||
description: null,
|
||||
customRules: null,
|
||||
useNull: null,
|
||||
};
|
||||
|
||||
export const AdvancedDetectors: FC<Props> = ({ setIsValid }) => {
|
||||
|
@ -51,7 +52,8 @@ export const AdvancedDetectors: FC<Props> = ({ setIsValid }) => {
|
|||
dtr.overField,
|
||||
dtr.partitionField,
|
||||
dtr.excludeFrequent,
|
||||
dtr.description
|
||||
dtr.description,
|
||||
dtr.useNull
|
||||
);
|
||||
} else {
|
||||
jobCreator.editDetector(
|
||||
|
@ -62,7 +64,8 @@ export const AdvancedDetectors: FC<Props> = ({ setIsValid }) => {
|
|||
dtr.partitionField,
|
||||
dtr.excludeFrequent,
|
||||
dtr.description,
|
||||
index
|
||||
index,
|
||||
dtr.useNull
|
||||
);
|
||||
}
|
||||
jobCreatorUpdate();
|
||||
|
|
Loading…
Reference in a new issue