From 8419efd32ca1e04b507d275f66450fb3444ebbdf Mon Sep 17 00:00:00 2001 From: Simon Hunt Date: Thu, 12 Jan 2017 12:36:28 -0800 Subject: [PATCH] ONOS-5726: Route "show-intent" request through a topo-overlay hook. (This is the first of several steps for this Jira ticket). Change-Id: Iad8d0500d68f36de17c681b1072bfaa1e94f0b33 --- web/gui/src/main/webapp/app/view/topo/topo.js | 19 ++++++++++++++----- .../main/webapp/app/view/topo/topoOverlay.js | 10 +++++++++- .../webapp/app/view/topo/topoTrafficNew.js | 6 ++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/web/gui/src/main/webapp/app/view/topo/topo.js b/web/gui/src/main/webapp/app/view/topo/topo.js index 14ca96ff64..90e94117ef 100644 --- a/web/gui/src/main/webapp/app/view/topo/topo.js +++ b/web/gui/src/main/webapp/app/view/topo/topo.js @@ -506,15 +506,24 @@ flash.enable(true); } + // initial set of topo events received, now do post-processing function topoStartDone() { - var d = $scope.intentData; - // give a small delay before attempting to reselect node(s) and stuff - // since they have to be re-added to the DOM first... + // give a small delay before attempting to reselect node(s) and + // highlight elements, since they have to be re-added to the DOM first... $timeout(function () { + $log.debug('^^ topo.topoStartDone() ^^'); + + // reselect the previous selection... tss.reselect(); - if (d) { - tts.selectIntent(d); + + // if an intent should be shown, invoke the appropriate callback + if ($scope.intentData) { + + // TODO: if a specific overlay was requested, activate that first + + tov.hooks.showIntent($scope.intentData); } + }, 200); } diff --git a/web/gui/src/main/webapp/app/view/topo/topoOverlay.js b/web/gui/src/main/webapp/app/view/topo/topoOverlay.js index b04bd53168..c44b43a913 100644 --- a/web/gui/src/main/webapp/app/view/topo/topoOverlay.js +++ b/web/gui/src/main/webapp/app/view/topo/topoOverlay.js @@ -284,6 +284,13 @@ return cb && extra ? cb(data, extra) : data; } + // Request from Intent View to visualize an intent on the topo view + function showIntentHook(intentData) { + $log.debug('^^ topoOverlay.showIntentHook(...) ^^'); + var cb = _hook('showintent'); + return cb && cb(intentData); + } + // === ----------------------------------------------------- // Event (from server) Handlers @@ -435,7 +442,8 @@ multiSelect: multiSelectHook, mouseOver: mouseOverHook, mouseOut: mouseOutHook, - modifyLinkData: modifyLinkDataHook + modifyLinkData: modifyLinkDataHook, + showIntent: showIntentHook }, showHighlights: showHighlights diff --git a/web/gui/src/main/webapp/app/view/topo/topoTrafficNew.js b/web/gui/src/main/webapp/app/view/topo/topoTrafficNew.js index 304b4e6fc5..13a5f2a4b4 100644 --- a/web/gui/src/main/webapp/app/view/topo/topoTrafficNew.js +++ b/web/gui/src/main/webapp/app/view/topo/topoTrafficNew.js @@ -141,6 +141,12 @@ }, mouseout: function () { tts.requestTrafficForMode(true); + }, + + // intent visualization hook + showintent: function (intentData) { + $log.debug('^^ trafficOverlay.showintent() ^^'); + tts.selectIntent(intentData); } } };