GUI -- Created Table Builder Service that builds a controller for tabular views.
- Updated devices, hosts, and intents to use new service.

Change-Id: I1345ece0ff6e9b86a34488b0f07d39c60cdcc520
diff --git a/web/gui/src/main/webapp/app/view/app/app.html b/web/gui/src/main/webapp/app/view/app/app.html
index eb3e547..380db5e 100644
--- a/web/gui/src/main/webapp/app/view/app/app.html
+++ b/web/gui/src/main/webapp/app/view/app/app.html
@@ -17,9 +17,9 @@
             <tr>
                 <th colId="state" class="table-icon" sortable></th>
                 <th colId="id" sortable>App ID </th>
-                <th colId="version" sortable>Version</th>
+                <th colId="version" sortable>Version </th>
                 <th colId="origin" sortable>Origin </th>
-                <th colId="desc">Description </th>
+                <th colId="desc" col-width="400px">Description </th>
             </tr>
         </thead>
 
diff --git a/web/gui/src/main/webapp/app/view/device/device.html b/web/gui/src/main/webapp/app/view/device/device.html
index 1db7900..7d3d735 100644
--- a/web/gui/src/main/webapp/app/view/device/device.html
+++ b/web/gui/src/main/webapp/app/view/device/device.html
@@ -1,6 +1,6 @@
 <!-- Device partial HTML -->
 <div id="ov-device">
-    <h2>Devices ({{ctrl.deviceData.length}} total)</h2>
+    <h2>Devices ({{ctrl.tableData.length}} total)</h2>
     <table class="summary-list"
            onos-fixed-header
            onos-sortable-header
@@ -20,7 +20,7 @@
         </thead>
 
         <tbody>
-            <tr ng-repeat="dev in ctrl.deviceData"
+            <tr ng-repeat="dev in ctrl.tableData"
                 ng-repeat-done>
                 <td class="table-icon">
                     <div icon icon-id="{{dev._iconid_available}}"></div>
diff --git a/web/gui/src/main/webapp/app/view/device/device.js b/web/gui/src/main/webapp/app/view/device/device.js
index a201e3f..cd8d8b0 100644
--- a/web/gui/src/main/webapp/app/view/device/device.js
+++ b/web/gui/src/main/webapp/app/view/device/device.js
@@ -23,33 +23,15 @@
 
     angular.module('ovDevice', [])
     .controller('OvDeviceCtrl',
-        ['$log', '$scope', 'WebSocketService',
+        ['$log', '$scope', 'TableBuilderService',
 
-        function ($log, $scope, wss) {
-            var self = this;
-            self.deviceData = [];
-
-            $scope.responseCallback = function(data) {
-                self.deviceData = data.devices;
-                $scope.$apply();
-            };
-
-            $scope.sortCallback = function (requestParams) {
-                wss.sendEvent('deviceDataRequest', requestParams);
-            };
-
-            var handlers = {
-                deviceDataResponse: $scope.responseCallback
-            };
-            wss.bindHandlers(handlers);
-
-            // Cleanup on destroyed scope
-            $scope.$on('$destroy', function () {
-                wss.unbindHandlers(handlers);
+        function ($log, $scope, tbs) {
+            tbs.buildTable({
+                self: this,
+                scope: $scope,
+                tag: 'device'
             });
 
-            $scope.sortCallback();
-
             $log.log('OvDeviceCtrl has been created');
         }]);
 }());
diff --git a/web/gui/src/main/webapp/app/view/host/host.html b/web/gui/src/main/webapp/app/view/host/host.html
index c7ac52a..72e4d6d 100644
--- a/web/gui/src/main/webapp/app/view/host/host.html
+++ b/web/gui/src/main/webapp/app/view/host/host.html
@@ -1,6 +1,6 @@
 <!-- Host partial HTML -->
 <div id="ov-host">
-    <h2>Hosts ({{ctrl.hostData.length}} total)</h2>
+    <h2>Hosts ({{ctrl.tableData.length}} total)</h2>
     <table class="summary-list"
            onos-fixed-header
            onos-sortable-header
@@ -17,7 +17,7 @@
         </thead>
 
         <tbody>
-        <tr ng-repeat="host in ctrl.hostData"
+        <tr ng-repeat="host in ctrl.tableData"
             ng-repeat-done>
             <td class="table-icon">
                 <div icon icon-id="{{host._iconid_type}}"></div>
diff --git a/web/gui/src/main/webapp/app/view/host/host.js b/web/gui/src/main/webapp/app/view/host/host.js
index c090c73..470f78a 100644
--- a/web/gui/src/main/webapp/app/view/host/host.js
+++ b/web/gui/src/main/webapp/app/view/host/host.js
@@ -23,33 +23,15 @@
 
     angular.module('ovHost', [])
     .controller('OvHostCtrl',
-        ['$log', '$scope', 'FnService', 'WebSocketService',
+        ['$log', '$scope', 'TableBuilderService',
 
-        function ($log, $scope, fs, wss) {
-            var self = this;
-            self.hostData = [];
-
-            $scope.responseCallback = function(data) {
-                self.hostData = data.hosts;
-                $scope.$apply();
-            };
-
-            $scope.sortCallback = function (requestParams) {
-                wss.sendEvent('hostDataRequest', requestParams);
-            };
-
-            var handlers = {
-                hostDataResponse: $scope.responseCallback
-            };
-            wss.bindHandlers(handlers);
-
-            // Cleanup on destroyed scope
-            $scope.$on('$destroy', function () {
-                wss.unbindHandlers(handlers);
+        function ($log, $scope, tbs) {
+            tbs.buildTable({
+                self: this,
+                scope: $scope,
+                tag: 'host'
             });
-
-            $scope.sortCallback();
-
+            
             $log.log('OvHostCtrl has been created');
         }]);
 }());
diff --git a/web/gui/src/main/webapp/app/view/intent/intent.html b/web/gui/src/main/webapp/app/view/intent/intent.html
index 15be2c2..2464c65 100644
--- a/web/gui/src/main/webapp/app/view/intent/intent.html
+++ b/web/gui/src/main/webapp/app/view/intent/intent.html
@@ -16,7 +16,7 @@
 
 <!-- Intent partial HTML -->
 <div id="ov-intent">
-    <h2>Intents ({{ctrl.intentData.length}} total)</h2>
+    <h2>Intents ({{ctrl.tableData.length}} total)</h2>
     <table class="summary-list"
            onos-fixed-header
            onos-sortable-header
@@ -31,7 +31,7 @@
         </thead>
 
         <tbody>
-        <tr ng-repeat-start="intent in ctrl.intentData">
+        <tr ng-repeat-start="intent in ctrl.tableData">
             <td>{{intent.appId}}</td>
             <td>{{intent.key}}</td>
             <td>{{intent.type}}</td>
diff --git a/web/gui/src/main/webapp/app/view/intent/intent.js b/web/gui/src/main/webapp/app/view/intent/intent.js
index 314bdf8..16f9fb8 100644
--- a/web/gui/src/main/webapp/app/view/intent/intent.js
+++ b/web/gui/src/main/webapp/app/view/intent/intent.js
@@ -23,33 +23,15 @@
 
     angular.module('ovIntent', [])
         .controller('OvIntentCtrl',
-        ['$log', '$scope', 'FnService', 'WebSocketService',
+        ['$log', '$scope', 'TableBuilderService',
 
-            function ($log, $scope, fs, wss) {
-                var self = this;
-                self.intentData = [];
-
-                $scope.responseCallback = function(data) {
-                    self.intentData = data.intents;
-                    $scope.$apply();
-                };
-
-                $scope.sortCallback = function (requestParams) {
-                    wss.sendEvent('intentDataRequest', requestParams);
-                };
-
-                var handlers = {
-                    intentDataResponse: $scope.responseCallback
-                };
-                wss.bindHandlers(handlers);
-
-                // Cleanup on destroyed scope
-                $scope.$on('$destroy', function () {
-                    wss.unbindHandlers(handlers);
+            function ($log, $scope, tbs) {
+                tbs.buildTable({
+                    self: this,
+                    scope: $scope,
+                    tag: 'intent'
                 });
 
-                $scope.sortCallback();
-
                 $log.log('OvIntentCtrl has been created');
             }]);
 }());