Skip to content

Commit f2862af

Browse files
committed
#RI-3033 - Display all published messages
1 parent 9b7bfe6 commit f2862af

File tree

32 files changed

+476
-44
lines changed

32 files changed

+476
-44
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ import {
1818
processUnsupportedCommand,
1919
processUnrepeatableNumber,
2020
processMonitorCommand,
21+
processPSubscribeCommand,
2122
} from 'uiSrc/slices/cli/cli-output'
22-
import { CommandMonitor } from 'uiSrc/constants'
23+
import { CommandMonitor, CommandPSubscribe } from 'uiSrc/constants'
2324
import { getCommandRepeat, isRepeatCountCorrect } from 'uiSrc/utils'
2425
import { ConnectionType } from 'uiSrc/slices/interfaces'
2526
import { ClusterNodeRole } from 'uiSrc/slices/interfaces/cli'
@@ -78,12 +79,20 @@ const CliBodyWrapper = () => {
7879
return
7980
}
8081

81-
// Flow if monitor command was executed
82+
// Flow if MONITOR command was executed
8283
if (checkUnsupportedCommand([CommandMonitor.toLowerCase()], commandLine)) {
8384
dispatch(processMonitorCommand(commandLine, resetCommand))
8485
return
8586
}
8687

88+
// Flow if PSUBSCRIBE command was executed
89+
if (checkUnsupportedCommand([CommandPSubscribe.toLowerCase()], commandLine)) {
90+
dispatch(processPSubscribeCommand(commandLine, () => {
91+
resetCommand()
92+
}))
93+
return
94+
}
95+
8796
if (unsupportedCommand) {
8897
dispatch(processUnsupportedCommand(commandLine, unsupportedCommand, resetCommand))
8998
return

redisinsight/ui/src/components/database-overview/DatabaseOverviewWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ThemeContext } from 'uiSrc/contexts/themeContext'
1010

1111
import { getOverviewMetrics } from './components/OverviewMetrics'
1212

13-
const TIMEOUT_TO_GET_INFO = process.env.NODE_ENV !== 'development' ? 5000 : 100000
13+
const TIMEOUT_TO_GET_INFO = process.env.NODE_ENV !== 'development' ? 5000 : 10000000
1414

1515
interface IProps { windowDimensions: number }
1616

redisinsight/ui/src/components/monitor/MonitorOutputList/MonitorOutputList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { EuiTextColor } from '@elastic/eui'
44
import { CellMeasurer, List, CellMeasurerCache, ListRowProps } from 'react-virtualized'
55

66
import { getFormatTime } from 'uiSrc/utils'
7-
import { DEFAULT_TEXT } from 'uiSrc/components/notifications'
7+
import { DEFAULT_ERROR_TEXT } from 'uiSrc/components/notifications'
88

99
import styles from 'uiSrc/components/monitor/Monitor/styles.module.scss'
1010
import 'react-virtualized/styles.css'
@@ -80,7 +80,7 @@ const MonitorOutputList = (props: Props) => {
8080
</>
8181
)}
8282
{isError && (
83-
<EuiTextColor color="danger">{message ?? DEFAULT_TEXT}</EuiTextColor>
83+
<EuiTextColor color="danger">{message ?? DEFAULT_ERROR_TEXT}</EuiTextColor>
8484
)}
8585
</div>
8686
)}

redisinsight/ui/src/components/notifications/Notifications.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import errorMessages from './error-messages'
2222

2323
import styles from './styles.module.scss'
2424

25-
export const DEFAULT_TEXT = 'Something went wrong.'
25+
export const DEFAULT_ERROR_TEXT = 'Something went wrong.'
2626

2727
const Notifications = () => {
2828
const messagesData = useSelector(messagesSelector)
@@ -82,7 +82,7 @@ const Notifications = () => {
8282
})
8383

8484
const getErrorsToasts = (errors: IError[]) =>
85-
errors.map(({ id = '', message = DEFAULT_TEXT, instanceId = '', name }) => {
85+
errors.map(({ id = '', message = DEFAULT_ERROR_TEXT, instanceId = '', name }) => {
8686
if (ApiEncryptionErrors.includes(name)) {
8787
return errorMessages.ENCRYPTION(id, () => removeToast({ id }), instanceId)
8888
}

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import React from 'react'
22
import { useSelector } from 'react-redux'
3+
import { useParams } from 'react-router-dom'
34
import {
45
checkUnsupportedCommand,
56
checkUnsupportedModuleCommand,
67
cliParseTextResponse,
8+
CliPrefix,
79
getCommandRepeat,
810
isRepeatCountCorrect
911
} from 'uiSrc/utils'
1012
import { cliTexts, SelectCommand } from 'uiSrc/constants/cliOutput'
11-
import { CommandMonitor } from 'uiSrc/constants'
13+
import { CommandMonitor, CommandPSubscribe, Pages } from 'uiSrc/constants'
1214
import { CommandExecutionStatus } from 'uiSrc/slices/interfaces/cli'
1315
import { RedisDefaultModules } from 'uiSrc/slices/interfaces'
1416
import { RSNotLoadedContent } from 'uiSrc/pages/workbench/constants'
@@ -18,17 +20,29 @@ import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
1820
import ModuleNotLoaded from 'uiSrc/pages/workbench/components/module-not-loaded'
1921

2022
const CommonErrorResponse = (command = '', result?: any) => {
23+
const { instanceId = '' } = useParams<{ instanceId: string }>()
2124
const { unsupportedCommands: cliUnsupportedCommands, blockingCommands } = useSelector(cliSettingsSelector)
2225
const { modules } = useSelector(connectedInstanceSelector)
2326
const unsupportedCommands = [SelectCommand.toLowerCase(), ...cliUnsupportedCommands, ...blockingCommands]
2427
const [commandLine, countRepeat] = getCommandRepeat(command)
2528

26-
// Flow if monitor command was executed
29+
// Flow if MONITOR command was executed
2730
if (checkUnsupportedCommand([CommandMonitor.toLowerCase()], commandLine)) {
2831
return cliParseTextResponse(
2932
cliTexts.MONITOR_COMMAND,
3033
commandLine,
3134
CommandExecutionStatus.Fail,
35+
CliPrefix.QueryCard,
36+
)
37+
}
38+
// Flow if PSUBSCRIBE command was executed
39+
if (checkUnsupportedCommand([CommandPSubscribe.toLowerCase()], commandLine)) {
40+
return cliParseTextResponse(
41+
cliTexts.PSUBSCRIBE_COMMAND(Pages.pubSub(instanceId)),
42+
commandLine,
43+
CommandExecutionStatus.Fail,
44+
CliPrefix.QueryCard,
45+
true,
3246
)
3347
}
3448

@@ -39,6 +53,7 @@ const CommonErrorResponse = (command = '', result?: any) => {
3953
cliTexts.UNABLE_TO_DECRYPT,
4054
'',
4155
CommandExecutionStatus.Fail,
56+
CliPrefix.QueryCard,
4257
)
4358
}
4459

@@ -47,6 +62,7 @@ const CommonErrorResponse = (command = '', result?: any) => {
4762
cliTexts.REPEAT_COUNT_INVALID,
4863
commandLine,
4964
CommandExecutionStatus.Fail,
65+
CliPrefix.QueryCard,
5066
)
5167
}
5268

redisinsight/ui/src/constants/cliOutput.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export const cliTexts = {
3737
REPEAT_COUNT_INVALID: 'Invalid repeat command option value',
3838
CONNECTION_CLOSED: 'Client connection previously closed. Run the command after the connection is re-created.',
3939
MONITOR_COMMAND: 'Use the "Profiler" tool to see all the requests processed by the server.',
40+
PSUBSCRIBE_COMMAND: (href: string = '') =>
41+
'Use Pub/Sub to see the messages published to all channels in your database.',
4042
UNABLE_TO_DECRYPT: 'Unable to decrypt. Check the system keychain or re-run the command.',
4143
CLI_ERROR_MESSAGE: (message: string) => (
4244
[

redisinsight/ui/src/constants/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export enum CommandPrefix {
8282
}
8383

8484
export const CommandMonitor = 'MONITOR'
85+
export const CommandPSubscribe = 'PSUBSCRIBE'
8586

8687
export enum CommandRediSearch {
8788
Search = 'FT.SEARCH',
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const bulkReplyCommands = ['LOLWUT', 'INFO', 'CLIENT', 'CLUSTER', 'MEMORY', 'MONITOR']
1+
export const bulkReplyCommands = ['LOLWUT', 'INFO', 'CLIENT', 'CLUSTER', 'MEMORY', 'MONITOR', 'PSUBSCRIBE']

redisinsight/ui/src/pages/pubSub/PubSubPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react'
33
import InstanceHeader from 'uiSrc/components/instance-header'
44
import { SubscriptionType } from 'uiSrc/constants/pubSub'
55

6-
import { MessagesList, SubscriptionPanel } from './components'
6+
import { MessagesListWrapper, SubscriptionPanel } from './components'
77

88
import styles from './styles.module.scss'
99

@@ -23,7 +23,7 @@ const PubSubPage = () => {
2323
<SubscriptionPanel />
2424
</div>
2525
<div className={styles.tableWrapper}>
26-
<MessagesList />
26+
<MessagesListWrapper />
2727
</div>
2828
</div>
2929
<div className={styles.footerPanel}>

redisinsight/ui/src/pages/pubSub/components/MessagesList/MessagesListWrapper.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)