Skip to content

Commit 0d54fa4

Browse files
Merge pull request #3508 from RedisInsight/fe/bugfix/RI-5851_5849_recommendation_parse_update_link
#RI-5851, 5849 - fix recommendation parsing, update the link
2 parents b44a257 + 0e1a398 commit 0d54fa4

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

redisinsight/ui/src/components/recommendation/content-element/ContentElement.spec.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ describe('ContentElement', () => {
115115
expect(screen.getByText('unknown')).toBeInTheDocument()
116116
})
117117

118+
it('should not failed when value is not the string', () => {
119+
const mockContent = {
120+
type: 'unknown',
121+
value: { custom: 'value' },
122+
}
123+
render(<ContentElement content={mockContent} telemetryName={mockTelemetryName} idx={0} />)
124+
125+
expect(screen.getByText('*Unknown format*')).toBeInTheDocument()
126+
})
127+
118128
it('click on link should call onClick', () => {
119129
const onClickMock = jest.fn()
120130
const mockContent = {

redisinsight/ui/src/components/recommendation/content-element/ContentElement.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import { isArray } from 'lodash'
2+
import { isArray, isString } from 'lodash'
33
import { EuiTextColor, EuiLink, EuiSpacer } from '@elastic/eui'
44
import { SpacerSize } from '@elastic/eui/src/components/spacer/spacer'
55
import cx from 'classnames'
@@ -166,7 +166,7 @@ const ContentElement = (props: Props) => {
166166
/>
167167
)
168168
default:
169-
return value
169+
return isString(value) ? <>{value}</> : <b>*Unknown format*</b>
170170
}
171171
}
172172

redisinsight/ui/src/pages/rdi/home/empty-message/EmptyMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const EmptyMessage = ({ onAddInstanceClick }: Props) => {
4141
EXTERNAL_LINKS.rdiQuickStart,
4242
{
4343
medium: UTM_MEDIUMS.Rdi,
44-
campaign: 'rdi_list '
44+
campaign: 'rdi_list'
4545
}
4646
)}
4747
>

0 commit comments

Comments
 (0)