GUI - Implemented updateInstance event handler.
- Cleaned up onos instance rendering.
Change-Id: Ib074fb061467a566bc75052b14ea38ecbbc055b6
diff --git a/web/gui/src/main/webapp/json/ev/instances/ev_18_onos.json b/web/gui/src/main/webapp/json/ev/instances/ev_18_onos.json
new file mode 100644
index 0000000..07ebf97
--- /dev/null
+++ b/web/gui/src/main/webapp/json/ev/instances/ev_18_onos.json
@@ -0,0 +1,11 @@
+{
+ "event": "updateInstance",
+ "payload": {
+ "id": "onos-3",
+ "online": true,
+ "labels": [
+ "onos-3",
+ "192.168.3.3"
+ ]
+ }
+}
diff --git a/web/gui/src/main/webapp/json/ev/instances/ev_19_onos.json b/web/gui/src/main/webapp/json/ev/instances/ev_19_onos.json
new file mode 100644
index 0000000..9498d1d
--- /dev/null
+++ b/web/gui/src/main/webapp/json/ev/instances/ev_19_onos.json
@@ -0,0 +1,11 @@
+{
+ "event": "updateInstance",
+ "payload": {
+ "id": "onos-3",
+ "online": false,
+ "labels": [
+ "onos-3",
+ "192.168.3.3"
+ ]
+ }
+}
diff --git a/web/gui/src/main/webapp/topo2.css b/web/gui/src/main/webapp/topo2.css
index 484cfe7..4fd3d71 100644
--- a/web/gui/src/main/webapp/topo2.css
+++ b/web/gui/src/main/webapp/topo2.css
@@ -273,10 +273,12 @@
#topo-oibox .onosInst img {
opacity: 0.5;
+ padding: 3px;
}
#topo-oibox .onosInst.online img {
opacity: 1.0;
+ padding: 3px;
}
#topo-oibox .onosInst img.ui {
diff --git a/web/gui/src/main/webapp/topo2.js b/web/gui/src/main/webapp/topo2.js
index 3cd4d2e..25782f9 100644
--- a/web/gui/src/main/webapp/topo2.js
+++ b/web/gui/src/main/webapp/topo2.js
@@ -557,7 +557,7 @@
addLink: addLink,
addHost: addHost,
- updateInstance: stillToImplement,
+ updateInstance: updateInstance,
updateDevice: updateDevice,
updateLink: updateLink,
updateHost: updateHost,
@@ -652,7 +652,6 @@
if (instData) {
$.extend(instData, inst);
updateInstances();
- //updateInstanceState(instData);
} else {
logicError('updateInstance lookup fail. ID = "' + id + '"');
}
@@ -843,6 +842,7 @@
.data(onosOrder, function (d) { return d.id; });
// operate on existing onoses if necessary
+ onoses.classed('online', function (d) { return d.online; });
var entering = onoses.enter()
.append('div')
@@ -857,11 +857,7 @@
$('<img src="img/host.png">').appendTo(el);
img = el.select('img')
.attr({
- width: 40,
- top: -10,
- left: -10
- })
- .style({
+ width: 30
});
$('<div>').attr('class', 'onosTitle').text(d.id).appendTo(el);