@@ -9,6 +9,13 @@ import {
9
9
EuiIcon ,
10
10
} from '@elastic/eui'
11
11
12
+ import {
13
+ EDGE_COLOR_BODY_DARK ,
14
+ EDGE_COLOR_BODY_LIGHT ,
15
+ NODE_COLOR_BODY_DARK ,
16
+ NODE_COLOR_BODY_LIGHT ,
17
+ } from './constants'
18
+
12
19
import {
13
20
CoreType ,
14
21
ModuleType ,
@@ -31,6 +38,14 @@ function getEdgeSize(c: number) {
31
38
return Math . floor ( Math . log ( c || 1 ) + 1 )
32
39
}
33
40
41
+ function getNodeColor ( isDarkTheme : boolean ) {
42
+ return isDarkTheme ? NODE_COLOR_BODY_DARK : NODE_COLOR_BODY_LIGHT
43
+ }
44
+
45
+ function getEdgeColor ( isDarkTheme : boolean ) {
46
+ return isDarkTheme ? EDGE_COLOR_BODY_DARK : EDGE_COLOR_BODY_LIGHT
47
+ }
48
+
34
49
export default function Explain ( props : IExplain ) : JSX . Element {
35
50
const command = props . command . split ( ' ' ) [ 0 ] . toLowerCase ( )
36
51
@@ -206,7 +221,7 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
206
221
ancestors . pairs . forEach ( p => {
207
222
document . querySelector ( `#node-${ p [ 0 ] } ` ) ?. setAttribute ( "style" , "" )
208
223
const edge = graph . getCellById ( `${ p [ 0 ] } -${ p [ 1 ] } ` )
209
- const edgeColor = isDarkTheme ? '#6B6B6B' : '#8992B3'
224
+ const edgeColor = getEdgeColor ( isDarkTheme )
210
225
edge . setAttrs ( {
211
226
line : {
212
227
stroke : edgeColor ,
@@ -333,7 +348,7 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
333
348
data : info ,
334
349
attrs : {
335
350
body : {
336
- fill : isDarkTheme ? '#5F95FF' : '#8992B3' ,
351
+ fill : getNodeColor ( isDarkTheme ) ,
337
352
stroke : 'transparent' ,
338
353
} ,
339
354
} ,
@@ -361,7 +376,7 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
361
376
if ( data . children ) {
362
377
data . children . forEach ( ( item : any ) => {
363
378
const itemRecords = parseInt ( item . data . counter || 0 )
364
- const edgeColor = isDarkTheme ? '#6B6B6B' : '#8992B3'
379
+ const edgeColor = getEdgeColor ( isDarkTheme )
365
380
model . edges ?. push ( {
366
381
id : `${ data . id } -${ item . id } ` ,
367
382
source : {
@@ -421,7 +436,14 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
421
436
return (
422
437
< div >
423
438
{ collapse && < div style = { { paddingTop : '50px' } } > </ div > }
424
- < div id = "container-parent" style = { { height : isFullScreen ? ( window . outerHeight - 170 ) + 'px' : collapse ? '500px' : '585px' , width : '100%' , overflow : 'auto' } } >
439
+ < div
440
+ id = "container-parent"
441
+ style = { {
442
+ height : isFullScreen ? ( window . outerHeight - 170 ) + 'px' : collapse ? '500px' : '585px' ,
443
+ width : '100%' ,
444
+ overflow : 'auto' ,
445
+ } }
446
+ >
425
447
< div style = { { margin : 0 , width : '100vw' } } ref = { container } id = "container" />
426
448
{ ! collapse && (
427
449
< div className = "ZoomMenu" >
0 commit comments