Skip to content

Commit bf4c2b8

Browse files
authored
Merge pull request #1885 from RedisInsight/main
merge main into release/2.22.0
2 parents 40decd4 + 8a109e9 commit bf4c2b8

File tree

28 files changed

+559
-339
lines changed

28 files changed

+559
-339
lines changed
Lines changed: 10 additions & 0 deletions
Loading
Lines changed: 37 additions & 0 deletions
Loading
Lines changed: 37 additions & 0 deletions
Loading

redisinsight/ui/src/components/query-card/QueryCard.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,15 @@ const QueryCard = (props: Props) => {
153153
setSelectedViewValue(value)
154154
}
155155

156-
const commonError = CommonErrorResponse(command, result)
156+
const commonError = CommonErrorResponse(id, command, result)
157157

158158
return (
159-
<div className={cx(styles.containerWrapper, {
160-
fullscreen: isFullScreen,
161-
[styles.isOpen]: isOpen
162-
})}
159+
<div
160+
className={cx(styles.containerWrapper, {
161+
fullscreen: isFullScreen,
162+
[styles.isOpen]: isOpen
163+
})}
164+
id={id}
163165
>
164166
<div
165167
className={cx(styles.container)}

redisinsight/ui/src/components/query-card/QueryCardCliGroupResult/QueryCardCliGroupResult.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const QueryCardCliGroupResult = (props: Props) => {
2020
<QueryCardCliDefaultResult
2121
isFullScreen={isFullScreen}
2222
items={flatten(result?.[0]?.response.map((item: any) => {
23-
const commonError = CommonErrorResponse(item.command, item.response)
23+
const commonError = CommonErrorResponse(item.id, item.command, item.response)
2424
if (React.isValidElement(commonError)) {
2525
return ([wbSummaryCommand(item.command), commonError])
2626
}

redisinsight/ui/src/components/query-card/QueryCardCommonResult/components/CommonErrorResponse/CommonErrorResponse.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ import {
1212
import { cliTexts, SelectCommand } from 'uiSrc/constants/cliOutput'
1313
import { CommandMonitor, CommandPSubscribe, Pages } from 'uiSrc/constants'
1414
import { CommandExecutionStatus } from 'uiSrc/slices/interfaces/cli'
15-
import { RedisDefaultModules } from 'uiSrc/slices/interfaces'
16-
import { RSNotLoadedContent } from 'uiSrc/pages/workbench/constants'
1715

1816
import { cliSettingsSelector } from 'uiSrc/slices/cli/cli-settings'
1917
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
2018
import ModuleNotLoaded from 'uiSrc/pages/workbench/components/module-not-loaded'
2119
import { showMonitor } from 'uiSrc/slices/cli/monitor'
2220

23-
const CommonErrorResponse = (command = '', result?: any) => {
21+
const CommonErrorResponse = (id: string, command = '', result?: any) => {
2422
const { instanceId = '' } = useParams<{ instanceId: string }>()
2523
const { unsupportedCommands: cliUnsupportedCommands, blockingCommands } = useSelector(cliSettingsSelector)
2624
const { modules } = useSelector(connectedInstanceSelector)
@@ -69,8 +67,8 @@ const CommonErrorResponse = (command = '', result?: any) => {
6967
}
7068
const unsupportedModule = checkUnsupportedModuleCommand(modules, commandLine)
7169

72-
if (unsupportedModule === RedisDefaultModules.Search) {
73-
return <ModuleNotLoaded content={RSNotLoadedContent} />
70+
if (unsupportedModule) {
71+
return <ModuleNotLoaded moduleName={unsupportedModule} id={id} />
7472
}
7573

7674
return null
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,65 @@
1+
import { RedisDefaultModules } from 'uiSrc/slices/interfaces'
2+
13
export const bulkReplyCommands = ['LOLWUT', 'INFO', 'CLIENT', 'CLUSTER', 'MEMORY', 'MONITOR', 'PSUBSCRIBE']
24

35
export const EMPTY_COMMAND = 'Encrypted data'
6+
7+
export const MODULE_NOT_LOADED_CONTENT: { [key in RedisDefaultModules]?: any } = {
8+
[RedisDefaultModules.TimeSeries]: {
9+
text: ['RedisTimeSeries adds a Time Series data structure to Redis. ', 'With this capability you can:'],
10+
improvements: [
11+
'Add sample data',
12+
'Perform cross-time-series range and aggregation queries',
13+
'Define compaction rules for economical retention of historical data'
14+
],
15+
link: 'https://redis.io/docs/stack/timeseries/'
16+
},
17+
[RedisDefaultModules.Search]: {
18+
text: ['RediSearch adds the capability to:'],
19+
improvements: [
20+
'Query',
21+
'Secondary index',
22+
'Full-text search'
23+
],
24+
additionalText: ['These features enable multi-field queries, aggregation, exact phrase matching, numeric filtering, ', 'geo filtering and vector similarity semantic search on top of text queries.'],
25+
link: 'https://redis.io/docs/stack/search/'
26+
},
27+
[RedisDefaultModules.Graph]: {
28+
text: ['RedisGraph adds a Property Graph data structure to Redis. ', 'With this capability you can:'],
29+
improvements: [
30+
'Create graphs',
31+
'Query property graphs using the Cypher query language with proprietary extensions'
32+
],
33+
link: 'https://redis.io/docs/stack/graph/'
34+
},
35+
[RedisDefaultModules.ReJSON]: {
36+
text: ['RedisJSON adds the capability to:'],
37+
improvements: [
38+
'Store JSON documents',
39+
'Update JSON documents',
40+
'Retrieve JSON documents'
41+
],
42+
additionalText: ['RedisJSON also works seamlessly with RediSearch to let you index and query JSON documents.'],
43+
link: 'https://redis.io/docs/stack/json/'
44+
},
45+
[RedisDefaultModules.Bloom]: {
46+
text: ['RedisBloom adds a set of probabilistic data structures to Redis, including:'],
47+
improvements: [
48+
'Bloom filter',
49+
'Cuckoo filter',
50+
'Count-min sketch',
51+
'Top-K',
52+
'T-digest'
53+
],
54+
additionalText: ['With this capability you can query streaming data without needing to store all the elements of the stream.'],
55+
link: 'https://redis.io/docs/stack/bloom/'
56+
}
57+
}
58+
59+
export const MODULE_TEXT_VIEW: { [key in RedisDefaultModules]?: string } = {
60+
[RedisDefaultModules.Bloom]: 'RedisBloom',
61+
[RedisDefaultModules.Graph]: 'RedisGraph',
62+
[RedisDefaultModules.ReJSON]: 'RedisJSON',
63+
[RedisDefaultModules.Search]: 'RediSearch',
64+
[RedisDefaultModules.TimeSeries]: 'RedisTimeSeries',
65+
}

redisinsight/ui/src/pages/workbench/components/enablement-area/EnablementArea/styles.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
backface-visibility: hidden;
3737
transition: transform 0.4s ease-in-out;
3838
box-shadow: -5px 1px 10px rgba(0, 0, 0, 0.2);
39+
z-index: 2;
3940

4041
:global {
4142
.euiButton--small {
Lines changed: 5 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,12 @@
1-
import { cloneDeep } from 'lodash'
21
import React from 'react'
3-
import { cleanup, mockedStore, render } from 'uiSrc/utils/test-utils'
4-
import { ThemeContext, defaultState } from 'uiSrc/contexts/themeContext'
5-
import ModuleNotLoaded from './ModuleNotLoaded'
6-
import { RSNotLoadedContent } from '../../constants'
2+
import { instance, mock } from 'ts-mockito'
3+
import { render } from 'uiSrc/utils/test-utils'
4+
import ModuleNotLoaded, { IProps } from './ModuleNotLoaded'
75

8-
let store: typeof mockedStore
9-
10-
beforeEach(() => {
11-
cleanup()
12-
store = cloneDeep(mockedStore)
13-
store.clearActions()
14-
})
15-
16-
jest.mock('uiSrc/services', () => ({
17-
...jest.requireActual('uiSrc/services'),
18-
sessionStorageService: {
19-
set: jest.fn(),
20-
get: jest.fn(),
21-
},
22-
}))
23-
24-
jest.mock('uiSrc/slices/content/create-redis-buttons', () => ({
25-
...jest.requireActual('uiSrc/slices/content/create-redis-buttons'),
26-
contentSelector: jest.fn().mockReturnValue({
27-
loading: false,
28-
data: {
29-
cloud: { title: 'Limited offer', description: 'Try Redis cloud' }
30-
}
31-
}),
32-
}))
6+
const mockedProps = mock<IProps>()
337

348
describe('ModuleNotLoaded', () => {
359
it('should render', () => {
36-
expect(render(<ModuleNotLoaded content={RSNotLoadedContent} />)).toBeTruthy()
37-
})
38-
39-
it('"output" prop should render', () => {
40-
const { queryByTestId } = render(<ModuleNotLoaded content={RSNotLoadedContent} />)
41-
42-
const outputEl = queryByTestId('query-card-no-module-output')
43-
expect(outputEl).toBeInTheDocument()
44-
})
45-
it('"table" prop should render', () => {
46-
const { container } = render(<ModuleNotLoaded content={RSNotLoadedContent} />)
47-
48-
const tableEl = container.querySelector('[data-test-subj="query-card-no-module-table"]')
49-
expect(tableEl).toBeInTheDocument()
50-
})
51-
it('"createCloudBtn" prop should render', () => {
52-
const { queryByTestId } = render(
53-
<ThemeContext.Provider value={{ ...defaultState }}>
54-
<ModuleNotLoaded content={RSNotLoadedContent} />
55-
</ThemeContext.Provider>
56-
)
57-
const btnEl = queryByTestId('query-card-no-module-button')
58-
expect(btnEl).toBeInTheDocument()
59-
})
60-
it('"summaryText" prop should render', () => {
61-
const { queryByTestId } = render(<ModuleNotLoaded content={RSNotLoadedContent} />)
62-
63-
const summaryTextEl = queryByTestId('query-card-no-module-summary-text')
64-
expect(summaryTextEl).toBeInTheDocument()
65-
})
66-
it('"summaryImgPath" prop should render', () => {
67-
const { queryByTestId } = render(<ModuleNotLoaded content={RSNotLoadedContent} />)
68-
69-
const summaryImgEl = queryByTestId('query-card-no-module-summary-img')
70-
expect(summaryImgEl).toBeInTheDocument()
10+
expect(render(<ModuleNotLoaded {...instance(mockedProps)} />)).toBeTruthy()
7111
})
7212
})

0 commit comments

Comments
 (0)