ONOS-5726: incremental step to generating mini-dropdown of registered topology overlays for intent view.
Change-Id: I5e892504b3ca46e70b97a97a58fa1e54ebed7dd0
diff --git a/web/gui/src/main/webapp/app/view/intent/intent.js b/web/gui/src/main/webapp/app/view/intent/intent.js
index 324f389..559dca1 100644
--- a/web/gui/src/main/webapp/app/view/intent/intent.js
+++ b/web/gui/src/main/webapp/app/view/intent/intent.js
@@ -29,9 +29,9 @@
angular.module('ovIntent', [])
.controller('OvIntentCtrl',
['$log', '$scope', 'TableBuilderService', 'NavService',
- 'TopoTrafficService', 'DialogService',
+ 'TopoOverlayService', 'TopoTrafficService', 'DialogService',
- function ($log, $scope, tbs, ns, tts, ds) {
+ function ($log, $scope, tbs, ns, tov, tts, ds) {
$scope.briefTip = 'Switch to brief view';
$scope.detailTip = 'Switch to detailed view';
$scope.brief = true;
@@ -78,7 +78,13 @@
$scope.showIntent = function () {
var d = $scope.intentData;
- d && ns.navTo('topo', d);
+ if (d) {
+ // TODO: if more than one overlay registered, provide dropdown
+ $log.debug('SHOW-INTENT: overlay list:', tov.list());
+ $log.debug('SHOW-INTENT: overlay info:', tov.list(true));
+
+ ns.navTo('topo', d);
+ }
};
$scope.isIntentInstalled = function () {
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 c44b43a..dbb1cc3 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
@@ -108,9 +108,25 @@
$log.debug(tos + 'registered overlay: ' + id, overlay);
}
- // returns the list of overlay identifiers
- function list() {
- return d3.map(overlays).keys();
+ // Returns the list of overlay identifiers. If a truthy argument is supplied,
+ // returns an augmented list of overlay tokens, providing overlay ID,
+ // glyph ID and overlay Tooltip text.
+ function list(x) {
+ var oids = d3.map(overlays).keys(),
+ info = [];
+
+ if (!x) {
+ return oids;
+ }
+
+ oids.forEach(function (oid) {
+ var o = overlays[oid],
+ ot = o.tooltip || '%' + o.overlayId + '%',
+ og = o._glyphId;
+
+ info.push({ id: oid, tt: ot, gid: og });
+ });
+ return info;
}
// add a radio button for each registered overlay