diff --git a/src/main/resources/web/js/models/hostmodel.js b/src/main/resources/web/js/models/hostmodel.js index 612f70040c185096c2f92a4d67a9510a7e583794..957f275f544521c6f029fd95239b1f89753b9dfc 100644 --- a/src/main/resources/web/js/models/hostmodel.js +++ b/src/main/resources/web/js/models/hostmodel.js @@ -35,23 +35,19 @@ window.HostCollection = Backbone.Collection.extend({ var self = this; console.log("fetching host list") $.ajax({ - url:hackBase + "/wm/devicemanager/device/all/json", + url:hackBase + "/wm/device/", dataType:"json", success:function (data) { - console.log("fetched host list: " + _.keys(data).length); + console.log("fetched host list: " + data.length); // console.log(data); - // data is a hash where each key is a MAC address - _.each(_.keys(data), function(h) { - var d = data[h]; - if (d['attachment-points'].length > 0) { - d.id = h; - d.seen = d['last-seen']; - d.swport = _.reduce(d['attachment-points'], function(memo, ap) { - return memo + ap.switch + "-" + ap.port + " "}, "") - d.ip = _.reduce(d['network-addresses'], function(memo, na) {return memo + na.ip + " "}, "") - // console.log(d); - self.add(d, {silent: true}); - } + // data is a list of device hashes + _.each(data, function(h) { + if (h['attachmentPoint'].length > 0) { + h.swport = _.reduce(h['attachmentPoint'], function(memo, ap) { + return memo + ap.dpid + "-" + ap.port + " "}, "") + console.log(h.swport); + self.add(h, {silent: true}); + } }); self.trigger('add'); // batch redraws } @@ -76,4 +72,4 @@ window.HostCollection = Backbone.Collection.extend({ } */ -}); \ No newline at end of file +}); diff --git a/src/main/resources/web/tpl/host-list-item.html b/src/main/resources/web/tpl/host-list-item.html index d9b481ec77864b18faa474a4313657657a3319a1..f3bc243424d3a84e8f3d00213de629d4d6b8e2c6 100644 --- a/src/main/resources/web/tpl/host-list-item.html +++ b/src/main/resources/web/tpl/host-list-item.html @@ -1 +1 @@ - <td><a href="/host/<%= id %>"><%= id %></a></td><td><%= vlan %></td><td><%= ip %></td><td><%= swport %></td><td><%= seen %></td> + <td><a href="/host/<%= mac %>"><%= mac %></a></td><td><%= vlan %></td><td><%= ipv4 %></td><td><%= swport %></td><td><%= lastSeen %></td>