@@ -2,6 +2,7 @@ import React, { useEffect, useState, useRef } from 'react'
2
2
import { Model , Graph } from '@antv/x6'
3
3
import { register } from '@antv/x6-react-shape'
4
4
import Hierarchy from '@antv/hierarchy'
5
+ import { formatRedisReply } from 'redisinsight-plugin-sdk'
5
6
6
7
import {
7
8
EuiButtonIcon ,
@@ -72,6 +73,18 @@ export default function Explain(props: IExplain): JSX.Element {
72
73
73
74
const module = ModuleType . Search
74
75
76
+ const [ parsedRedisReply , setParsedRedisReply ] = useState ( '' )
77
+
78
+ useEffect ( ( ) => {
79
+ if ( command == 'ft.profile' ) {
80
+ const getParsedResponse = async ( ) => {
81
+ const formattedResponse = await formatRedisReply ( props . data [ 0 ] . response , props . command )
82
+ setParsedRedisReply ( formattedResponse )
83
+ }
84
+ getParsedResponse ( )
85
+ }
86
+ } )
87
+
75
88
if ( command == 'ft.profile' ) {
76
89
const info = props . data [ 0 ] . response [ 1 ]
77
90
@@ -82,7 +95,12 @@ export default function Explain(props: IExplain): JSX.Element {
82
95
let [ cluster , entityInfo ] = ParseProfileCluster ( info )
83
96
cluster [ 'Coordinator' ] . forEach ( ( kv : [ string , string ] ) => profilingTime [ kv [ 0 ] ] = kv [ 1 ] )
84
97
data = entityInfo
85
- return < div className = "responseFail" > Visualization of FT.PROFILE on cluster is not yet supported.</ div >
98
+ return (
99
+ < >
100
+ < div className = "responseFail" > Visualization is not supported for a clustered database.</ div >
101
+ < div className = "parsedRedisReply" > { parsedRedisReply } </ div >
102
+ </ >
103
+ )
86
104
} else if ( typeof info [ 0 ] === 'string' && info [ 0 ] . toLowerCase ( ) . startsWith ( 'coordinator' ) ) {
87
105
const resultsProfile = info [ 2 ]
88
106
data = ParseProfile ( resultsProfile )
@@ -92,7 +110,12 @@ export default function Explain(props: IExplain): JSX.Element {
92
110
'Parsing time' : resultsProfile [ 1 ] [ 1 ] ,
93
111
'Pipeline creation time' : resultsProfile [ 2 ] [ 1 ] ,
94
112
}
95
- return < div className = "responseFail" > Visualization of FT.PROFILE on cluster is not yet supported.</ div >
113
+ return (
114
+ < >
115
+ < div className = "responseFail" > Visualization is not supported for a clustered database.</ div >
116
+ < div className = "parsedRedisReply" > { parsedRedisReply } </ div >
117
+ </ >
118
+ )
96
119
} else {
97
120
data = ParseProfile ( info )
98
121
profilingTime = {
0 commit comments