File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
nebula/frontend/templates Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -2420,6 +2420,25 @@ <h5 class="step-title">Schema of deployment</h5>
2420
2420
document . getElementById ( "predefined-topology-select" ) . addEventListener ( "change" , function ( ) {
2421
2421
updateNodes ( ) ;
2422
2422
} ) ;
2423
+
2424
+ function generateRandomLinks ( nodes , probability ) {
2425
+ const links = [ ] ;
2426
+ for ( let i = 0 ; i < nodes . length ; i ++ ) {
2427
+ for ( let j = i + 1 ; j < nodes . length ; j ++ ) {
2428
+ if ( Math . random ( ) < probability ) {
2429
+ links . push ( { source : i , target : j } ) ;
2430
+ }
2431
+ }
2432
+ }
2433
+ return links ;
2434
+ }
2435
+
2436
+ // Add event listener for probability changes
2437
+ document . getElementById ( "random-probability" ) . addEventListener ( "change" , function ( ) {
2438
+ if ( $ ( "#predefined-topology-select" ) . val ( ) === 'Random' ) {
2439
+ updateNodes ( ) ;
2440
+ }
2441
+ } ) ;
2423
2442
</ script >
2424
2443
2425
2444
< script >
You can’t perform that action at this time.
0 commit comments