Skip to content

Commit 918292d

Browse files
author
Artem
committed
resolve PR comments
1 parent 13b05c9 commit 918292d

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

redisinsight/ui/src/components/cli/components/cli-input/CliInputWrapper.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useSelector } from 'react-redux'
44
import { getCommandRepeat } from 'uiSrc/utils'
55
import { appRedisCommandsSelector } from 'uiSrc/slices/app/redis-commands'
66
import { outputSelector } from 'uiSrc/slices/cli/cli-output'
7+
import { CommandProvider } from 'uiSrc/constants'
78
import CliAutocomplete from './CliAutocomplete'
89

910
import CliInput from './CliInput'
@@ -27,7 +28,7 @@ const CliInputWrapper = (props: Props) => {
2728
const secondCommandMatch = `${firstCommandMatch} ${secondCommand ? secondCommand.toUpperCase() : null}`
2829

2930
const matchedCmd = ALL_REDIS_COMMANDS[secondCommandMatch] || ALL_REDIS_COMMANDS[firstCommandMatch]
30-
const provider = matchedCmd?.provider || 'unknown'
31+
const provider = matchedCmd?.provider || CommandProvider.Unknown
3132
const commandName = !isUndefined(ALL_REDIS_COMMANDS[secondCommandMatch])
3233
? `${firstCommand} ${secondCommand}`
3334
: firstCommand

redisinsight/ui/src/constants/commands.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ export interface ICommand {
1212
provider?: string;
1313
}
1414

15+
export enum CommandProvider {
16+
Main = 'main',
17+
Unknown = 'unknown',
18+
}
19+
1520
export interface ICommandArg {
1621
name?: string[] | string;
1722
type?: CommandArgsType[] | CommandArgsType | string | string[];

redisinsight/ui/src/utils/commands.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { flatten, isArray, isEmpty, isNumber, reject, toNumber, isNaN, isInteger } from 'lodash'
22
import {
33
CommandArgsType,
4+
CommandProvider,
45
ICommandArg,
56
ICommandArgGenerated
67
} from 'uiSrc/constants'
@@ -135,7 +136,7 @@ const generateArgName = (
135136
): string | string[] => {
136137
try {
137138
// todo: temporary workaround until all commands providers will be unified
138-
if (['main'].includes(provider)) {
139+
if ([CommandProvider.Main].includes(<CommandProvider.Main>provider)) {
139140
return (new Argument(arg)).syntax({
140141
onlyMandatory,
141142
pureName,

0 commit comments

Comments
 (0)