From beaa26764c71aad25e0a501642ff4ecf98bc77ab Mon Sep 17 00:00:00 2001 From: Syerikjan Kh Date: Wed, 18 Dec 2024 09:03:10 -0500 Subject: [PATCH] fix: upgrade/install button interaction event condition (#98142) --- .../plugins/admin/components/VersionInstallButton.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/app/features/plugins/admin/components/VersionInstallButton.tsx b/public/app/features/plugins/admin/components/VersionInstallButton.tsx index 58774fc30b8..1da8bfe01f7 100644 --- a/public/app/features/plugins/admin/components/VersionInstallButton.tsx +++ b/public/app/features/plugins/admin/components/VersionInstallButton.tsx @@ -11,7 +11,7 @@ import { isPreinstalledPlugin } from '../helpers'; import { useInstall } from '../state/hooks'; import { Version } from '../types'; -const PLUGINS_VERSION_PAGE_INSTALL_INTERACTION_EVENT_NAME = 'plugins_upgrade_clicked'; +const PLUGINS_VERSION_PAGE_UPGRADE_INTERACTION_EVENT_NAME = 'plugins_upgrade_clicked'; const PLUGINS_VERSION_PAGE_CHANGE_INTERACTION_EVENT_NAME = 'plugins_downgrade_clicked'; interface Props { @@ -61,8 +61,8 @@ export const VersionInstallButton = ({ schema_version: '1.0.0', }; - if (!installedVersion) { - reportInteraction(PLUGINS_VERSION_PAGE_INSTALL_INTERACTION_EVENT_NAME, trackProps); + if (!installedVersion || gt(version.version, installedVersion)) { + reportInteraction(PLUGINS_VERSION_PAGE_UPGRADE_INTERACTION_EVENT_NAME, trackProps); } else { reportInteraction(PLUGINS_VERSION_PAGE_CHANGE_INTERACTION_EVENT_NAME, { ...trackProps,