aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/web/gui
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/web/gui')
-rw-r--r--framework/src/onos/web/gui/src/main/webapp/app/fw/svg/glyph.js2
-rw-r--r--framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoD3.js19
-rw-r--r--framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoForce.js12
-rw-r--r--framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoOverlay.js8
-rw-r--r--framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_1_addInstance.json14
-rw-r--r--framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_2_addDevice_s1.json18
-rw-r--r--framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_3_addDevice_s2.json18
-rw-r--r--framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_4_addLink_1_2.json16
-rw-r--r--framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_5_showHighlights_clear.json8
-rw-r--r--framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_6_showHighlights_stuff.json30
-rw-r--r--framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_7_showHighlights_clear.json8
-rw-r--r--framework/src/onos/web/gui/src/test/_karma/ev/badges/scenario.json12
-rw-r--r--framework/src/onos/web/gui/src/test/_karma/ev/traffic/scenario.json4
13 files changed, 166 insertions, 3 deletions
diff --git a/framework/src/onos/web/gui/src/main/webapp/app/fw/svg/glyph.js b/framework/src/onos/web/gui/src/main/webapp/app/fw/svg/glyph.js
index 28f262a1..d8dce362 100644
--- a/framework/src/onos/web/gui/src/main/webapp/app/fw/svg/glyph.js
+++ b/framework/src/onos/web/gui/src/main/webapp/app/fw/svg/glyph.js
@@ -49,6 +49,8 @@
// otn, roadm_otn, firewall, balancer, ips, ids,
// controller, virtual, fiber_switch, other
+ // NOTE: when adding glyphs, please also update TopoConstants.Glyphs class.
+
glyphDataSet = {
_viewbox: "0 0 110 110",
diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoD3.js b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoD3.js
index d29748b1..1f061dd6 100644
--- a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoD3.js
+++ b/framework/src/onos/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/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoForce.js b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoForce.js
index dbe8f9f5..f00b87fa 100644
--- a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoForce.js
+++ b/framework/src/onos/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/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoOverlay.js b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
index 74fa2f24..9a3b4358 100644
--- a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
+++ b/framework/src/onos/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);
}
diff --git a/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_1_addInstance.json b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_1_addInstance.json
new file mode 100644
index 00000000..cdb95361
--- /dev/null
+++ b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_1_addInstance.json
@@ -0,0 +1,14 @@
+{
+ "event": "addInstance",
+ "payload": {
+ "id": "ONOS",
+ "ip": "192.168.56.101",
+ "online": true,
+ "uiAttached": true,
+ "switches": 2,
+ "labels": [
+ "ONOS",
+ "192.168.56.101"
+ ]
+ }
+}
diff --git a/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_2_addDevice_s1.json b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_2_addDevice_s1.json
new file mode 100644
index 00000000..2e9d30f2
--- /dev/null
+++ b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_2_addDevice_s1.json
@@ -0,0 +1,18 @@
+{
+ "event": "addDevice",
+ "payload": {
+ "id": "of:0000000000000001",
+ "type": "switch",
+ "online": true,
+ "master": "ONOS",
+ "labels": [
+ "",
+ "switch-1",
+ "of:0000000000000001"
+ ],
+ "metaUi": {
+ "x": 200,
+ "y": 200
+ }
+ }
+}
diff --git a/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_3_addDevice_s2.json b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_3_addDevice_s2.json
new file mode 100644
index 00000000..79c04d3a
--- /dev/null
+++ b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_3_addDevice_s2.json
@@ -0,0 +1,18 @@
+{
+ "event": "addDevice",
+ "payload": {
+ "id": "of:0000000000000002",
+ "type": "switch",
+ "online": true,
+ "master": "ONOS",
+ "labels": [
+ "",
+ "switch-2",
+ "of:0000000000000002"
+ ],
+ "metaUi": {
+ "x": 400,
+ "y": 220
+ }
+ }
+}
diff --git a/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_4_addLink_1_2.json b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_4_addLink_1_2.json
new file mode 100644
index 00000000..fb952837
--- /dev/null
+++ b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_4_addLink_1_2.json
@@ -0,0 +1,16 @@
+{
+ "event": "addLink",
+ "payload": {
+ "id": "of:0000000000000001/5-of:0000000000000002/7",
+ "type": "direct",
+ "online": true,
+ "linkWidth": 2,
+ "src": "of:0000000000000001",
+ "srcPort": "5",
+ "dst": "of:0000000000000002",
+ "dstPort": "7",
+ "props" : {
+ "BW": "70 Gb"
+ }
+ }
+}
diff --git a/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_5_showHighlights_clear.json b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_5_showHighlights_clear.json
new file mode 100644
index 00000000..615efd25
--- /dev/null
+++ b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_5_showHighlights_clear.json
@@ -0,0 +1,8 @@
+{
+ "event": "showHighlights",
+ "payload": {
+ "devices": [],
+ "hosts": [],
+ "links": []
+ }
+}
diff --git a/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_6_showHighlights_stuff.json b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_6_showHighlights_stuff.json
new file mode 100644
index 00000000..74c42c5c
--- /dev/null
+++ b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_6_showHighlights_stuff.json
@@ -0,0 +1,30 @@
+{
+ "event": "showHighlights",
+ "payload": {
+ "devices": [
+ {
+ "id": "of:0000000000000001",
+ "badge": {
+ "status": "e",
+ "gid": "xMark",
+ "msg": "x marks the spot"
+ }
+ },
+ {
+ "id": "of:0000000000000002",
+ "badge": {
+ "status": "w",
+ "txt": "7"
+ }
+ }
+ ],
+ "hosts": [],
+ "links": [
+ {
+ "css": "primary",
+ "id": "of:0000000000000001/5-of:0000000000000002/7",
+ "label": "Antz!"
+ }
+ ]
+ }
+}
diff --git a/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_7_showHighlights_clear.json b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_7_showHighlights_clear.json
new file mode 100644
index 00000000..615efd25
--- /dev/null
+++ b/framework/src/onos/web/gui/src/test/_karma/ev/badges/ev_7_showHighlights_clear.json
@@ -0,0 +1,8 @@
+{
+ "event": "showHighlights",
+ "payload": {
+ "devices": [],
+ "hosts": [],
+ "links": []
+ }
+}
diff --git a/framework/src/onos/web/gui/src/test/_karma/ev/badges/scenario.json b/framework/src/onos/web/gui/src/test/_karma/ev/badges/scenario.json
new file mode 100644
index 00000000..0ca4f4f4
--- /dev/null
+++ b/framework/src/onos/web/gui/src/test/_karma/ev/badges/scenario.json
@@ -0,0 +1,12 @@
+{
+ "comments": [
+ "Demo of adding badges to devices"
+ ],
+ "title": "Demo adding badges",
+ "params": {
+ "lastAuto": 5
+ },
+ "description": [
+ "Demonstrate the device badging feature."
+ ]
+}
diff --git a/framework/src/onos/web/gui/src/test/_karma/ev/traffic/scenario.json b/framework/src/onos/web/gui/src/test/_karma/ev/traffic/scenario.json
index 57c03733..4e7ce4f8 100644
--- a/framework/src/onos/web/gui/src/test/_karma/ev/traffic/scenario.json
+++ b/framework/src/onos/web/gui/src/test/_karma/ev/traffic/scenario.json
@@ -1,6 +1,8 @@
{
"comments": [
- "Stepping through showTraffic"
+ "Stepping through showTraffic",
+ "NOTE: showTraffic event is deprecated",
+ " This needs to be re-worked to use showHighlights"
],
"title": "Show Traffic Scenario",
"params": {