@@ -2,8 +2,9 @@ import { flatten } from 'lodash'
2
2
import React from 'react'
3
3
4
4
import { CommandExecutionResult } from 'uiSrc/slices/interfaces'
5
- import { cliParseCommandsGroupResult , Maybe } from 'uiSrc/utils'
5
+ import { cliParseCommandsGroupResult , wbSummaryCommand , Maybe } from 'uiSrc/utils'
6
6
import QueryCardCliDefaultResult from '../QueryCardCliDefaultResult'
7
+ import { CommonErrorResponse } from '../QueryCardCommonResult'
7
8
8
9
export interface Props {
9
10
result ?: Maybe < CommandExecutionResult [ ] >
@@ -12,12 +13,18 @@ export interface Props {
12
13
13
14
const QueryCardCliGroupResult = ( props : Props ) => {
14
15
const { result = [ ] , isFullScreen } = props
16
+
15
17
return (
16
18
< div data-testid = "query-cli-default-result" className = "query-card-output-response-success" >
17
19
< QueryCardCliDefaultResult
18
20
isFullScreen = { isFullScreen }
19
- items = { flatten ( result ?. [ 0 ] ?. response . map ( ( item : any ) =>
20
- flatten ( cliParseCommandsGroupResult ( item ) ) ) ) }
21
+ items = { flatten ( result ?. [ 0 ] ?. response . map ( ( item : any ) => {
22
+ const commonError = CommonErrorResponse ( item . command , item . response )
23
+ if ( React . isValidElement ( commonError ) ) {
24
+ return ( [ wbSummaryCommand ( item . command ) , commonError ] )
25
+ }
26
+ return flatten ( cliParseCommandsGroupResult ( item ) )
27
+ } ) ) }
21
28
/>
22
29
</ div >
23
30
)
0 commit comments