Skip to content

Commit e5f4a81

Browse files
authored
Merge pull request #772 from devtron-labs/chore/ga-event
feat: add common handler for GA events
2 parents 1039ce9 + c9a41ad commit e5f4a81

4 files changed

Lines changed: 16 additions & 10 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.15.0-pre-4",
3+
"version": "1.15.0-pre-5",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Analytics/analytics.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import ReactGA from 'react-ga4'
2+
import { UaEventOptions } from 'react-ga4/types/ga4'
3+
14
import { get } from '@Common/API'
25
import { ROUTES } from '@Common/Constants'
36

@@ -13,3 +16,11 @@ export const handleSendAnalyticsEventToServer = async (
1316
// Do nothing
1417
}
1518
}
19+
20+
export const handleAnalyticsEvent = ({ category, action }: Pick<UaEventOptions, 'category' | 'action'>) => {
21+
if (window._env_.GA_ENABLED && ReactGA?.event)
22+
ReactGA.event({
23+
category,
24+
action,
25+
})
26+
}

src/Shared/Components/CICDHistory/TriggerOutput.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
useInterval,
3232
} from '../../../Common'
3333
import { DEPLOYMENT_STAGE_TO_NODE_MAP, EMPTY_STATE_STATUS } from '../../constants'
34-
import { TabGroup, TabGroupProps } from '../TabGroup'
34+
import { TabGroup } from '../TabGroup'
3535
import Artifacts from './Artifacts'
3636
import DeploymentDetailSteps from './DeploymentDetailSteps'
3737
import { DeploymentHistoryConfigDiff } from './DeploymentHistoryConfigDiff'
@@ -318,11 +318,6 @@ const TriggerOutput = ({
318318
(!!triggerDetailsResult?.result?.artifactId || !!triggerDetails?.artifactId),
319319
)
320320

321-
const tabs: TabGroupProps['tabs'] = useMemo(
322-
() => getTriggerOutputTabs(triggerDetails, deploymentAppType),
323-
[triggerDetails, deploymentAppType],
324-
)
325-
326321
useEffect(() => {
327322
if (triggerDetailsLoading) {
328323
return
@@ -417,7 +412,7 @@ const TriggerOutput = ({
417412
namespace={triggerDetails.namespace}
418413
/>
419414
<div className="pl-50 pr-20 pt-8 dc__border-bottom dc__position-sticky dc__top-0 bg__primary dc__zi-3">
420-
<TabGroup tabs={tabs} />
415+
<TabGroup tabs={getTriggerOutputTabs(triggerDetails, deploymentAppType)} />
421416
</div>
422417
</>
423418
)}

0 commit comments

Comments
 (0)