Skip to content

Commit 44bff8f

Browse files
committed
- Remove edge target marker
- Add support for LEXRANGE, IDS, NOT, OPTION, EXACT, FUZZY, WILDCARD, PREFIX expressions - Parse Vector Expressions - Parse tag identifiers with numbers - Properly skip backslash if exsits (multiple backslash appears) - Parse identifiers with pipe character - Make TAG expressions be parsed via expand expression parser since it might contain children - Remove support for FT.PROFILE on cluster - Add max-cap zoom
1 parent f3ed15d commit 44bff8f

File tree

4 files changed

+278
-147
lines changed

4 files changed

+278
-147
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React from 'react'
22
import Explain from './Explain'
33

4-
const isDarkTheme = document.body.classList.contains('theme_DARK')
5-
64
export function App(props: { command?: string, data: any }) {
75

86
const ErrorResponse = HandleError(props)

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

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export default function Explain(props: IExplain): JSX.Element {
8282
let [cluster, entityInfo] = ParseProfileCluster(info)
8383
cluster['Coordinator'].forEach((kv: [string, string]) => profilingTime[kv[0]] = kv[1])
8484
data = entityInfo
85+
return <div className="responseFail">Visualization of FT.PROFILE on cluster is not yet supported.</div>
8586
} else if (typeof info[0] === 'string' && info[0].toLowerCase().startsWith('coordinator')) {
8687
const resultsProfile = info[2]
8788
data = ParseProfile(resultsProfile)
@@ -91,6 +92,7 @@ export default function Explain(props: IExplain): JSX.Element {
9192
'Parsing time': resultsProfile[1][1],
9293
'Pipeline creation time': resultsProfile[2][1],
9394
}
95+
return <div className="responseFail">Visualization of FT.PROFILE on cluster is not yet supported.</div>
9496
} else {
9597
data = ParseProfile(info)
9698
profilingTime = {
@@ -213,11 +215,6 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
213215
line: {
214216
stroke: edgeColor,
215217
strokeWidth: (edge.getAttrs() as any)?.line?.strokeWidth,
216-
targetMarker: {
217-
name: 'block',
218-
stroke: edgeColor,
219-
fill: edgeColor,
220-
},
221218
},
222219
})
223220
})
@@ -234,11 +231,6 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
234231
line: {
235232
stroke: edgeColor,
236233
strokeWidth: (edge.getAttrs() as any)?.line?.strokeWidth,
237-
targetMarker: {
238-
name: 'block',
239-
fill: edgeColor,
240-
stroke: edgeColor,
241-
}
242234
},
243235
})
244236
})
@@ -270,8 +262,14 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
270262
if (data) {
271263
const info = data.data as EntityInfo
272264

273-
if (!info.snippet && info.parentSnippet && info.data?.startsWith(info.parentSnippet)) {
274-
info.data = info.data.substr(info.parentSnippet.length)
265+
// snippet if prefix with parent suffix will always be followed by ':'.
266+
//
267+
// Currently snippets are passed to child only for TAG
268+
// expressions which has ':' at the center.
269+
//
270+
// Example child data with parent snippet: <PARENT_SNIPPET>:<DATA>
271+
if (!info.snippet && info.parentSnippet && info.data?.startsWith(`${info.parentSnippet}:`)) {
272+
info.data = info.data.substr(info.parentSnippet.length + 1)
275273
info.snippet = info.parentSnippet
276274
}
277275

@@ -375,11 +373,7 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
375373
line: {
376374
stroke: edgeColor,
377375
strokeWidth: getEdgeSize(itemRecords),
378-
targetMarker: {
379-
name: 'block',
380-
fill: edgeColor,
381-
stroke: edgeColor,
382-
},
376+
targetMarker: null,
383377
},
384378
},
385379
})
@@ -462,7 +456,7 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
462456
name: 'Zoom In',
463457
onClick: () => {
464458
setTimeout(() => document.addEventListener('mouseup', mouseUpHandler), 100)
465-
core?.zoom(0.5)
459+
core && Math.floor(core.zoom()) <= 3 && core?.zoom(0.5)
466460
core?.resize(undefined, core?.getContentBBox().height + 50)
467461
},
468462
icon: 'magnifyWithPlus'
@@ -471,7 +465,11 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
471465
name: 'Zoom Out',
472466
onClick: () => {
473467
setTimeout(() => document.addEventListener('mouseup', mouseUpHandler), 100)
474-
core && Math.floor(core.zoom()) <= 0.5 ? core?.zoom(0) : core?.zoom(-0.5)
468+
if (Math.floor(core?.zoom() || 0) <= 0.5) {
469+
core?.centerContent()
470+
} else {
471+
core?.zoom(-0.5)
472+
}
475473
core?.resize(undefined, core?.getContentBBox().height + 50)
476474
},
477475
icon: 'magnifyWithMinus'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function ExplainNode(props: INodeProps) {
3131
<div className="InfoData">
3232
<EuiToolTip delay='long' content={infoData}><span>{infoData}</span></EuiToolTip>
3333
</div>
34-
{subType && [EntityType.GEO, EntityType.NUMERIC, EntityType.TEXT, EntityType.TAG, EntityType.FUZZY].includes(subType) && <div className="Type">{subType}</div> }
34+
{subType && [EntityType.GEO, EntityType.NUMERIC, EntityType.TEXT, EntityType.TAG, EntityType.FUZZY, EntityType.WILDCARD, EntityType.PREFIX, EntityType.IDS, EntityType.LEXRANGE].includes(subType) && <div className="Type">{subType}</div> }
3535
</div>
3636
</div>
3737
{

0 commit comments

Comments
 (0)