@@ -126,18 +126,21 @@ export const SchemaNavigation = (props: React.PropsWithChildren<SchemaNavigation
126
126
< div className = { 'connections-instance-details' } style = { { height : DETAILS_BAR_HEIGHT } } >
127
127
< div className = 'connection-name' > { name } </ div >
128
128
< div className = 'connection-language' > { languageIdToName ( language_id ) } </ div >
129
- < div className = { 'connection-icon' } >
130
- {
131
- icon || < div className = 'codicon codicon-positron-database-connection' > </ div >
132
- }
133
- </ div >
129
+ {
130
+ icon ?
131
+ < img className = 'connection-icon' src = { icon } > </ img > :
132
+ < div className = 'connection-icon' >
133
+ < div className = 'codicon codicon-positron-database-connection' > </ div >
134
+ </ div >
135
+ }
134
136
</ div >
135
137
< List
136
138
itemCount = { entries . length }
137
139
itemSize = { 26 }
138
140
/* size if the actionbar and the secondary side bar combined) */
139
141
height = { height - ACTION_BAR_HEIGHT - DETAILS_BAR_HEIGHT }
140
- width = { 'calc(100% - 2px)' }
142
+ className = 'connections-items-list'
143
+ width = { '100%' }
141
144
itemKey = { index => entries [ index ] . id }
142
145
innerRef = { innerRef }
143
146
>
@@ -177,16 +180,9 @@ const PositronConnectionsItem = (props: React.PropsWithChildren<PositronConnecti
177
180
props . onToggleExpand ( props . item . id ) ;
178
181
} ;
179
182
180
- const icon = ( ( ) => {
181
-
182
- if ( props . item . icon ) {
183
- return props . item . icon ;
184
- }
185
-
186
- if ( props . item . kind ) {
187
- // TODO: we'll probably want backends to implement the casting to a set of known
188
- // types or provide their own icon.
189
- switch ( props . item . kind ) {
183
+ const iconClass = ( kind ?: string ) => {
184
+ if ( kind ) {
185
+ switch ( kind . toLowerCase ( ) ) {
190
186
case 'table' :
191
187
return 'positron-table-connection' ;
192
188
case 'view' :
@@ -198,11 +194,13 @@ const PositronConnectionsItem = (props: React.PropsWithChildren<PositronConnecti
198
194
case 'catalog' :
199
195
return 'positron-catalog-connection' ;
200
196
case 'field' :
201
- switch ( props . item . dtype ) {
197
+ switch ( props . item . dtype ?. toLowerCase ( ) ) {
202
198
case 'character' :
199
+ case 'string' :
203
200
return 'positron-data-type-string' ;
204
201
case 'integer' :
205
202
case 'numeric' :
203
+ case 'float' :
206
204
return 'positron-data-type-number' ;
207
205
case 'boolean' :
208
206
case 'bool' :
@@ -212,8 +210,26 @@ const PositronConnectionsItem = (props: React.PropsWithChildren<PositronConnecti
212
210
}
213
211
}
214
212
}
215
- // If kind is not known, then no icon is dplsayed by default.
213
+
216
214
return '' ;
215
+ }
216
+
217
+ const icon = ( ( ) => {
218
+ // icon is a base64 encoded png
219
+ if ( props . item . icon ) {
220
+ return < img
221
+ src = { props . item . icon }
222
+ >
223
+ </ img > ;
224
+ }
225
+
226
+ return < div
227
+ className = { positronClassNames (
228
+ 'codicon' ,
229
+ `codicon-${ iconClass ( props . item . kind ) } ` ,
230
+ ) }
231
+ >
232
+ </ div >
217
233
} ) ( ) ;
218
234
219
235
const rowMouseDownHandler = ( e : MouseEvent < HTMLElement > ) => {
@@ -268,17 +284,13 @@ const PositronConnectionsItem = (props: React.PropsWithChildren<PositronConnecti
268
284
{ props . item . error && < span className = 'connections-error codicon codicon-error' title = { props . item . error } > </ span > }
269
285
</ div >
270
286
< div
271
- className = 'connections-icon'
287
+ className = { positronClassNames (
288
+ 'connections-icon' ,
289
+ { 'disabled' : props . item . preview === undefined }
290
+ ) }
272
291
onClick = { ( ) => props . item . preview ?.( ) }
273
292
>
274
- < div
275
- className = { positronClassNames (
276
- 'codicon' ,
277
- `codicon-${ icon } ` ,
278
- { 'disabled' : props . item . preview === undefined }
279
- ) }
280
- >
281
- </ div >
293
+ { icon }
282
294
</ div >
283
295
</ div >
284
296
) ;
0 commit comments