Skip to content
Snippets Groups Projects
Commit 4273f9d1 authored by Wes Felter's avatar Wes Felter
Browse files

Correctly display host attachment points in UI due to REST API change.

Also fixed some tab/space formatting inconsistency.
parent 9ab05d7e
No related branches found
No related tags found
No related merge requests found
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
window.Host = Backbone.Model.extend({ window.Host = Backbone.Model.extend({
defaults: { defaults: {
vlan: -1, vlan: -1,
seen: 'never', seen: 'never',
ip: ' ', ip: ' ',
swport: ' ', swport: ' ',
}, },
// initialize:function () {} // initialize:function () {}
...@@ -42,12 +42,12 @@ window.HostCollection = Backbone.Collection.extend({ ...@@ -42,12 +42,12 @@ window.HostCollection = Backbone.Collection.extend({
// console.log(data); // console.log(data);
// data is a list of device hashes // data is a list of device hashes
_.each(data, function(h) { _.each(data, function(h) {
if (h['attachmentPoint'].length > 0) { if (h['attachmentPoint'].length > 0) {
h.swport = _.reduce(h['attachmentPoint'], function(memo, ap) { h.swport = _.reduce(h['attachmentPoint'], function(memo, ap) {
return memo + ap.dpid + "-" + ap.port + " "}, "") return memo + ap.switchDPID + "-" + ap.port + " "}, "");
console.log(h.swport); //console.log(h.swport);
self.add(h, {silent: true}); self.add(h, {silent: true});
} }
}); });
self.trigger('add'); // batch redraws self.trigger('add'); // batch redraws
} }
...@@ -60,20 +60,11 @@ window.HostCollection = Backbone.Collection.extend({ ...@@ -60,20 +60,11 @@ window.HostCollection = Backbone.Collection.extend({
} }
/* /*
findByName:function (key) { * findByName:function (key) { // TODO: Modify service to include firstName
// TODO: Modify service to include firstName in search * in search var url = (key == '') ? '/host/' : "/host/search/" + key;
var url = (key == '') ? '/host/' : "/host/search/" + key; * console.log('findByName: ' + key); var self = this; $.ajax({ url:url,
console.log('findByName: ' + key); * dataType:"json", success:function (data) { console.log("search success: " +
var self = this; * data.length); self.reset(data); } }); }
$.ajax({ */
url:url,
dataType:"json",
success:function (data) {
console.log("search success: " + data.length);
self.reset(data);
}
});
}
*/
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment