Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion redisinsight/ui/src/packages/redisearch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 14 additions & 5 deletions redisinsight/ui/src/packages/redisearch/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -35,16 +35,25 @@ const App = (props: Props) => {
return <TableInfoResult query={command} result={result} />
}

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 <TableResult query={command} result={result} matched={matched} />
}

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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down