From 45246c26b222093c4314506b0e60c406d357f2fd Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 14 Feb 2024 18:01:00 -0500 Subject: [PATCH] PR feedback. --- .../server/routes/monitor_cruds/add_monitor.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts b/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts index 0d895c22179c7..0be8cdce3560b 100644 --- a/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts +++ b/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts @@ -155,6 +155,10 @@ export const hydrateMonitorFields = async ({ { preserve_namespace?: boolean } >; + const inlineSource = (normalizedMonitor as BrowserSensitiveSimpleFields)?.[ + ConfigKey.SOURCE_INLINE + ] as string | undefined; + return { ...normalizedMonitor, [ConfigKey.MONITOR_QUERY_ID]: normalizedMonitor[ConfigKey.CUSTOM_HEARTBEAT_ID] || newMonitorId, @@ -162,14 +166,8 @@ export const hydrateMonitorFields = async ({ [ConfigKey.NAMESPACE]: preserveNamespace ? normalizedMonitor[ConfigKey.NAMESPACE] : getMonitorNamespace(server, request, normalizedMonitor[ConfigKey.NAMESPACE]), - [ConfigKey.SOURCE_PROJECT_CONTENT]: !!(normalizedMonitor as BrowserSensitiveSimpleFields)?.[ - ConfigKey.SOURCE_INLINE - ] - ? await inlineToProjectZip( - (normalizedMonitor as BrowserSensitiveSimpleFields)?.[ConfigKey.SOURCE_INLINE] as string, - newMonitorId, - server.logger - ) + [ConfigKey.SOURCE_PROJECT_CONTENT]: !!inlineSource + ? await inlineToProjectZip(inlineSource, newMonitorId, server.logger) : '', }; };