Skip to content

Commit bfd2393

Browse files
authored
Merge pull request #2756 from RedisInsight/fe/feature/RI-5122_string_key_truncate
#RI-5122 - string value truncate
2 parents c990bce + 09369f3 commit bfd2393

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

redisinsight/ui/src/pages/browser/components/string-details/StringDetails.spec.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,34 @@ describe('StringDetails', () => {
190190
})
191191
})
192192

193+
it('Should add "..." in the end of the part value', async () => {
194+
const stringDataSelectorMock = jest.fn().mockReturnValue({
195+
value: partValue
196+
})
197+
stringDataSelector.mockImplementation(stringDataSelectorMock)
198+
199+
render(
200+
<StringDetails
201+
{...instance(mockedProps)}
202+
/>
203+
)
204+
expect(screen.getByTestId(STRING_VALUE)).toHaveTextContent(`${bufferToString(partValue)}...`)
205+
})
206+
207+
it('Should not add "..." in the end of the full value', async () => {
208+
const stringDataSelectorMock = jest.fn().mockReturnValue({
209+
value: fullValue
210+
})
211+
stringDataSelector.mockImplementation(stringDataSelectorMock)
212+
213+
render(
214+
<StringDetails
215+
{...instance(mockedProps)}
216+
/>
217+
)
218+
expect(screen.getByTestId(STRING_VALUE)).toHaveTextContent(bufferToString(fullValue))
219+
})
220+
193221
it('should call fetchDownloadStringValue and sendEventTelemetry after clicking on load button and download button', async () => {
194222
const stringDataSelectorMock = jest.fn().mockReturnValue({
195223
value: partValue

redisinsight/ui/src/pages/browser/components/string-details/StringDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const StringDetails = (props: Props) => {
9999
const { value: formattedValue, isValid } = formattingBuffer(decompressedValue, viewFormatProp, { expanded: true })
100100
setAreaValue(initialValueString)
101101

102-
setValue(formattedValue)
102+
setValue(!isFullStringLoaded(initialValue?.data?.length, length) ? `${formattedValue}...` : formattedValue)
103103
setIsValid(isValid)
104104
setIsDisabled(
105105
!isNonUnicodeFormatter(viewFormatProp, isValid)

0 commit comments

Comments
 (0)