@@ -143,9 +143,8 @@ export const TopologyView: React.FC<TopologyViewProps> = ({
143
143
. each ( function ( subtree ) {
144
144
const tree = subtree . tree ;
145
145
const group = d3 . select ( this ) ;
146
- const gLinks = group . select ( ".links" ) ;
147
- const gNodes = group . select ( ".nodes" ) ;
148
- gLinks
146
+ group
147
+ . select ( ".links" )
149
148
. selectAll ( ".link" )
150
149
. data ( tree . links ( ) , ( d : any ) => d . source ?. data ?. id + d . target ?. data ?. id )
151
150
. join ( "path" )
@@ -155,7 +154,8 @@ export const TopologyView: React.FC<TopologyViewProps> = ({
155
154
. attr ( "d" , diagonal )
156
155
. attr ( "stroke-width" , 1.5 ) ;
157
156
158
- gNodes
157
+ group
158
+ . select ( ".nodes" )
159
159
. selectAll ( ".node" )
160
160
. data ( tree . descendants ( ) , ( d : any ) => d . data . id )
161
161
. join ( "circle" )
@@ -165,6 +165,18 @@ export const TopologyView: React.FC<TopologyViewProps> = ({
165
165
. attr ( "cy" , ( d : any ) => d . y )
166
166
. attr ( "r" , d => getRadius ( d . data . group ) )
167
167
. attr ( "fill" , d => colors . assign ( d . data . group ) ) ;
168
+
169
+ group
170
+ . select ( ".texts" )
171
+ . selectAll ( ".text" )
172
+ . data ( tree . descendants ( ) , ( d : any ) => d . data . id )
173
+ . join ( "text" )
174
+ . filter ( d => d . data . group !== "room" && d . data . group !== "client" )
175
+ . attr ( "class" , "text" )
176
+ . text ( d => d . data . id . substring ( 0 , 6 ) )
177
+ . attr ( "x" , ( d : any ) => d . x )
178
+ . attr ( "y" , ( d : any ) => d . y )
179
+ . attr ( "font-size" , 10 ) ;
168
180
} ) ;
169
181
}
170
182
0 commit comments