Skip to content

Commit efb29c2

Browse files
committed
#RI-5344 - update explore guides component
1 parent 74fbd3e commit efb29c2

File tree

4 files changed

+24
-29
lines changed

4 files changed

+24
-29
lines changed

redisinsight/ui/src/components/explore-guides/ExploreGuides.spec.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { render, screen, fireEvent } from 'uiSrc/utils/test-utils'
55
import { MOCK_EXPLORE_GUIDES } from 'uiSrc/constants/mocks/mock-explore-guides'
66
import { INSTANCE_ID_MOCK } from 'uiSrc/mocks/handlers/instances/instancesHandlers'
77
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
8-
import { KeyViewType } from 'uiSrc/slices/interfaces/keys'
98
import { findTutorialPath } from 'uiSrc/utils'
109

1110
import ExploreGuides from './ExploreGuides'
@@ -42,8 +41,8 @@ describe('ExploreGuides', () => {
4241
it('should render guides', () => {
4342
render(<ExploreGuides />)
4443

45-
MOCK_EXPLORE_GUIDES.forEach(({ title, icon }) => {
46-
expect(screen.getByTestId(`guide-button-${title}`)).toBeInTheDocument()
44+
MOCK_EXPLORE_GUIDES.forEach(({ tutorialId, icon }) => {
45+
expect(screen.getByTestId(`guide-button-${tutorialId}`)).toBeInTheDocument()
4746
expect(screen.getByTestId(`guide-icon-${icon}`)).toBeInTheDocument()
4847
})
4948
})
@@ -55,7 +54,7 @@ describe('ExploreGuides', () => {
5554

5655
render(<ExploreGuides />)
5756

58-
fireEvent.click(screen.getByTestId('guide-button-Search and Query'))
57+
fireEvent.click(screen.getByTestId('guide-button-sq-intro'))
5958

6059
expect(pushMock)
6160
.toHaveBeenCalledWith({
@@ -70,7 +69,7 @@ describe('ExploreGuides', () => {
7069

7170
render(<ExploreGuides />)
7271

73-
fireEvent.click(screen.getByTestId('guide-button-JSON'))
72+
fireEvent.click(screen.getByTestId('guide-button-ds-json-intro'))
7473

7574
expect(pushMock).toHaveBeenCalledWith({
7675
search: 'path=tutorials/path'
@@ -83,15 +82,15 @@ describe('ExploreGuides', () => {
8382

8483
render(<ExploreGuides />)
8584

86-
fireEvent.click(screen.getByTestId('guide-button-Search and Query'))
85+
fireEvent.click(screen.getByTestId('guide-button-sq-intro'))
8786

8887
expect(sendEventTelemetry).toBeCalledWith({
89-
event: TelemetryEvent.BROWSER_TUTORIAL_CLICKED,
88+
event: TelemetryEvent.INSIGHTS_PANEL_OPENED,
9089
eventData: {
9190
databaseId: INSTANCE_ID_MOCK,
92-
guideName: 'Search and Query',
91+
tutorialId: 'sq-intro',
9392
provider: 'RE_CLOUD',
94-
viewType: KeyViewType.Browser,
93+
source: 'empty browser'
9594
}
9695
})
9796
})

redisinsight/ui/src/components/explore-guides/ExploreGuides.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { guideLinksSelector } from 'uiSrc/slices/content/guide-links'
77
import GUIDE_ICONS from 'uiSrc/components/explore-guides/icons'
88
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
99
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
10-
import { keysSelector } from 'uiSrc/slices/browser/keys'
1110

1211
import { openTutorialByPath } from 'uiSrc/slices/panels/insights'
1312
import { findTutorialPath } from 'uiSrc/utils'
@@ -16,21 +15,20 @@ import styles from './styles.module.scss'
1615
const ExploreGuides = () => {
1716
const { data } = useSelector(guideLinksSelector)
1817
const { provider } = useSelector(connectedInstanceSelector)
19-
const { viewType } = useSelector(keysSelector)
2018

2119
const { instanceId = '' } = useParams<{ instanceId: string }>()
2220

2321
const history = useHistory()
2422
const dispatch = useDispatch()
2523

26-
const handleLinkClick = (tutorialId: string, title: string) => {
24+
const handleLinkClick = (tutorialId: string) => {
2725
sendEventTelemetry({
28-
event: TelemetryEvent.BROWSER_TUTORIAL_CLICKED,
26+
event: TelemetryEvent.INSIGHTS_PANEL_OPENED,
2927
eventData: {
3028
databaseId: instanceId,
31-
guideName: title,
29+
tutorialId,
3230
provider,
33-
viewType
31+
source: 'empty browser'
3432
}
3533
})
3634

@@ -53,9 +51,9 @@ const ExploreGuides = () => {
5351
role="button"
5452
tabIndex={0}
5553
onKeyDown={() => {}}
56-
onClick={() => handleLinkClick(tutorialId, title)}
54+
onClick={() => handleLinkClick(tutorialId)}
5755
className={styles.btn}
58-
data-testid={`guide-button-${title}`}
56+
data-testid={`guide-button-${tutorialId}`}
5957
>
6058
{icon in GUIDE_ICONS && (
6159
<EuiIcon
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
export const MOCK_EXPLORE_GUIDES = [
22
{
33
title: 'Search and Query',
4-
tutorial: '/quick-guides/document/introduction.md',
4+
tutorialId: 'sq-intro',
55
icon: 'search'
66
},
7-
{
8-
title: 'Vector Similarity Search',
9-
tutorial: '/quick-guides/vector-similarity-search/introduction.md',
10-
icon: 'vector-similarity-search'
11-
},
127
{
138
title: 'JSON',
14-
tutorial: '/quick-guides/document/working-with-json.md',
9+
tutorialId: 'ds-json-intro',
1510
icon: 'json'
1611
},
12+
{
13+
title: 'Triggers and functions',
14+
tutorialId: 'tf-intro',
15+
icon: 'triggers-and-functions'
16+
},
1717
{
1818
title: 'Time Series',
19-
tutorial: '/quick-guides/time-series/introduction.md',
19+
tutorialId: 'ds-ts-intro',
2020
icon: 'time-series'
2121
},
2222
{
23-
title: 'Probabilistic Data Structures',
24-
tutorial: '/quick-guides/probabilistic-data-structures/introduction.md',
23+
title: 'Probabilistic',
24+
tutorialId: 'ds-prob-intro',
2525
icon: 'probabilistic-data-structures'
2626
}
2727
]

redisinsight/ui/src/telemetry/events.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ export enum TelemetryEvent {
7878
BROWSER_WORKBENCH_LINK_CLICKED = 'BROWSER_WORKBENCH_LINK_CLICKED',
7979
BROWSER_DATABASE_INDEX_CHANGED = 'BROWSER_DATABASE_INDEX_CHANGED',
8080
BROWSER_FILTER_MODE_CHANGE_FAILED = 'BROWSER_FILTER_MODE_CHANGE_FAILED',
81-
BROWSER_TUTORIAL_CLICKED = 'BROWSER_TUTORIAL_CLICKED',
8281
LIST_VIEW_OPENED = 'LIST_VIEW_OPENED',
83-
OVERVIEW_MENU_CLICKED = 'OVERVIEW_MENU_CLICKED',
8482

8583
CLI_OPENED = 'CLI_OPENED',
8684
CLI_CLOSED = 'CLI_CLOSED',

0 commit comments

Comments
 (0)