Simon Hunt
Committed by Brian O'Connor

ONOS-2109: Fix for (0,0) coords bug - delay opening web socket until we have loa…

…ded the map projection.

Change-Id: Ibe38154c987baf77768e2d6a0bcaf8f35550efcb
...@@ -361,7 +361,7 @@ ...@@ -361,7 +361,7 @@
361 // NOTE: toolbar will have set this for us.. 361 // NOTE: toolbar will have set this for us..
362 prefsState = ps.asNumbers(ps.getPrefs('topo_prefs')); 362 prefsState = ps.asNumbers(ps.getPrefs('topo_prefs'));
363 363
364 - $log.debug('TOPO---- Prefs State:', prefsState); 364 + $log.debug('TOPO- Prefs State:', prefsState);
365 365
366 flash.enable(false); 366 flash.enable(false);
367 toggleInstances(prefsState.insts); 367 toggleInstances(prefsState.insts);
...@@ -372,6 +372,19 @@ ...@@ -372,6 +372,19 @@
372 } 372 }
373 373
374 374
375 + // somewhat hackish, because summary update cannot happen until we
376 + // have opened the websocket to the server; hence this extra function
377 + // invoked after tes.start()
378 + function restoreSummaryFromPrefs() {
379 + prefsState = ps.asNumbers(ps.getPrefs('topo_prefs'));
380 + $log.debug('TOPO- Prefs SUMMARY State:', prefsState.summary);
381 +
382 + flash.enable(false);
383 + toggleSummary(prefsState.summary);
384 + flash.enable(true);
385 + }
386 +
387 +
375 // --- Controller Definition ----------------------------------------- 388 // --- Controller Definition -----------------------------------------
376 389
377 angular.module('ovTopo', moduleDependencies) 390 angular.module('ovTopo', moduleDependencies)
...@@ -463,7 +476,13 @@ ...@@ -463,7 +476,13 @@
463 flash.enable(false); 476 flash.enable(false);
464 toggleMap(prefsState.bg); 477 toggleMap(prefsState.bg);
465 flash.enable(true); 478 flash.enable(true);
466 - // TODO: move tes.start() to here ???? 479 +
480 + // now we have the map projection, we are ready for
481 + // the server to send us device/host data...
482 + tes.start();
483 + // need to do the following so we immediately get
484 + // the summary panel data back from the server
485 + restoreSummaryFromPrefs();
467 } 486 }
468 ); 487 );
469 setUpSprites($loc, tspr); 488 setUpSprites($loc, tspr);
...@@ -472,7 +491,6 @@ ...@@ -472,7 +491,6 @@
472 tfs.initForce(svg, forceG, uplink, dim); 491 tfs.initForce(svg, forceG, uplink, dim);
473 tis.initInst({ showMastership: tfs.showMastership }); 492 tis.initInst({ showMastership: tfs.showMastership });
474 tps.initPanels(); 493 tps.initPanels();
475 - tes.start();
476 494
477 // temporary solution for persisting user settings 495 // temporary solution for persisting user settings
478 restoreConfigFromPrefs(); 496 restoreConfigFromPrefs();
......