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/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');
             }]);
 }());