Skip to content

Commit 9d14da3

Browse files
committed
RI-6280 move rdi on click telemetry
1 parent c7eb066 commit 9d14da3

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

redisinsight/ui/src/pages/rdi/home/instance-list/RdiInstancesListWrapper.spec.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,22 @@ describe('RdiInstancesListWrapper', () => {
195195
});
196196
(sendEventTelemetry as jest.Mock).mockRestore()
197197
})
198+
199+
it('should call proper telemetry on instance click', async () => {
200+
const sendEventTelemetryMock = jest.fn();
201+
(sendEventTelemetry as jest.Mock).mockImplementation(() => sendEventTelemetryMock)
202+
render(<RdiInstancesListWrapper {...instance(mockedProps)} />)
203+
204+
await act(() => {
205+
fireEvent.click(screen.getByTestId('rdi-alias-1'))
206+
})
207+
208+
expect(sendEventTelemetry).toBeCalledWith({
209+
event: TelemetryEvent.OPEN_RDI_CLICKED,
210+
eventData: {
211+
rdiId: '1',
212+
}
213+
});
214+
(sendEventTelemetry as jest.Mock).mockRestore()
215+
})
198216
})

redisinsight/ui/src/pages/rdi/home/instance-list/RdiInstancesListWrapper.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,15 @@ const RdiInstancesListWrapper = ({ width, onEditInstance, editedInstance, onDele
6969
}, [width])
7070

7171
const handleCheckConnectToInstance = (id: string) => {
72+
sendEventTelemetry({
73+
event: TelemetryEvent.OPEN_RDI_CLICKED,
74+
eventData: {
75+
rdiId: id,
76+
}
77+
})
7278
dispatch(checkConnectToRdiInstanceAction(
7379
id,
74-
(id: string) => {
75-
sendEventTelemetry({
76-
event: TelemetryEvent.OPEN_RDI_CLICKED,
77-
eventData: {
78-
rdiId: id,
79-
}
80-
})
81-
history.push(Pages.rdiPipeline(id))
82-
},
80+
(id: string) => history.push(Pages.rdiPipeline(id)),
8381
() => dispatch(setAppContextConnectedRdiInstanceId(''))
8482
))
8583
}

0 commit comments

Comments
 (0)