From 4273f9d1e4faf29fb6a21884b9acb1ddf4ccdfda Mon Sep 17 00:00:00 2001
From: Wes Felter <wmf@us.ibm.com>
Date: Wed, 13 Jun 2012 17:26:32 -0500
Subject: [PATCH] Correctly display host attachment points in UI due to REST
 API change. Also fixed some tab/space formatting inconsistency.

---
 src/main/resources/web/js/models/hostmodel.js | 41 ++++++++-----------
 1 file changed, 16 insertions(+), 25 deletions(-)

diff --git a/src/main/resources/web/js/models/hostmodel.js b/src/main/resources/web/js/models/hostmodel.js
index 1c515d58a..e8bf5d9e0 100644
--- a/src/main/resources/web/js/models/hostmodel.js
+++ b/src/main/resources/web/js/models/hostmodel.js
@@ -17,10 +17,10 @@
 window.Host = Backbone.Model.extend({
 
     defaults: {
-    	vlan: -1,
-    	seen: 'never',
-    	ip: ' ',
-    	swport: ' ',
+        vlan: -1,
+        seen: 'never',
+        ip: ' ',
+        swport: ' ',
     },
 
     // initialize:function () {}
@@ -42,12 +42,12 @@ window.HostCollection = Backbone.Collection.extend({
                 // console.log(data);
                 // 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});
-		    }
+                    if (h['attachmentPoint'].length > 0) {
+                        h.swport = _.reduce(h['attachmentPoint'], function(memo, ap) {
+                            return memo + ap.switchDPID + "-" + ap.port + " "}, "");
+                        //console.log(h.swport);
+                        self.add(h, {silent: true});
+                    }
                 });
                 self.trigger('add'); // batch redraws
             }
@@ -60,20 +60,11 @@ window.HostCollection = Backbone.Collection.extend({
     }
 
     /*
-    findByName:function (key) {
-        // TODO: Modify service to include firstName in search
-        var url = (key == '') ? '/host/' : "/host/search/" + key;
-        console.log('findByName: ' + key);
-        var self = this;
-        $.ajax({
-            url:url,
-            dataType:"json",
-            success:function (data) {
-                console.log("search success: " + data.length);
-                self.reset(data);
-            }
-        });
-    }
-    */
+	 * findByName:function (key) { // TODO: Modify service to include firstName
+	 * in search var url = (key == '') ? '/host/' : "/host/search/" + key;
+	 * console.log('findByName: ' + key); var self = this; $.ajax({ url:url,
+	 * dataType:"json", success:function (data) { console.log("search success: " +
+	 * data.length); self.reset(data); } }); }
+	 */
 
 });
-- 
GitLab