File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
redisinsight/ui/src/utils Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -16,19 +16,22 @@ const REDISTACK_OPTIONAL_MODULES: Array<string | Array<string>> = [
16
16
[ RedisDefaultModules . RedisGears , RedisDefaultModules . RedisGears2 ]
17
17
]
18
18
19
+ const MIN_MODULES_LENGTH = REDISTACK_REQUIRE_MODULES . length
20
+ const MAX_MODULES_LENGTH = REDISTACK_REQUIRE_MODULES . length + REDISTACK_OPTIONAL_MODULES . length
21
+
19
22
const checkRediStackModules = ( modules : any [ ] ) => {
20
23
if ( ! modules ?. length ) return false
21
24
const moduleNames = map ( modules , 'name' ) . sort ( )
22
25
23
- if ( modules . length === REDISTACK_REQUIRE_MODULES . length ) {
26
+ if ( modules . length === MIN_MODULES_LENGTH ) {
24
27
return moduleNames
25
28
. every ( ( m , index ) => ( isArray ( REDISTACK_REQUIRE_MODULES [ index ] )
26
29
? ( REDISTACK_REQUIRE_MODULES [ index ] as Array < string > ) . some ( ( rm ) => rm === m )
27
30
: REDISTACK_REQUIRE_MODULES [ index ] === m ) )
28
31
}
29
32
30
- if ( modules . length > REDISTACK_REQUIRE_MODULES . length
31
- && modules . length <= ( REDISTACK_REQUIRE_MODULES . length + REDISTACK_OPTIONAL_MODULES . length ) ) {
33
+ if ( modules . length > MIN_MODULES_LENGTH
34
+ && modules . length <= ( MAX_MODULES_LENGTH ) ) {
32
35
let isCustomModule = false
33
36
const rediStackModules = concat ( REDISTACK_REQUIRE_MODULES , REDISTACK_OPTIONAL_MODULES ) . sort ( )
34
37
@@ -39,9 +42,11 @@ const checkRediStackModules = (modules: any[]) => {
39
42
40
43
if ( moduleName ) {
41
44
remove ( acc , ( name ) => moduleName === name )
45
+
42
46
return acc
43
47
}
44
48
isCustomModule = true
49
+
45
50
return acc
46
51
} , moduleNames )
47
52
You can’t perform that action at this time.
0 commit comments