Skip to content

Commit 3984feb

Browse files
#RI-4541 - add subscribe error message
1 parent 48ec077 commit 3984feb

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

redisinsight/ui/src/components/cli/components/cli-body/CliBodyWrapper.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
processUnsupportedCommand,
2020
processUnrepeatableNumber,
2121
} from 'uiSrc/slices/cli/cli-output'
22-
import { CommandMonitor, CommandPSubscribe, Pages } from 'uiSrc/constants'
22+
import { CommandMonitor, CommandPSubscribe, CommandSubscribe, Pages } from 'uiSrc/constants'
2323
import { getCommandRepeat, isRepeatCountCorrect } from 'uiSrc/utils'
2424
import { ConnectionType } from 'uiSrc/slices/interfaces'
2525
import { ClusterNodeRole } from 'uiSrc/slices/interfaces/cli'
@@ -107,6 +107,13 @@ const CliBodyWrapper = () => {
107107
return
108108
}
109109

110+
// Flow if SUBSCRIBE command was executed
111+
if (checkUnsupportedCommand([CommandSubscribe.toLowerCase()], commandLine)) {
112+
dispatch(concatToOutput(cliTexts.SUBSCRIBE_COMMAND_CLI(Pages.pubSub(instanceId))))
113+
resetCommand()
114+
return
115+
}
116+
110117
if (unsupportedCommand) {
111118
dispatch(processUnsupportedCommand(commandLine, unsupportedCommand, resetCommand))
112119
return

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
isRepeatCountCorrect
1111
} from 'uiSrc/utils'
1212
import { cliTexts, SelectCommand } from 'uiSrc/constants/cliOutput'
13-
import { CommandMonitor, CommandPSubscribe, Pages } from 'uiSrc/constants'
13+
import { CommandMonitor, CommandPSubscribe, CommandSubscribe, Pages } from 'uiSrc/constants'
1414
import { CommandExecutionStatus } from 'uiSrc/slices/interfaces/cli'
1515

1616
import { cliSettingsSelector } from 'uiSrc/slices/cli/cli-settings'
@@ -30,6 +30,10 @@ const CommonErrorResponse = (id: string, command = '', result?: any) => {
3030
if (checkUnsupportedCommand([CommandMonitor.toLowerCase()], commandLine)) {
3131
return cliTexts.MONITOR_COMMAND(() => { dispatch(showMonitor()) })
3232
}
33+
// Flow if SUBSCRIBE command was executed
34+
if (checkUnsupportedCommand([CommandSubscribe.toLowerCase()], commandLine)) {
35+
return cliTexts.SUBSCRIBE_COMMAND(Pages.pubSub(instanceId))
36+
}
3337
// Flow if PSUBSCRIBE command was executed
3438
if (checkUnsupportedCommand([CommandPSubscribe.toLowerCase()], commandLine)) {
3539
return cliTexts.PSUBSCRIBE_COMMAND(Pages.pubSub(instanceId))

redisinsight/ui/src/constants/cliOutput.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,27 @@ export const cliTexts = {
7070
{' to see the messages published to all channels in your database.'}
7171
</EuiTextColor>
7272
),
73+
SUBSCRIBE_COMMAND: (path: string = '') => (
74+
<EuiTextColor color="danger" key={Date.now()}>
75+
{'Use '}
76+
<EuiLink {...getRouterLinkProps(path)} color="text" data-test-subj="pubsub-page-btn">
77+
Pub/Sub
78+
</EuiLink>
79+
{' tool to subscribe to channels.'}
80+
</EuiTextColor>
81+
),
7382
PSUBSCRIBE_COMMAND_CLI: (path: string = '') => (
7483
[
7584
cliTexts.PSUBSCRIBE_COMMAND(path),
7685
'\n',
7786
]
7887
),
88+
SUBSCRIBE_COMMAND_CLI: (path: string = '') => (
89+
[
90+
cliTexts.SUBSCRIBE_COMMAND(path),
91+
'\n',
92+
]
93+
),
7994
MONITOR_COMMAND: (onClick: () => void) => (
8095
<EuiTextColor color="danger" key={Date.now()}>
8196
{'Use '}

redisinsight/ui/src/constants/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export enum CommandPrefix {
8989

9090
export const CommandMonitor = 'MONITOR'
9191
export const CommandPSubscribe = 'PSUBSCRIBE'
92+
export const CommandSubscribe = 'SUBSCRIBE'
9293

9394
export enum CommandRediSearch {
9495
Search = 'FT.SEARCH',

0 commit comments

Comments
 (0)