Skip to content

Commit 0d6025a

Browse files
committed
Define edge colors
1 parent 8d3cfeb commit 0d6025a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
126126

127127
const [done, setDone] = useState(false)
128128
const [collapse, setCollapse] = useState(true)
129-
const [infoWidth, setInfoWidth] = useState(document.body.offsetWidth)
130129
const [isFullScreen, setIsFullScreen] = useState(false)
131130
const [core, setCore] = useState<Graph>()
132131

@@ -152,7 +151,6 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
152151
core?.resize(width, (b?.height || 585) + 100)
153152
}
154153
}
155-
setInfoWidth(width)
156154
}
157155

158156
window.addEventListener('resize', resize)
@@ -187,14 +185,15 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
187185
document.querySelector(`#node-${p[0]}`)?.setAttribute("style", "outline: 1px solid #85A2FE !important;")
188186
// Get edge size of parent ancestor to apply the right edge stroke
189187
const edge = graph.getCellById(`${p[0]}-${p[1]}`)
188+
const edgeColor = '#85A2FE'
190189
edge.setAttrs({
191190
line: {
192-
stroke: '#85A2FE',
191+
stroke: edgeColor,
193192
strokeWidth: (edge.getAttrs() as any)?.line?.strokeWidth,
194193
targetMarker: {
195194
name: 'block',
196-
stroke: '#85A2FE',
197-
fill: '#85A2FE',
195+
stroke: edgeColor,
196+
fill: edgeColor,
198197
},
199198
},
200199
})
@@ -207,14 +206,15 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
207206
ancestors.pairs.forEach(p => {
208207
document.querySelector(`#node-${p[0]}`)?.setAttribute("style", "")
209208
const edge = graph.getCellById(`${p[0]}-${p[1]}`)
209+
const edgeColor = isDarkTheme ? '#6B6B6B' : '#8992B3'
210210
edge.setAttrs({
211211
line: {
212-
stroke: isDarkTheme ? '#6B6B6B' : '#8992B3',
212+
stroke: edgeColor,
213213
strokeWidth: (edge.getAttrs() as any)?.line?.strokeWidth,
214214
targetMarker: {
215215
name: 'block',
216-
fill: isDarkTheme ? '#6B6B6B' : '#8992B3',
217-
stroke: isDarkTheme ? '#6B6B6B' : '#8992B3',
216+
fill: edgeColor,
217+
stroke: edgeColor,
218218
}
219219
},
220220
})
@@ -361,7 +361,7 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
361361
if (data.children) {
362362
data.children.forEach((item: any) => {
363363
const itemRecords = parseInt(item.data.counter || 0)
364-
364+
const edgeColor = isDarkTheme ? '#6B6B6B' : '#8992B3'
365365
model.edges?.push({
366366
id: `${data.id}-${item.id}`,
367367
source: {
@@ -389,12 +389,12 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
389389
},
390390
attrs: {
391391
line: {
392-
stroke: isDarkTheme ? '#6B6B6B' : '#8992B3',
392+
stroke: edgeColor,
393393
strokeWidth: getEdgeSize(itemRecords),
394394
targetMarker: {
395395
name: 'block',
396-
fill: isDarkTheme ? '#6B6B6B' : '#8992B3',
397-
stroke: isDarkTheme ? '#6B6B6B' : '#8992B3',
396+
fill: edgeColor,
397+
stroke: edgeColor,
398398
},
399399
},
400400
},

0 commit comments

Comments
 (0)