GUI Topo -- Cleaned up NodeBadge, now that we have a clearer idea of what we want to model.

Change-Id: I754a94cbd1fbe2a2c8affccaca88c48c3fa33b92
diff --git a/web/gui/src/main/webapp/app/view/topo/topoD3.js b/web/gui/src/main/webapp/app/view/topo/topoD3.js
index d29748b..1f061dd 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoD3.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoD3.js
@@ -218,6 +218,24 @@
             .attr('transform', sus.translate(dx, dy));
     }
 
+    function updateDeviceBadge(d) {
+        // TODO: Fix this WIP
+        var node = d.el,
+            bsel;
+
+        if (d.badge) {
+            bsel = node.append('g')
+                .classed('badge', true)
+                .attr('transform', sus.translate(-14, -14));
+
+            bsel.append('circle')
+                .attr('r', 14);
+            bsel.append('text')
+                .attr('transform', sus.translate(-5, 3))
+                .text('42');
+        }
+    }
+
     function updateHostLabel(d) {
         var label = trimLabel(hostLabel(d));
         d.el.select('text').text(label);
@@ -241,6 +259,7 @@
         var node = d.el;
         node.classed('online', d.online);
         updateDeviceLabel(d);
+        updateDeviceBadge(d);
         api.posNode(d, true);
     }
 
diff --git a/web/gui/src/main/webapp/app/view/topo/topoForce.js b/web/gui/src/main/webapp/app/view/topo/topoForce.js
index dbe8f9f..f00b87f 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoForce.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoForce.js
@@ -860,6 +860,16 @@
         });
     }
 
+    function clearNodeDeco() {
+        node.selectAll('g.badge').remove();
+    }
+
+    function removeNodeBadges() {
+        network.nodes.forEach(function (d) {
+            d.badge = null;
+        });
+    }
+
     function updateLinkLabelModel() {
         // create the backing data for showing labels..
         var data = [];
@@ -923,6 +933,8 @@
 
     function mkOverlayApi() {
         return {
+            clearNodeDeco: clearNodeDeco,
+            removeNodeBadges: removeNodeBadges,
             clearLinkTrafficStyle: clearLinkTrafficStyle,
             removeLinkLabels: removeLinkLabels,
             findLinkById: tms.findLinkById,
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 74fa2f2..9a3b435 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
@@ -294,7 +294,8 @@
              unsupLink( key, [less] )
          */
 
-        // TODO: clear node highlighting
+        api.clearNodeDeco();
+        api.removeNodeBadges();
         api.clearLinkTrafficStyle();
         api.removeLinkLabels();
 
@@ -319,8 +320,11 @@
         });
 
         data.devices.forEach(function (device) {
-            var ddata = api.findNodeById(device.id);
+            var ddata = api.findNodeById(device.id),
+                badgeData = device.badge || null;
+
             if (ddata && !ddata.el.empty()) {
+                ddata.badge = badgeData;
                 if (!device.subdue) {
                     api.unsupNode(ddata.id, less);
                 }