Skip to content

Commit 5ce1470

Browse files
committed
#RIVS-256 - Vector formatters are displayed incorrectly
1 parent d2a22b0 commit 5ce1470

File tree

6 files changed

+25
-76
lines changed

6 files changed

+25
-76
lines changed

src/webviews/src/modules/key-details/components/hash-details/hash-details-table/HashDetailsTable.tsx

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -312,23 +312,15 @@ const HashDetailsTable = (props: Props) => {
312312
const decompressedItem = fieldItem
313313
const field = bufferToString(fieldItem) || ''
314314
// Better to cut the long string, because it could affect virtual scroll performance
315-
const { value, isValid } = formattingBuffer(decompressedItem, viewFormatProp, { expanded })
316-
const tooltipTitle = `${isValid ? l10n.t('Field') : TEXT_FAILED_CONVENT_FORMATTER(viewFormatProp)}`
317-
const tooltipContent = formatLongName(field)
315+
const { value } = formattingBuffer(decompressedItem, viewFormatProp, { expanded })
318316

319317
return (
320318
<div className="max-w-full whitespace-break-spaces">
321319
<div className="flex" data-testid={`hash-field-${field}`}>
322320
{!expanded && (
323-
<Tooltip
324-
title={tooltipTitle}
325-
content={tooltipContent}
326-
mouseEnterDelay={500}
327-
>
328-
<div className={cx('truncate')}>
329-
{isString(value) ? value?.substring?.(0, 200) ?? value : value}
330-
</div>
331-
</Tooltip>
321+
<div className={cx('truncate')}>
322+
{isString(value) ? value?.substring?.(0, 200) ?? value : value}
323+
</div>
332324
)}
333325
{expanded && value}
334326
</div>
@@ -358,9 +350,6 @@ const HashDetailsTable = (props: Props) => {
358350
// Better to cut the long string, because it could affect virtual scroll performance
359351
const { value: formattedValue, isValid } = formattingBuffer(decompressedValueItem!, viewFormatProp, { expanded })
360352

361-
const tooltipTitle = `${isValid ? l10n.t('Value') : TEXT_FAILED_CONVENT_FORMATTER(viewFormatProp)}`
362-
const tooltipContent = formatLongName(value)
363-
364353
const disabled = !isNonUnicodeFormatter(viewFormat, isValid)
365354
&& !isEqualBuffers(valueItem, stringToBuffer(value))
366355
const isEditable = isFormatEditable(viewFormat)
@@ -392,15 +381,9 @@ const HashDetailsTable = (props: Props) => {
392381
>
393382
<div>
394383
{!expanded && (
395-
<Tooltip
396-
title={tooltipTitle}
397-
position="bottom center"
398-
content={tooltipContent}
399-
>
400-
<div className="truncate">
401-
<span>{(formattedValue as any)?.substring?.(0, 200) ?? formattedValue}</span>
402-
</div>
403-
</Tooltip>
384+
<div className="truncate">
385+
<span>{(formattedValue as any)?.substring?.(0, 200) ?? formattedValue}</span>
386+
</div>
404387
)}
405388
{expanded && formattedValue}
406389
</div>

src/webviews/src/modules/key-details/components/list-details/list-details-table/ListDetailsTable.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { SCAN_COUNT_DEFAULT,
2222
} from 'uiSrc/constants'
2323
import {
2424
bufferToString,
25-
formatLongName,
2625
formattingBuffer,
2726
isFormatEditable,
2827
isNonUnicodeFormatter,
@@ -35,7 +34,6 @@ import {
3534
getColumnWidth,
3635
} from 'uiSrc/utils'
3736
import { VirtualTable } from 'uiSrc/components'
38-
import { Tooltip } from 'uiSrc/ui'
3937
// import { getColumnWidth } from 'uiSrc/components/virtual-grid'
4038
// import { decompressingBuffer } from 'uiSrc/utils/decompressors'
4139
import { useContextApi, useContextInContext, useDatabasesStore, useSelectedKeyStore } from 'uiSrc/store'
@@ -234,20 +232,13 @@ const ListDetailsTable = (props: Props) => {
234232
render: function Index(_name: string, { index }: ListElement) {
235233
// Better to cut the long string, because it could affect virtual scroll performance
236234
const cellContent = index?.toString().substring(0, 200)
237-
const tooltipContent = formatLongName(index?.toString())
238235
return (
239236
<div className="max-w-full whitespace-break-spaces">
240237
<div
241238
className="flex"
242239
data-testid={`list-index-value-${index}`}
243240
>
244-
<Tooltip
245-
content={tooltipContent}
246-
mouseEnterDelay={500}
247-
className={cx(styles.tooltip, 'truncate')}
248-
>
249-
{cellContent}
250-
</Tooltip>
241+
{cellContent}
251242
</div>
252243
</div>
253244
)
@@ -269,7 +260,6 @@ const ListDetailsTable = (props: Props) => {
269260
// const { value: decompressedElementItem } = decompressingBuffer(elementItem, compressor)
270261
const decompressedElementItem = elementItem
271262
const element = bufferToString(elementItem)
272-
const tooltipContent = formatLongName(element)
273263
const { value: formattedValue, isValid } = formattingBuffer(decompressedElementItem, viewFormatProp, { expanded })
274264

275265
const disabled = !isNonUnicodeFormatter(viewFormat, isValid)
@@ -306,11 +296,9 @@ const ListDetailsTable = (props: Props) => {
306296
data-testid={`list-element-value-${index}`}
307297
>
308298
{!expanded && (
309-
<Tooltip content={tooltipContent} mouseEnterDelay={500}>
310-
<div className={cx('truncate', styles.tooltip)}>
311-
{isString(formattedValue) ? formattedValue?.substring?.(0, 200) ?? formattedValue : formattedValue}
312-
</div>
313-
</Tooltip>
299+
<div className={cx('truncate', styles.tooltip)}>
300+
{isString(formattedValue) ? formattedValue?.substring?.(0, 200) ?? formattedValue : formattedValue}
301+
</div>
314302
)}
315303
{expanded && formattedValue}
316304
</div>

src/webviews/src/modules/key-details/components/set-details/set-details-table/SetDetailsTable.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
bufferToString,
1010
createDeleteFieldHeader,
1111
createDeleteFieldMessage,
12-
formatLongName,
1312
formattingBuffer,
1413
sendEventTelemetry,
1514
TelemetryEvent,
@@ -21,14 +20,12 @@ import {
2120
helpTexts,
2221
NoResultsFoundText,
2322
OVER_RENDER_BUFFER_COUNT,
24-
TEXT_FAILED_CONVENT_FORMATTER,
2523
SCAN_COUNT_DEFAULT,
2624
DEFAULT_SEARCH_MATCH,
2725
} from 'uiSrc/constants'
2826
import { PopoverDelete, VirtualTable } from 'uiSrc/components'
2927
import { IColumnSearchState, ITableColumn } from 'uiSrc/components/virtual-table/interfaces'
3028
import { useContextInContext, useDatabasesStore, useSelectedKeyStore } from 'uiSrc/store'
31-
import { Tooltip } from 'uiSrc/ui'
3229
import {
3330
deleteSetMembers,
3431
fetchSetMembers,
@@ -188,20 +185,16 @@ export const SetDetailsTable = (props: Props) => {
188185
const decompressedMemberItem = memberItem
189186
const member = bufferToString(memberItem || '')
190187
// Better to cut the long string, because it could affect virtual scroll performance
191-
const { value, isValid } = formattingBuffer(decompressedMemberItem, viewFormatProp, { expanded })
188+
const { value } = formattingBuffer(decompressedMemberItem, viewFormatProp, { expanded })
192189
const cellContent = (value as string)?.substring?.(0, 200) ?? value
193-
const tooltipContent = `${isValid ? l10n.t('Member') : TEXT_FAILED_CONVENT_FORMATTER(viewFormatProp)}\n${formatLongName(member)}`
194190

195191
return (
196192
<div className="max-w-full whitespace-break-spaces">
197193
<div className="flex" data-testid={`set-member-value-${member}`}>
198194
{!expanded && (
199-
<Tooltip content={tooltipContent} mouseEnterDelay={500}>
200-
<div className={cx('truncate', styles.tooltip)}>
201-
202-
{cellContent}
203-
</div>
204-
</Tooltip>
195+
<div className={cx('truncate', styles.tooltip)}>
196+
{cellContent}
197+
</div>
205198
)}
206199
{expanded && value}
207200
</div>

src/webviews/src/modules/key-details/components/zset-details/zset-details-table/ZSetDetailsTable.tsx

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
bufferToString,
1515
createDeleteFieldHeader,
1616
createDeleteFieldMessage,
17-
formatLongName,
1817
formattingBuffer,
1918
isEqualBuffers,
2019
validateScoreNumber,
@@ -29,7 +28,6 @@ import {
2928
KeyTypes,
3029
OVER_RENDER_BUFFER_COUNT,
3130
TableCellAlignment,
32-
TEXT_FAILED_CONVENT_FORMATTER,
3331
SCAN_COUNT_DEFAULT,
3432
helpTexts,
3533
NoResultsFoundText,
@@ -283,27 +281,16 @@ const ZSetDetailsTable = (props: Props) => {
283281
// const { value: decompressedNameItem } = decompressingBuffer(nameItem, compressor)
284282
const decompressedNameItem = nameItem
285283
const name = bufferToString(nameItem)
286-
const { value, isValid } = formattingBuffer(decompressedNameItem, viewFormat, { expanded })
284+
const { value } = formattingBuffer(decompressedNameItem, viewFormat, { expanded })
287285
const cellContent = (value as string)?.substring?.(0, 200) ?? value
288-
const tooltipTitle = `${isValid ? l10n.t('Member') : TEXT_FAILED_CONVENT_FORMATTER(viewFormatProp)}`
289-
const tooltipContent = formatLongName(name)
290286

291287
return (
292288
<div className="max-w-full whitespace-break-spaces">
293289
<div
294290
className="flex"
295291
data-testid={`zset-member-value-${name}`}
296292
>
297-
{!expanded && (
298-
<Tooltip
299-
title={tooltipTitle}
300-
content={tooltipContent}
301-
mouseEnterDelay={500}
302-
className={cx(styles.tooltip, 'truncate')}
303-
>
304-
{cellContent}
305-
</Tooltip>
306-
)}
293+
{!expanded && cellContent}
307294
{expanded && value}
308295
</div>
309296
</div>
@@ -323,7 +310,6 @@ const ZSetDetailsTable = (props: Props) => {
323310
rowIndex = 0,
324311
) {
325312
const cellContent = score.toString().substring(0, 200)
326-
const tooltipContent = formatLongName(score.toString())
327313
const editToolTipContent = !isNumber(score) ? l10n.t('Use CLI to edit the score') : null
328314

329315
return (
@@ -346,15 +332,9 @@ const ZSetDetailsTable = (props: Props) => {
346332
data-testid={`zset-score-value-${score}`}
347333
>
348334
{!expanded && (
349-
<Tooltip
350-
title={l10n.t('Score')}
351-
content={tooltipContent}
352-
mouseEnterDelay={500}
353-
>
354-
<div className={cx(styles.tooltip, 'truncate')}>
355-
{cellContent}
356-
</div>
357-
</Tooltip>
335+
<div className={cx(styles.tooltip, 'truncate')}>
336+
{cellContent}
337+
</div>
358338
)}
359339
{expanded && score}
360340
</div>

src/webviews/src/ui/json-viewer/components/json-pretty/JsonPretty.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import { isArray, isObject } from 'uiSrc/ui/json-viewer/utils'
77
import { IDefaultProps } from 'uiSrc/ui/json-viewer/interfaces'
88

99
const JsonPretty = ({ data, ...props }: IDefaultProps) => {
10+
if (data?._isBigNumber) {
11+
return <JsonPrimitive data={data} {...props} />
12+
}
13+
1014
if (isArray(data)) {
1115
return <JsonArray data={data} {...props} />
1216
}

src/webviews/src/utils/formatters/valueFormatters.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const formattingBuffer = (
110110
try {
111111
const vector = Array.from(bufferToFloat32Array(reply.data as Uint8Array))
112112
const value = JSONBigInt.stringify(vector)
113+
113114
return JSONViewer({ value, useNativeBigInt: false, ...props })
114115
} catch (e) {
115116
return { value: bufferToUTF8(reply), isValid: false }

0 commit comments

Comments
 (0)