Simon Hunt
Committed by Gerrit Code Review

GUI - Fixed a timing issue with topology event handler binding.

- handlers were not bound up front, (but during a delayed promise callback)
- resulted in the handlers not being present for initial events returned from the server:
 -- showSummary, spriteListResponse, spriteDataResponse

Change-Id: Ida8d14e8bdcb065d0ea5f88eb7a4bf6e45036c27
......@@ -28,9 +28,9 @@
'onosRemote'
];
// references to injected services etc.
// references to injected services
var $scope, $log, $cookies, fs, ks, zs, gs, ms, sus, flash, wss, ps, th,
tds, tes, tfs, tps, tis, tss, tls, tts, tos, fltr, ttbs, ttip, tov;
tds, tes, tfs, tps, tis, tss, tls, tts, tos, fltr, ttbs, tspr, ttip, tov;
// DOM elements
var ovtopo, svg, defs, zoomLayer, mapG, spriteG, forceG, noDevsLayer;
......@@ -507,7 +507,7 @@
_zs_, _gs_, _ms_, _sus_, _flash_, _wss_, _ps_, _th_,
_tds_, _tes_,
_tfs_, _tps_, _tis_, _tss_, _tls_, _tts_, _tos_, _fltr_,
_ttbs_, tspr, _ttip_, _tov_) {
_ttbs_, _tspr_, _ttip_, _tov_) {
var params = $loc.search(),
projection,
dim,
......@@ -548,6 +548,7 @@
tos = _tos_;
fltr = _fltr_;
ttbs = _ttbs_;
tspr = _tspr_;
ttip = _ttip_;
tov = _tov_;
......@@ -609,6 +610,7 @@
restoreSummaryFromPrefs();
}
);
tes.bindHandlers();
setUpSprites($loc, tspr);
forceG = zoomLayer.append('g').attr('id', 'topo-force');
......
......@@ -109,9 +109,14 @@
createHandlerMap();
function bindHandlers() {
wss.bindHandlers(handlerMap);
$log.debug('topo event handlers bound');
}
function start() {
// in case we fail over to a new server, listen for wsock-open
openListener = wss.addOpenListener(wsOpen);
wss.bindHandlers(handlerMap);
wss.sendEvent('topoStart');
scheduleHeartbeat();
$log.debug('topo comms started');
......@@ -127,6 +132,7 @@
}
return {
bindHandlers: bindHandlers,
start: start,
stop: stop
};
......