[Synthetics] prevent origin from being included on legacy Synthetics integration policies (#137919) (#137962)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Shahzad <shahzad.muhammad@elastic.co>
(cherry picked from commit eea8f5e1f9)

Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
This commit is contained in:
Kibana Machine 2022-08-03 08:16:00 -04:00 committed by GitHub
parent 277b87c8b7
commit cea98120d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -18,7 +18,8 @@ export const formatSyntheticsPolicy = (
'monitor.project.name': string;
'monitor.project.id': string;
}
>
>,
isLegacy?: boolean
) => {
const configKeys = Object.keys(config) as ConfigKey[];
@ -45,6 +46,8 @@ export const formatSyntheticsPolicy = (
if (configItem) {
if (formatters[key]) {
configItem.value = formatters[key]?.(config);
} else if (key === ConfigKey.MONITOR_SOURCE_TYPE && isLegacy) {
configItem.value = undefined;
} else {
configItem.value = config[key] === undefined || config[key] === null ? null : config[key];
}

View file

@ -45,7 +45,8 @@ export const useUpdatePolicy = ({
const { formattedPolicy, dataStream, currentInput } = formatSyntheticsPolicy(
newPolicy,
monitorType,
config
config,
true
);
// prevent an infinite loop of updating the policy