diff --git a/redisinsight/ui/src/packages/redisearch/package.json b/redisinsight/ui/src/packages/redisearch/package.json index 3cee132061..419d567041 100644 --- a/redisinsight/ui/src/packages/redisearch/package.json +++ b/redisinsight/ui/src/packages/redisearch/package.json @@ -37,7 +37,8 @@ "matchCommands": [ "FT.INFO", "FT.SEARCH", - "FT.AGGREGATE" + "FT.AGGREGATE", + "FT.PROFILE" ], "iconDark": "./dist/table_view_icon_dark.svg", "iconLight": "./dist/table_view_icon_light.svg", diff --git a/redisinsight/ui/src/packages/redisearch/src/App.tsx b/redisinsight/ui/src/packages/redisearch/src/App.tsx index 5b2ceab1db..ed0b710e71 100644 --- a/redisinsight/ui/src/packages/redisearch/src/App.tsx +++ b/redisinsight/ui/src/packages/redisearch/src/App.tsx @@ -9,7 +9,7 @@ import { parseSearchRawResponse, parseAggregateRawResponse } from './utils' -import { Command } from './constants' +import { Command, ProfileType } from './constants' import { TableInfoResult, TableResult } from './components' interface Props { @@ -35,16 +35,25 @@ const App = (props: Props) => { return } - if (commandUpper.startsWith(Command.Aggregate)) { - const [matched, ...arrayResponse] = response + const isProfileCommand = commandUpper.startsWith(Command.Profile) + const profileQueryType = command?.split(' ')?.[2] + + if ( + commandUpper.startsWith(Command.Aggregate) + || (isProfileCommand && profileQueryType.toUpperCase() === ProfileType.Aggregate) + ) { + const [matched, ...arrayResponse] = isProfileCommand ? response[0] : response setHeaderText(`Matched:${matched}`) const result = parseAggregateRawResponse(arrayResponse) return } - if (commandUpper.startsWith(Command.Search)) { - const [matched, ...arrayResponse] = response + if ( + commandUpper.startsWith(Command.Search) + || (isProfileCommand && profileQueryType.toUpperCase() === ProfileType.Search) + ) { + const [matched, ...arrayResponse] = isProfileCommand ? response[0] : response setHeaderText(`Matched:${matched}`) const result = parseSearchRawResponse(command, arrayResponse) diff --git a/redisinsight/ui/src/packages/redisearch/src/constants/constants.ts b/redisinsight/ui/src/packages/redisearch/src/constants/constants.ts index 021c8b9e06..76aa3e490e 100644 --- a/redisinsight/ui/src/packages/redisearch/src/constants/constants.ts +++ b/redisinsight/ui/src/packages/redisearch/src/constants/constants.ts @@ -4,6 +4,12 @@ export enum Command { Search = 'FT.SEARCH', Aggregate = 'FT.AGGREGATE', Info = 'FT.INFO', + Profile = 'FT.PROFILE', +} + +export enum ProfileType { + Search = 'SEARCH', + Aggregate = 'AGGREGATE', } export enum CommandArgument {