@@ -80,6 +80,14 @@ window.Widgets.Panel.Utils = {};
80
80
indentSpacing : 50 ,
81
81
tooltipContent : 'summary' , //'summary' or 'json'
82
82
itemFont : '18px' ,
83
+ edgeFontSize : '16px' ,
84
+ edgeFontFamily : 'Wire One' ,
85
+ layout : {
86
+ left : 20 ,
87
+ top : 20 ,
88
+ distanceX : 50 ,
89
+ distanceY : 50
90
+ } ,
83
91
boxSize : 10 ,
84
92
tree_edge_thickness : 0.75 ,
85
93
graph_edge_thickness : 1 ,
@@ -382,6 +390,7 @@ window.Widgets.Panel.Utils = {};
382
390
// B. Update Data, Simulations and Drive Show Graph
383
391
ns . processGraphData = function ( graphData ) {
384
392
console . group ( 'Widgets.Panel.Utils.updateGraph' ) ;
393
+ console . log ( 'graphData->' , graphData ) ;
385
394
386
395
let nodes = graphData . nodes ;
387
396
let edges = graphData . edges ;
@@ -397,7 +406,10 @@ window.Widgets.Panel.Utils = {};
397
406
ns . split . data = graphData ;
398
407
399
408
ns . split . adjacency = new ns . Graph ( ) ;
400
- ns . split . prom_node_IDs = [ ] ;
409
+
410
+ ns . split . promo_nodes_IDs = [ ] ;
411
+ ns . split . promo_IDs = [ ] ;
412
+ ns . split . promo_annotate_list = [ ] ;
401
413
402
414
// If Incident Management, then check for these promotoables
403
415
ns . split . prom_types = [
@@ -454,34 +466,36 @@ window.Widgets.Panel.Utils = {};
454
466
} ) ;
455
467
456
468
//3. Find first the promotable node ID's and collect all sub-graphs into promID's
457
- ns . split . promo_nodes_IDs = [ ] ;
458
- ns . split . promo_annotate_list = [ ] ;
459
- let centreX = 400 / 2 // ns.options.width/2; this is NaN
469
+ let dummywidth = 400 ; // how to work out promo panel width and height????? TO DO
470
+ let centreX = dummywidth / 2 // ns.options.width/2; this is NaN
460
471
console . log ( '&&&&&&----' ) ;
461
472
console . log ( 'centreX->' , centreX ) ;
462
473
console . log ( 'layout->' , ns . options . layout ) ;
463
474
console . log ( 'options->' , ns . options ) ;
475
+ console . log ( 'nodes->' , nodes ) ;
464
476
// 4. Setup layout
465
- let j = 0 ;
477
+ let j = - 1 ;
466
478
nodes . forEach ( function ( node ) {
467
479
let annotate = { } ;
468
480
annotate . connections = [ ] ;
469
481
annotate . prom_IDs = [ ] ;
470
482
annotate . layouts = [ ] ;
483
+ console . log ( 'node type in annotate->' , node . type ) ;
471
484
if ( ns . split . prom_types . includes ( node . type ) ) {
472
485
j = j + 1 ;
473
486
annotate . id = node . id ;
474
- annotate . centreX = centreX + j * ns . options . width ;
487
+ annotate . centreX = centreX + j * dummywidth ;
475
488
annotate . topY = ns . options . layout . top ;
476
489
if ( node . type !== 'incident' ) {
477
490
// If it is a level 1 object
478
491
let layout_list = ns . split . level2_layouts [ node . type ] ;
492
+ console . log ( 'layout_list->' , layout_list ) ;
479
493
// Setup left hand edge of level 1, centred around incident
480
494
//check if the number is even or odd
481
- if ( layout_list . length ( ) % 2 == 0 ) {
482
- annotate . leftX = annotate . centreX - ( ns . options . layout . distanceX * ( ( layout_list . length ( ) / 2 ) - 0.5 ) ) ;
495
+ if ( layout_list . length % 2 == 0 ) {
496
+ annotate . leftX = annotate . centreX - ( ns . options . layout . distanceX * ( ( layout_list . length / 2 ) - 0.5 ) ) ;
483
497
} else {
484
- annotate . leftX = annotate . centreX - ( ns . options . layout . distanceX * ( Math . floor ( layout_list . length ( ) / 2 ) ) )
498
+ annotate . leftX = annotate . centreX - ( ns . options . layout . distanceX * ( Math . floor ( layout_list . length / 2 ) ) )
485
499
}
486
500
let node_orig = node . original ;
487
501
let i = 0 ;
@@ -508,10 +522,10 @@ window.Widgets.Panel.Utils = {};
508
522
let layout_list = ns . split . level1_layouts [ 'incident' ]
509
523
// Setup left hand edge of level 1, centred around incident
510
524
//check if the number is even or odd
511
- if ( layout_list . length ( ) % 2 == 0 ) {
512
- annotate . leftX = annotate . centreX - ( ns . options . layout . distanceX * ( ( layout_list . length ( ) / 2 ) - 0.5 ) ) ;
525
+ if ( layout_list . length % 2 == 0 ) {
526
+ annotate . leftX = annotate . centreX - ( ns . options . layout . distanceX * ( ( layout_list . length / 2 ) - 0.5 ) ) ;
513
527
} else {
514
- annotate . leftX = annotate . centreX - ( ns . options . layout . distanceX * ( Math . floor ( layout_list . length ( ) / 2 ) ) )
528
+ annotate . leftX = annotate . centreX - ( ns . options . layout . distanceX * ( Math . floor ( layout_list . length / 2 ) ) )
515
529
}
516
530
let node_ext = node . original . extension [ "extension-definition—ef765651-680c-498d-9894-99799f2fa126" ] ;
517
531
let i = 0 ;
@@ -532,20 +546,24 @@ window.Widgets.Panel.Utils = {};
532
546
i = i + 1 ;
533
547
} ) ;
534
548
}
535
- annotate . prom_IDs = Array . from (
536
- ns . split . adjacency . dirs ( ns . split . prom_node_IDs ) ,
537
- ( path ) => path . at ( - 1 ) ,
538
- ) ;
539
549
ns . split . promo_annotate_list . push ( annotate ) ;
540
- ns . split . promo_nodes_IDs . concat ( annotate . prom_IDs ) ;
550
+ ns . split . promo_nodes_IDs . push ( node . id ) ;
551
+ // ns.split.promo_nodes_IDs.concat(annotate.prom_IDs);
541
552
}
542
553
} ) ;
554
+
555
+ ns . split . promo_IDs = Array . from (
556
+ ns . split . adjacency . dirs ( ns . split . promo_nodes_IDs ) ,
557
+ ( path ) => path . at ( - 1 ) ,
558
+ ) ;
559
+ console . log ( 'ns.split.promo_nodes_IDs->' , ns . split . promo_nodes_IDs ) ;
560
+ console . log ( 'ns.split.promo_IDs->' , ns . split . promo_IDs ) ;
543
561
544
562
545
563
// 4. Now split the Graphs and update the
546
564
nodes . forEach ( function ( node ) {
547
- if ( ns . split . promo_nodes_IDs . includes ( node . id ) ) {
548
- node = ns . processLayout ( ns . split . promo_annotate_list , node ) ;
565
+ if ( ns . split . promo_IDs . includes ( node . id ) ) {
566
+ // node = ns.processLayout(ns.split.promo_annotate_list, node);
549
567
ns . split . promo . nodes . push ( node ) ;
550
568
} else {
551
569
ns . split . scratch . nodes . push ( node ) ;
@@ -554,8 +572,8 @@ window.Widgets.Panel.Utils = {};
554
572
555
573
edges . forEach ( function ( edge ) {
556
574
if (
557
- ns . split . prom_IDs . includes ( edge . source ) &&
558
- ns . split . prom_IDs . includes ( edge . target )
575
+ ns . split . promo_IDs . includes ( edge . source ) &&
576
+ ns . split . promo_IDs . includes ( edge . target )
559
577
) {
560
578
ns . split . promo . edges . push ( edge ) ;
561
579
} else {
0 commit comments