@@ -3,15 +3,15 @@ import * as l10n from '@vscode/l10n'
3
3
import cx from 'classnames'
4
4
import { VSCodeButton } from '@vscode/webview-ui-toolkit/react'
5
5
import { BiSortDown , BiSortUp } from 'react-icons/bi'
6
- import { VscAdd , VscChevronDown , VscChevronRight , VscDatabase , VscTerminal } from 'react-icons/vsc'
6
+ import { VscAdd , VscDatabase , VscTerminal } from 'react-icons/vsc'
7
7
import { isUndefined } from 'lodash'
8
8
9
9
import { TelemetryEvent , nullableNumberWithSpaces , numberWithSpaces , sendEventTelemetry } from 'uiSrc/utils'
10
10
import { vscodeApi } from 'uiSrc/services'
11
11
import { SortOrder , VscodeMessageAction } from 'uiSrc/constants'
12
12
import { checkDatabaseIndexAction , Database , useContextApi , useContextInContext } from 'uiSrc/store'
13
- import { Nullable } from 'uiSrc/interfaces'
14
- import { RefreshBtn , Tooltip } from 'uiSrc/ui'
13
+ import { Maybe , Nullable } from 'uiSrc/interfaces'
14
+ import { Chevron , RefreshBtn , Tooltip } from 'uiSrc/ui'
15
15
16
16
import { KeyTreeFilter } from '../keys-tree-filter'
17
17
import { useKeysApi , useKeysInContext } from '../../hooks/useKeys'
@@ -24,7 +24,7 @@ export interface Props {
24
24
loading : boolean
25
25
total : Nullable < number >
26
26
showTree : boolean
27
- dbIndex : number
27
+ dbIndex : Maybe < number >
28
28
toggleShowTree : ( value ?: boolean ) => void
29
29
}
30
30
@@ -46,7 +46,7 @@ export const KeysSummary = (props: Props) => {
46
46
} )
47
47
vscodeApi . postMessage ( {
48
48
action : VscodeMessageAction . AddKey ,
49
- data : { database : { ...database , db : dbIndex ! } } ,
49
+ data : { database : { ...database , db : dbIndex } } ,
50
50
} )
51
51
}
52
52
@@ -69,7 +69,7 @@ export const KeysSummary = (props: Props) => {
69
69
return
70
70
}
71
71
if ( ! showTree ) {
72
- checkDatabaseIndexAction ( database . id , dbIndex ! , ( ) => toggleShowTree ( ) )
72
+ checkDatabaseIndexAction ( database . id , dbIndex , ( ) => toggleShowTree ( ) )
73
73
return
74
74
}
75
75
toggleShowTree ( )
@@ -78,23 +78,14 @@ export const KeysSummary = (props: Props) => {
78
78
const openCliClickHandle = ( ) => {
79
79
vscodeApi . postMessage ( {
80
80
action : VscodeMessageAction . AddCli ,
81
- data : { database : { ...database , db : dbIndex ! } } ,
81
+ data : { database : { ...database , db : dbIndex } } ,
82
82
} )
83
83
}
84
84
85
85
const refreshHandle = ( ) => {
86
86
keysApi . fetchPatternKeysAction ( )
87
87
}
88
88
89
- const Chevron = ( ) => {
90
- if ( ! isMultiDbIndex ) return null
91
- return showTree ? (
92
- < VscChevronDown className = { cx ( styles . icon , styles . iconNested ) } />
93
- ) : (
94
- < VscChevronRight className = { cx ( styles . icon , styles . iconNested ) } />
95
- )
96
- }
97
-
98
89
const DbIndex = ( ) => {
99
90
if ( ! isMultiDbIndex ) return null
100
91
return (
@@ -137,7 +128,7 @@ export const KeysSummary = (props: Props) => {
137
128
onClick = { handleToggleShowTree }
138
129
data-testid = "keys-summary"
139
130
>
140
- { < Chevron /> }
131
+ { < Chevron open = { showTree } display = { isMultiDbIndex } /> }
141
132
{ < DbIndex /> }
142
133
{ < Summary /> }
143
134
</ div >
0 commit comments