Skip to content

Commit fd136cd

Browse files
committed
chore: add react-ga event on deployment template toolbar
1 parent aeab336 commit fd136cd

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/components/deploymentConfig/DeploymentTemplateView/DeploymentConfigToolbar.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import React from 'react'
18+
import ReactGA from 'react-ga4'
1819
import { ReactComponent as FileCode } from '../../../assets/icons/ic-file-code.svg'
1920
import { ReactComponent as CompareIcon } from '../../../assets/icons/ic-arrows-left-right.svg'
2021
import { ReactComponent as ReadmeIcon } from '../../../assets/icons/ic-book-open.svg'
@@ -58,6 +59,14 @@ export default function DeploymentConfigToolbar({
5859
setConvertVariables(!convertVariables)
5960
}
6061

62+
const handleCompareManifestClicked = () => {
63+
ReactGA.event({
64+
category: 'Deployment Template',
65+
action: 'Compare manifest clicked',
66+
})
67+
handleOptionClick(false)
68+
}
69+
6170
const renderDropdownContainer = () => (
6271
<div
6372
className="flex-col white-background dc__position-abs bcn-0 w-204 h-72 dc__border-radius-4-imp dc__left-0 dc__border dc__zi-20 config-toolbar-dropdown-shadow"
@@ -72,7 +81,7 @@ export default function DeploymentConfigToolbar({
7281
/>
7382
<DropdownItem
7483
label="Compare generated manifest"
75-
onClick={() => handleOptionClick(false)}
84+
onClick={handleCompareManifestClicked}
7685
index={2}
7786
isValues={isValues}
7887
/>
@@ -82,6 +91,14 @@ export default function DeploymentConfigToolbar({
8291

8392
const tippyMsg = convertVariables ? 'Hide variables values' : 'Show variables values'
8493

94+
const handleCompareValuesButtonClick = (e) => {
95+
ReactGA.event({
96+
category: 'Deployment Template',
97+
action: 'Compare values clicked'
98+
})
99+
changeTab(e)
100+
}
101+
85102
return (
86103
<div className="config-toolbar-container flex dc__content-space bcn-0 pt-8 pl-16 pr-16 dc__border-bottom">
87104
{!noReadme && showReadme ? (
@@ -100,7 +117,7 @@ export default function DeploymentConfigToolbar({
100117
className={`${getTabClassName(2)} dc__position-rel`}
101118
data-index={2}
102119
data-testid="compare-values-tab"
103-
onClick={changeTab}
120+
onClick={handleCompareValuesButtonClick}
104121
>
105122
<CompareIcon className={getTabIconClass(2)} />
106123
Compare&nbsp;

0 commit comments

Comments
 (0)