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