From f063d4daa363ca119111a343fbef624314a13a32 Mon Sep 17 00:00:00 2001 From: Ben White Date: Wed, 21 Aug 2024 14:32:21 +0100 Subject: [PATCH] feat(cdp): Notify if template updates are available (#24386) Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .../hogfunctions/HogFunctionConfiguration.tsx | 18 +++++++++++++----- .../hogFunctionConfigurationLogic.tsx | 10 +++++++++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/frontend/src/scenes/pipeline/hogfunctions/HogFunctionConfiguration.tsx b/frontend/src/scenes/pipeline/hogfunctions/HogFunctionConfiguration.tsx index 8fcb30b45dd4c..a1a055618386a 100644 --- a/frontend/src/scenes/pipeline/hogfunctions/HogFunctionConfiguration.tsx +++ b/frontend/src/scenes/pipeline/hogfunctions/HogFunctionConfiguration.tsx @@ -1,4 +1,4 @@ -import { IconInfo, IconPlus } from '@posthog/icons' +import { IconPlus } from '@posthog/icons' import { LemonBanner, LemonButton, @@ -7,6 +7,7 @@ import { LemonInput, LemonLabel, LemonSwitch, + LemonTag, LemonTextArea, Link, SpinnerOverlay, @@ -51,6 +52,7 @@ export function HogFunctionConfiguration({ templateId, id }: { templateId?: stri sparkline, sparklineLoading, template, + templateHasChanged, } = useValues(logic) const { submitConfiguration, @@ -211,9 +213,6 @@ export function HogFunctionConfiguration({ templateId, id }: { templateId?: stri
Close
- resetToTemplate()}> - Reset to template - New function from template + + {templateHasChanged ? ( + resetToTemplate()}> + Update + + ) : null} } @@ -229,7 +234,10 @@ export function HogFunctionConfiguration({ templateId, id }: { templateId?: stri Built from template: {hogFunction?.template.name} - + + {templateHasChanged ? ( + Update available! + ) : null} diff --git a/frontend/src/scenes/pipeline/hogfunctions/hogFunctionConfigurationLogic.tsx b/frontend/src/scenes/pipeline/hogfunctions/hogFunctionConfigurationLogic.tsx index 363dfc3934878..c67a021e03987 100644 --- a/frontend/src/scenes/pipeline/hogfunctions/hogFunctionConfigurationLogic.tsx +++ b/frontend/src/scenes/pipeline/hogfunctions/hogFunctionConfigurationLogic.tsx @@ -487,6 +487,13 @@ export const hogFunctionConfigurationLogic = kea [s.hogFunction, s.configuration], + (hogFunction, configuration) => { + return hogFunction?.template?.hog && hogFunction.template.hog !== configuration.hog + }, + ], })), listeners(({ actions, values, cache }) => ({ @@ -583,8 +590,9 @@ export const hogFunctionConfigurationLogic = kea {