Skip to content

Commit 412c4da

Browse files
committed
#5833 - fix onboarding finish
1 parent a4c91ac commit 412c4da

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

redisinsight/ui/src/pages/pub-sub/PubSubPage.tsx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { EuiTitle } from '@elastic/eui'
22
import React, { useEffect, useState } from 'react'
3-
import { useSelector } from 'react-redux'
3+
import { useDispatch, useSelector } from 'react-redux'
44
import { useParams } from 'react-router-dom'
55
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
66
import { SubscriptionType } from 'uiSrc/constants/pubSub'
7-
import { sendPageViewTelemetry, TelemetryPageView } from 'uiSrc/telemetry'
7+
import { sendEventTelemetry, sendPageViewTelemetry, TelemetryEvent, TelemetryPageView } from 'uiSrc/telemetry'
88
import { formatLongName, getDbIndex, setTitle } from 'uiSrc/utils'
99

1010
import { OnboardingTour } from 'uiSrc/components'
1111
import { ONBOARDING_FEATURES } from 'uiSrc/components/onboarding-features'
12+
import { incrementOnboardStepAction } from 'uiSrc/slices/app/features'
13+
import { OnboardingSteps } from 'uiSrc/constants/onboarding'
1214
import { MessagesListWrapper, PublishMessage, SubscriptionPanel } from './components'
1315

1416
import styles from './styles.module.scss'
@@ -21,9 +23,28 @@ const PubSubPage = () => {
2123

2224
const [isPageViewSent, setIsPageViewSent] = useState(false)
2325

26+
const dispatch = useDispatch()
27+
2428
const dbName = `${formatLongName(connectedInstanceName, 33, 0, '...')} ${getDbIndex(db)}`
2529
setTitle(`${dbName} - Pub/Sub`)
2630

31+
useEffect(() => () => {
32+
// as here is the last step of onboarding, we set next step when move from the page
33+
// remove it when triggers&functions won't be the last page
34+
dispatch(incrementOnboardStepAction(
35+
OnboardingSteps.Finish,
36+
0,
37+
() => {
38+
sendEventTelemetry({
39+
event: TelemetryEvent.ONBOARDING_TOUR_FINISHED,
40+
eventData: {
41+
databaseId: instanceId
42+
}
43+
})
44+
}
45+
))
46+
}, [])
47+
2748
useEffect(() => {
2849
if (connectedInstanceName && !isPageViewSent) {
2950
sendPageView(instanceId)

0 commit comments

Comments
 (0)