Skip to content

Commit 3be329f

Browse files
committed
#RI-3101 - Event CONFIG_DATABASES_DATABASE_LIST_SEARCHED contains instancesCount not correct
1 parent 5086580 commit 3be329f

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

redisinsight/ui/src/pages/home/components/SearchDatabasesList/SearchDatabasesList.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react'
1+
import React from 'react'
22
import { EuiFieldSearch } from '@elastic/eui'
33
import { useDispatch, useSelector } from 'react-redux'
44

@@ -15,24 +15,13 @@ export interface Props {
1515
}
1616

1717
const SearchDatabasesList = () => {
18-
const [focused, setFocused] = useState(false)
1918
const { data: instances } = useSelector(instancesSelector)
2019

2120
const dispatch = useDispatch()
2221

2322
const onQueryChange = (e: React.ChangeEvent<HTMLInputElement>) => {
2423
const value = e?.target?.value?.toLowerCase()
2524

26-
if (focused) {
27-
sendEventTelemetry({
28-
event: TelemetryEvent.CONFIG_DATABASES_DATABASE_LIST_SEARCHED,
29-
eventData: {
30-
instancesCount: instances.length
31-
}
32-
})
33-
setFocused(false)
34-
}
35-
3625
const itemsTemp = instances.map(
3726
(item: Instance) => ({
3827
...item,
@@ -45,6 +34,14 @@ const SearchDatabasesList = () => {
4534
})
4635
)
4736

37+
sendEventTelemetry({
38+
event: TelemetryEvent.CONFIG_DATABASES_DATABASE_LIST_SEARCHED,
39+
eventData: {
40+
instancesFullCount: instances.length,
41+
instancesSearchedCount: itemsTemp.filter(({ visible }) => (visible))?.length,
42+
}
43+
})
44+
4845
dispatch(loadInstancesSuccess(itemsTemp))
4946
}
5047

@@ -54,7 +51,6 @@ const SearchDatabasesList = () => {
5451
placeholder="Database List Search"
5552
className={styles.search}
5653
onChange={onQueryChange}
57-
onFocus={() => setFocused(true)}
5854
aria-label="Search database list"
5955
data-testid="search-database-list"
6056
/>

0 commit comments

Comments
 (0)