Skip to content

Commit 9361692

Browse files
authored
Merge pull request #1739 from RedisInsight/fe/bugfix-RI-4101
[RI-4101] Allow RediSearch plugin to visualize SEARCH/AGGREGATE Profile Data
2 parents 3d3d102 + 0104b41 commit 9361692

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

redisinsight/ui/src/packages/redisearch/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"matchCommands": [
3838
"FT.INFO",
3939
"FT.SEARCH",
40-
"FT.AGGREGATE"
40+
"FT.AGGREGATE",
41+
"FT.PROFILE"
4142
],
4243
"iconDark": "./dist/table_view_icon_dark.svg",
4344
"iconLight": "./dist/table_view_icon_light.svg",

redisinsight/ui/src/packages/redisearch/src/App.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
parseSearchRawResponse,
1010
parseAggregateRawResponse
1111
} from './utils'
12-
import { Command } from './constants'
12+
import { Command, ProfileType } from './constants'
1313
import { TableInfoResult, TableResult } from './components'
1414

1515
interface Props {
@@ -35,16 +35,25 @@ const App = (props: Props) => {
3535
return <TableInfoResult query={command} result={result} />
3636
}
3737

38-
if (commandUpper.startsWith(Command.Aggregate)) {
39-
const [matched, ...arrayResponse] = response
38+
const isProfileCommand = commandUpper.startsWith(Command.Profile)
39+
const profileQueryType = command?.split(' ')?.[2]
40+
41+
if (
42+
commandUpper.startsWith(Command.Aggregate)
43+
|| (isProfileCommand && profileQueryType.toUpperCase() === ProfileType.Aggregate)
44+
) {
45+
const [matched, ...arrayResponse] = isProfileCommand ? response[0] : response
4046
setHeaderText(`Matched:${matched}`)
4147

4248
const result = parseAggregateRawResponse(arrayResponse)
4349
return <TableResult query={command} result={result} matched={matched} />
4450
}
4551

46-
if (commandUpper.startsWith(Command.Search)) {
47-
const [matched, ...arrayResponse] = response
52+
if (
53+
commandUpper.startsWith(Command.Search)
54+
|| (isProfileCommand && profileQueryType.toUpperCase() === ProfileType.Search)
55+
) {
56+
const [matched, ...arrayResponse] = isProfileCommand ? response[0] : response
4857
setHeaderText(`Matched:${matched}`)
4958

5059
const result = parseSearchRawResponse(command, arrayResponse)

redisinsight/ui/src/packages/redisearch/src/constants/constants.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ export enum Command {
44
Search = 'FT.SEARCH',
55
Aggregate = 'FT.AGGREGATE',
66
Info = 'FT.INFO',
7+
Profile = 'FT.PROFILE',
8+
}
9+
10+
export enum ProfileType {
11+
Search = 'SEARCH',
12+
Aggregate = 'AGGREGATE',
713
}
814

915
export enum CommandArgument {

0 commit comments

Comments
 (0)