Simon Hunt

GUI -- DeviceResource: minor improvement.

Change-Id: I591aa4cca09fb51e2e92df8c479d80d2d3aed94e
...@@ -69,11 +69,12 @@ public class DeviceGuiResource extends BaseResource { ...@@ -69,11 +69,12 @@ public class DeviceGuiResource extends BaseResource {
69 */ 69 */
70 private ObjectNode deviceJson(DeviceService service, Device device) { 70 private ObjectNode deviceJson(DeviceService service, Device device) {
71 boolean available = service.isAvailable(device.id()); 71 boolean available = service.isAvailable(device.id());
72 + // pick the appropriate id for the icon to appear in the table row
72 String iconId = available ? ICON_ID_ONLINE : ICON_ID_OFFLINE; 73 String iconId = available ? ICON_ID_ONLINE : ICON_ID_OFFLINE;
73 74
74 ObjectNode result = mapper.createObjectNode(); 75 ObjectNode result = mapper.createObjectNode();
75 result.put("id", device.id().toString()) 76 result.put("id", device.id().toString())
76 - .put("available", service.isAvailable(device.id())) 77 + .put("available", available)
77 .put("_iconid_available", iconId) 78 .put("_iconid_available", iconId)
78 .put("type", device.type().toString()) 79 .put("type", device.type().toString())
79 .put("role", service.getRole(device.id()).toString()) 80 .put("role", service.getRole(device.id()).toString())
......