GUI -- Refresh button has been moved to TableBuilderService to be part of every tabular view automatically.

Change-Id: I2de0ae9161573a2c44320dcd07111938a89ba5e2
diff --git a/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js b/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js
index 3a97732..611e371 100644
--- a/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js
+++ b/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js
@@ -21,7 +21,7 @@
     'use strict';
 
     // injected refs
-    var $log, fs, wss;
+    var $log, fs, wss, ts;
 
     // example params to buildTable:
     // {
@@ -61,6 +61,12 @@
         }
         o.scope.selectCallback = selCb;
 
+        function refresh() {
+            $log.debug('Refreshing ' + root + ' page');
+            ts.resetSortIcons();
+            sortCb();
+        }
+        o.scope.refresh = refresh;
 
         handlers[resp] = respCb;
         wss.bindHandlers(handlers);
@@ -75,12 +81,13 @@
 
     angular.module('onosWidget')
         .factory('TableBuilderService',
-        ['$log', 'FnService', 'WebSocketService',
+        ['$log', 'FnService', 'WebSocketService', 'TableService',
 
-            function (_$log_, _fs_, _wss_) {
+            function (_$log_, _fs_, _wss_, _ts_) {
                 $log = _$log_;
                 fs = _fs_;
                 wss = _wss_;
+                ts = _ts_;
 
                 return {
                     buildTable: buildTable
diff --git a/web/gui/src/main/webapp/app/view/app/app.js b/web/gui/src/main/webapp/app/view/app/app.js
index cacd5e0..1c897d4 100644
--- a/web/gui/src/main/webapp/app/view/app/app.js
+++ b/web/gui/src/main/webapp/app/view/app/app.js
@@ -25,9 +25,9 @@
 
     angular.module('ovApp', [])
     .controller('OvAppCtrl',
-        ['$log', '$scope', 'TableService', 'TableBuilderService', 'WebSocketService',
+        ['$log', '$scope', 'TableBuilderService', 'WebSocketService',
 
-    function ($log, $scope, ts, tbs, wss) {
+    function ($log, $scope, tbs, wss) {
         function selCb($event, row) {
             selRow = angular.element($event.currentTarget);
             selection = row;
@@ -45,12 +45,6 @@
             document.getElementById('file').dispatchEvent(evt);
         });
 
-        $scope.refresh = function () {
-            $log.debug('Refreshing application page');
-            ts.resetSortIcons();
-            $scope.sortCallback();
-        };
-
         document.getElementById('app-form-response').onload = function () {
             document.getElementById('app-form').reset();
             $scope.refresh();
diff --git a/web/gui/src/main/webapp/app/view/cluster/cluster.js b/web/gui/src/main/webapp/app/view/cluster/cluster.js
index 25e5bd2..006808c 100644
--- a/web/gui/src/main/webapp/app/view/cluster/cluster.js
+++ b/web/gui/src/main/webapp/app/view/cluster/cluster.js
@@ -23,20 +23,14 @@
 
     angular.module('ovCluster', [])
         .controller('OvClusterCtrl',
-        ['$log', '$scope', 'TableService', 'TableBuilderService',
+        ['$log', '$scope', 'TableBuilderService',
 
-            function ($log, $scope, ts, tbs) {
+            function ($log, $scope, tbs) {
                 tbs.buildTable({
                     scope: $scope,
                     tag: 'cluster'
                 });
 
-                $scope.refresh = function () {
-                    $log.debug('Refreshing cluster nodes page');
-                    ts.resetSortIcons();
-                    $scope.sortCallback();
-                };
-
                 $log.log('OvClusterCtrl has been created');
             }]);
 }());
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 b571d82..03faf64 100644
--- a/web/gui/src/main/webapp/app/view/device/device.js
+++ b/web/gui/src/main/webapp/app/view/device/device.js
@@ -222,12 +222,12 @@
 
     angular.module('ovDevice', [])
     .controller('OvDeviceCtrl',
-        ['$log', '$scope', 'TableService', 'TableBuilderService', 'FnService',
+        ['$log', '$scope', 'TableBuilderService', 'FnService',
             'MastService', 'PanelService', 'WebSocketService', 'IconService',
             'ButtonService', 'NavService', 'TooltipService',
 
         function (_$log_, _$scope_,
-                  ts, tbs, _fs_, _mast_, _ps_, _wss_, _is_, _bns_, _ns_, _ttip_) {
+                  tbs, _fs_, _mast_, _ps_, _wss_, _is_, _bns_, _ns_, _ttip_) {
             $log = _$log_;
             $scope = _$scope_;
             fs = _fs_;
@@ -260,12 +260,6 @@
                 tag: 'device',
                 selCb: selCb
             });
-
-            $scope.refresh = function () {
-                $log.debug('Refreshing devices page');
-                ts.resetSortIcons();
-                $scope.sortCallback();
-            };
             createDetailsPane();
 
             // details panel handlers
diff --git a/web/gui/src/main/webapp/app/view/flow/flow.js b/web/gui/src/main/webapp/app/view/flow/flow.js
index c75ed87..8ee39d5 100644
--- a/web/gui/src/main/webapp/app/view/flow/flow.js
+++ b/web/gui/src/main/webapp/app/view/flow/flow.js
@@ -22,20 +22,19 @@
     'use strict';
 
     // injected references
-    var $log, $scope, $location, fs, ts, tbs;
+    var $log, $scope, $location, fs, tbs;
 
     angular.module('ovFlow', [])
     .controller('OvFlowCtrl',
         ['$log', '$scope', '$location',
-            'FnService', 'TableService', 'TableBuilderService',
+            'FnService', 'TableBuilderService',
 
-        function (_$log_, _$scope_, _$location_, _fs_, _ts_, _tbs_) {
+        function (_$log_, _$scope_, _$location_, _fs_, _tbs_) {
             var params;
             $log = _$log_;
             $scope = _$scope_;
             $location = _$location_;
             fs = _fs_;
-            ts = _ts_;
             tbs = _tbs_;
 
             params = $location.search();
@@ -49,12 +48,6 @@
                 query: params
             });
 
-            $scope.refresh = function () {
-                $log.debug('Refreshing flows page');
-                ts.resetSortIcons();
-                $scope.sortCallback();
-            };
-            
             $log.log('OvFlowCtrl has been created');
         }]);
 }());
diff --git a/web/gui/src/main/webapp/app/view/group/group.js b/web/gui/src/main/webapp/app/view/group/group.js
index 1602da1..f863609d 100644
--- a/web/gui/src/main/webapp/app/view/group/group.js
+++ b/web/gui/src/main/webapp/app/view/group/group.js
@@ -22,20 +22,19 @@
     'use strict';
 
     // injected references
-    var $log, $scope, $location, fs, ts, tbs;
+    var $log, $scope, $location, fs, tbs;
 
     angular.module('ovGroup', [])
     .controller('OvGroupCtrl',
         ['$log', '$scope', '$location',
-            'FnService', 'TableService', 'TableBuilderService',
+            'FnService', 'TableBuilderService',
 
-        function (_$log_, _$scope_, _$location_, _fs_, _ts_, _tbs_) {
+        function (_$log_, _$scope_, _$location_, _fs_, _tbs_) {
             var params;
             $log = _$log_;
             $scope = _$scope_;
             $location = _$location_;
             fs = _fs_;
-            ts = _ts_;
             tbs = _tbs_;
 
             params = $location.search();
@@ -49,12 +48,6 @@
                 query: params
             });
 
-            $scope.refresh = function () {
-                $log.debug('Refreshing groups page');
-                ts.resetSortIcons();
-                $scope.sortCallback();
-            };
-            
             $log.log('OvGroupCtrl has been created');
         }]);
 }());
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 e82c7da..1ccca40 100644
--- a/web/gui/src/main/webapp/app/view/host/host.js
+++ b/web/gui/src/main/webapp/app/view/host/host.js
@@ -23,20 +23,14 @@
 
     angular.module('ovHost', [])
     .controller('OvHostCtrl',
-        ['$log', '$scope', 'TableService', 'TableBuilderService',
+        ['$log', '$scope', 'TableBuilderService',
 
-        function ($log, $scope, ts, tbs) {
+        function ($log, $scope, tbs) {
             tbs.buildTable({
                 scope: $scope,
                 tag: 'host'
             });
 
-            $scope.refresh = function () {
-                $log.debug('Refreshing hosts page');
-                ts.resetSortIcons();
-                $scope.sortCallback();
-            };
-
             $log.log('OvHostCtrl has been created');
         }]);
 }());
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 e74e927..5810f34 100644
--- a/web/gui/src/main/webapp/app/view/intent/intent.js
+++ b/web/gui/src/main/webapp/app/view/intent/intent.js
@@ -23,20 +23,14 @@
 
     angular.module('ovIntent', [])
         .controller('OvIntentCtrl',
-        ['$log', '$scope', 'TableService', 'TableBuilderService',
+        ['$log', '$scope', 'TableBuilderService',
 
-            function ($log, $scope, ts, tbs) {
+            function ($log, $scope, tbs) {
                 tbs.buildTable({
                     scope: $scope,
                     tag: 'intent'
                 });
 
-                $scope.refresh = function () {
-                    $log.debug('Refreshing intents page');
-                    ts.resetSortIcons();
-                    $scope.sortCallback();
-                };
-
                 $log.log('OvIntentCtrl has been created');
             }]);
 }());
diff --git a/web/gui/src/main/webapp/app/view/link/link.js b/web/gui/src/main/webapp/app/view/link/link.js
index 743e90d..d21d7dc 100644
--- a/web/gui/src/main/webapp/app/view/link/link.js
+++ b/web/gui/src/main/webapp/app/view/link/link.js
@@ -23,20 +23,14 @@
 
     angular.module('ovLink', [])
     .controller('OvLinkCtrl',
-        ['$log', '$scope', 'TableService', 'TableBuilderService',
+        ['$log', '$scope', 'TableBuilderService',
 
-        function ($log, $scope, ts, tbs) {
+        function ($log, $scope, tbs) {
             tbs.buildTable({
                 scope: $scope,
                 tag: 'link'
             });
 
-            $scope.refresh = function () {
-                $log.debug('Refreshing links page');
-                ts.resetSortIcons();
-                $scope.sortCallback();
-            };
-
             $log.log('OvLinkCtrl has been created');
         }]);
 }());
diff --git a/web/gui/src/main/webapp/app/view/port/port.js b/web/gui/src/main/webapp/app/view/port/port.js
index 857f846..b596ef5 100644
--- a/web/gui/src/main/webapp/app/view/port/port.js
+++ b/web/gui/src/main/webapp/app/view/port/port.js
@@ -22,20 +22,18 @@
     'use strict';
 
     // injected references
-    var $log, $scope, $location, fs, ts, tbs;
+    var $log, $scope, $location, fs, tbs;
 
     angular.module('ovPort', [])
     .controller('OvPortCtrl',
-        ['$log', '$scope', '$location',
-            'FnService', 'TableService', 'TableBuilderService',
+        ['$log', '$scope', '$location', 'FnService', 'TableBuilderService',
 
-        function (_$log_, _$scope_, _$location_, _fs_, _ts_, _tbs_) {
+        function (_$log_, _$scope_, _$location_, _fs_, _tbs_) {
             var params;
             $log = _$log_;
             $scope = _$scope_;
             $location = _$location_;
             fs = _fs_;
-            ts = _ts_;
             tbs = _tbs_;
 
             params = $location.search();
@@ -49,12 +47,6 @@
                 query: params
             });
 
-            $scope.refresh = function () {
-                $log.debug('Refreshing ports page');
-                ts.resetSortIcons();
-                $scope.sortCallback();
-            };
-            
             $log.log('OvPortCtrl has been created');
         }]);
 }());