ONOS-2186 - GUI Topo Overlay - (WIP)
- Default behaviour is to "unsubdue" each node and link present in the Highlights message.
- Now added ability to tag nodes/links for remaining subdued when rendered
(this needed for BYON application).
Change-Id: I351ee0d135bf3ef8f46102f461a45ee48fe9a5cc
diff --git a/core/api/src/main/java/org/onosproject/ui/topo/AbstractHighlight.java b/core/api/src/main/java/org/onosproject/ui/topo/AbstractHighlight.java
index 9f789b2..ab2ced3 100644
--- a/core/api/src/main/java/org/onosproject/ui/topo/AbstractHighlight.java
+++ b/core/api/src/main/java/org/onosproject/ui/topo/AbstractHighlight.java
@@ -26,6 +26,7 @@
public abstract class AbstractHighlight {
private final TopoElementType type;
private final String elementId;
+ private boolean keepSubdued = false;
/**
* Constructs the highlight.
@@ -39,6 +40,13 @@
}
/**
+ * Sets a flag to tell the renderer to keep this element subdued.
+ */
+ public void keepSubdued() {
+ keepSubdued = true;
+ }
+
+ /**
* Returns the element type.
*
* @return element type
@@ -55,4 +63,13 @@
public String elementId() {
return elementId;
}
+
+ /**
+ * Returns the subdued flag.
+ *
+ * @return subdued flag
+ */
+ public boolean subdued() {
+ return keepSubdued;
+ }
}
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/topo/TopoJson.java b/web/gui/src/main/java/org/onosproject/ui/impl/topo/TopoJson.java
index 8b4b354..91cbc05 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/topo/TopoJson.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/topo/TopoJson.java
@@ -90,20 +90,32 @@
}
private static ObjectNode json(DeviceHighlight dh) {
- return objectNode()
+ ObjectNode n = objectNode()
.put(ID, dh.elementId());
+ if (dh.subdued()) {
+ n.put(SUBDUE, true);
+ }
+ return n;
}
private static ObjectNode json(HostHighlight hh) {
- return objectNode()
+ ObjectNode n = objectNode()
.put(ID, hh.elementId());
+ if (hh.subdued()) {
+ n.put(SUBDUE, true);
+ }
+ return n;
}
private static ObjectNode json(LinkHighlight lh) {
- return objectNode()
+ ObjectNode n = objectNode()
.put(ID, lh.elementId())
.put(LABEL, lh.label())
.put(CSS, lh.cssClasses());
+ if (lh.subdued()) {
+ n.put(SUBDUE, true);
+ }
+ return n;
}
/**
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 6bd7762..7eb45ba 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
@@ -326,7 +326,9 @@
data.hosts.forEach(function (host) {
var hdata = api.findNodeById(host.id);
if (hdata && !hdata.el.empty()) {
- api.unsupNode(hdata.id, less);
+ if (!host.subdue) {
+ api.unsupNode(hdata.id, less);
+ }
// TODO: further highlighting?
}
});
@@ -334,7 +336,9 @@
data.devices.forEach(function (device) {
var ddata = api.findNodeById(device.id);
if (ddata && !ddata.el.empty()) {
- api.unsupNode(ddata.id, less);
+ if (!device.subdue) {
+ api.unsupNode(ddata.id, less);
+ }
// TODO: further highlighting?
}
});
@@ -345,10 +349,13 @@
units, portcls, magnitude;
if (ldata && !ldata.el.empty()) {
- api.unsupLink(ldata.key, less);
+ if (!link.subdue) {
+ api.unsupLink(ldata.key, less);
+ }
ldata.el.classed(link.css, true);
ldata.label = lab;
+ // TODO: this needs to be pulled out into traffic overlay
// inject additional styling for port-based traffic
if (fs.endsWith(lab, 'bps')) {
units = lab.substring(lab.length-4);