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