Merge "Adding server-side code for sending device/host details to the client."

This commit is contained in:
Thomas Vachuska 2014-11-11 18:34:05 -08:00 committed by Gerrit Code Review
commit b6a67d5aed
2 changed files with 4 additions and 5 deletions

View File

@ -350,7 +350,6 @@ public abstract class TopologyMessages {
new Prop("Longitude", annot.value("longitude")))); new Prop("Longitude", annot.value("longitude"))));
} }
// Produces a path message to the client. // Produces a path message to the client.
protected ObjectNode pathMessage(Path path, String type) { protected ObjectNode pathMessage(Path path, String type) {
ObjectNode payload = mapper.createObjectNode(); ObjectNode payload = mapper.createObjectNode();

View File

@ -110,8 +110,8 @@ public class TopologyWebSocket
try { try {
ObjectNode event = (ObjectNode) mapper.reader().readTree(data); ObjectNode event = (ObjectNode) mapper.reader().readTree(data);
String type = string(event, "event", "unknown"); String type = string(event, "event", "unknown");
if (type.equals("showDetails")) { if (type.equals("requestDetails")) {
showDetails(event); requestDetails(event);
} else if (type.equals("updateMeta")) { } else if (type.equals("updateMeta")) {
updateMetaUi(event); updateMetaUi(event);
} else if (type.equals("requestPath")) { } else if (type.equals("requestPath")) {
@ -165,9 +165,9 @@ public class TopologyWebSocket
} }
// Sends back device or host details. // Sends back device or host details.
private void showDetails(ObjectNode event) { private void requestDetails(ObjectNode event) {
ObjectNode payload = payload(event); ObjectNode payload = payload(event);
String type = string(payload, "type", "unknown"); String type = string(payload, "class", "unknown");
if (type.equals("device")) { if (type.equals("device")) {
sendMessage(deviceDetails(deviceId(string(payload, "id")), sendMessage(deviceDetails(deviceId(string(payload, "id")),
number(event, "sid"))); number(event, "sid")));