Skip to content

Commit 4e7f478

Browse files
author
Artem
committed
#RI-4357 + #RI-4358 fixes
1 parent 0a161b1 commit 4e7f478

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

redisinsight/ui/src/utils/commands.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ enum ArgumentType {
1515
BLOCK = 'block',
1616
PURE_TOKEN = 'pure-token',
1717
COMMAND = 'command',
18+
ENUM = 'enum', // temporary for backward compatibility
1819
}
1920

2021
export class Argument {
@@ -36,6 +37,8 @@ export class Argument {
3637

3738
protected arguments: Argument[]
3839

40+
protected enum: string[]
41+
3942
constructor(data: Record<string, any>) {
4043
this.stack = []
4144
this.name = data?.name
@@ -44,12 +47,13 @@ export class Argument {
4447
this.multiple = !!data?.multiple
4548
this.multipleToken = !!data?.multiple_token
4649
this.token = data?.token
47-
this.display = data?.display_text || this.name
50+
this.display = data?.display_text || data?.command || this.name
51+
this.enum = data?.enum
4852
// todo: why we need this?
4953
if (this.token === '') {
5054
this.token = '""'
5155
}
52-
this.arguments = ((data?.arguments || []) as Record<string, any>[])
56+
this.arguments = ((data?.arguments || data?.block || []) as Record<string, any>[])
5357
.map((childArg) => new Argument(childArg))
5458
}
5559

@@ -71,6 +75,9 @@ export class Argument {
7175
case ArgumentType.ONEOF:
7276
args += this.arguments.map((arg) => arg.syntax()).join(' | ')
7377
break
78+
case ArgumentType.ENUM:
79+
args += this.enum?.join(' | ')
80+
break
7481
case ArgumentType.PURE_TOKEN:
7582
break
7683
default:

0 commit comments

Comments
 (0)