Skip to content

Commit 7569daf

Browse files
committed
- Suffix time with 'ms'
- Use "Records Produced" for graph
1 parent 7085375 commit 7569daf

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

redisinsight/ui/src/packages/ri-explain/src/Explain.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Hierarchy from '@antv/hierarchy'
55

66
import {
77
CoreType,
8+
ModuleType,
89
EntityInfo,
910
ParseExplain,
1011
ParseGraphV2,
@@ -30,11 +31,14 @@ export default function Explain(props: IExplain): JSX.Element {
3031
return (
3132
<ExplainDraw
3233
data={resp}
34+
module={ModuleType.Graph}
3335
type={command.endsWith('explain') ? CoreType.Explain : CoreType.Profile}
3436
/>
3537
)
3638
}
3739

40+
const module = ModuleType.Search
41+
3842
if (command == 'ft.profile') {
3943
const info = props.data[0].response[1]
4044

@@ -57,6 +61,7 @@ export default function Explain(props: IExplain): JSX.Element {
5761
return (
5862
<ExplainDraw
5963
data={data}
64+
module={module}
6065
type={CoreType.Profile}
6166
profilingTime={profilingTime}
6267
/>
@@ -71,6 +76,7 @@ export default function Explain(props: IExplain): JSX.Element {
7176
return (
7277
<ExplainDraw
7378
data={data}
79+
module={module}
7480
type={CoreType.Explain}
7581
/>
7682
)
@@ -96,7 +102,7 @@ interface IProfilingTime {
96102
[key: string]: string
97103
}
98104

99-
function ExplainDraw({data, type, profilingTime}: {data: any, type: CoreType, profilingTime?: IProfilingTime}): JSX.Element {
105+
function ExplainDraw({data, type, module, profilingTime}: {data: any, type: CoreType, module: ModuleType, profilingTime?: IProfilingTime}): JSX.Element {
100106
const container = useRef<HTMLDivElement | null>(null)
101107

102108
const [done, setDone] = useState(false)
@@ -193,7 +199,14 @@ function ExplainDraw({data, type, profilingTime}: {data: any, type: CoreType, pr
193199
const model: Model.FromJSONData = { nodes: [], edges: [] }
194200
const traverse = (data: any) => {
195201
if (data) {
196-
const info = data.data
202+
const info = data.data as EntityInfo
203+
204+
if (module === ModuleType.Graph) {
205+
info.recordsProduced = info.counter
206+
delete info.counter
207+
delete info.size
208+
209+
}
197210

198211
let nodeProps = {
199212
shape: 'react-explain-node',

redisinsight/ui/src/packages/ri-explain/src/Node.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,9 @@ function NodeToolTipContent(props: INodeToolTip) {
6161
return null
6262
}
6363

64-
6564
export function ProfileNode(props: INodeProps) {
6665
const info: EntityInfo = (props as any).node.getData()
67-
const {id, data, type, snippet, time, counter, size} = info
66+
const {id, data, type, snippet, time, counter, size, recordsProduced} = info
6867

6968
let items = {}
7069

@@ -76,6 +75,10 @@ export function ProfileNode(props: INodeProps) {
7675
items['Size'] = size
7776
}
7877

78+
if (recordsProduced !== undefined) {
79+
items['Records Produced'] = recordsProduced
80+
}
81+
7982
return (
8083
<div className="ProfileContainer" id={`node-${id}`}>
8184
<div className="Main">
@@ -93,12 +96,14 @@ export function ProfileNode(props: INodeProps) {
9396
<EuiToolTip content={<NodeToolTipContent content={"Execution Time"} />}>
9497
<div className="Time">
9598
<div className="IconContainer"><EuiIcon className="NodeIcon" size="m" type="clock" /></div>
96-
<div>{time}</div>
99+
<div>{time} ms</div>
97100
</div>
98101
</EuiToolTip>
99102
<EuiToolTip content={<NodeToolTipContent items={items} />}>
100103
<div className="Size">
101-
<div>{counter}</div>
104+
<div>{
105+
counter !== undefined ? counter :
106+
size !== undefined ? size : recordsProduced}</div>
102107
<div className="IconContainer"><EuiIcon className="NodeIcon" size="m" type="reportingApp" /></div>
103108
</div>
104109
</EuiToolTip>

redisinsight/ui/src/packages/ri-explain/src/parser.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ export interface EntityInfo {
222222
size?: string
223223
parentId?: string
224224
level?: number
225+
recordsProduced?: string
225226
}
226227

227228
interface IAncestors {
@@ -715,6 +716,11 @@ export function ParseIteratorProfile(data: any[]): EntityInfo {
715716
// }
716717
}
717718

719+
export enum ModuleType {
720+
Graph,
721+
Search,
722+
}
723+
718724
export enum CoreType {
719725
Profile,
720726
Explain,

0 commit comments

Comments
 (0)