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
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 14ca96f..90e9411 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 b04bd53..c44b43a 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 304b4e6..13a5f2a 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);
}
}
};