9
9
parseSearchRawResponse ,
10
10
parseAggregateRawResponse
11
11
} from './utils'
12
- import { Command } from './constants'
12
+ import { Command , ProfileType } from './constants'
13
13
import { TableInfoResult , TableResult } from './components'
14
14
15
15
interface Props {
@@ -35,16 +35,25 @@ const App = (props: Props) => {
35
35
return < TableInfoResult query = { command } result = { result } />
36
36
}
37
37
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
40
46
setHeaderText ( `Matched:${ matched } ` )
41
47
42
48
const result = parseAggregateRawResponse ( arrayResponse )
43
49
return < TableResult query = { command } result = { result } matched = { matched } />
44
50
}
45
51
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
48
57
setHeaderText ( `Matched:${ matched } ` )
49
58
50
59
const result = parseSearchRawResponse ( command , arrayResponse )
0 commit comments