GUI -- Table views' auto refresh can be toggled on or off.

Change-Id: I9c307d8ea43101d6f6cff28c16d2cdbe709871e1
diff --git a/web/gui/src/main/webapp/app/fw/widget/table.css b/web/gui/src/main/webapp/app/fw/widget/table.css
index ff222e7..4b56f2e 100644
--- a/web/gui/src/main/webapp/app/fw/widget/table.css
+++ b/web/gui/src/main/webapp/app/fw/widget/table.css
@@ -93,3 +93,70 @@
 .dark div.summary-list td {
     color: #ccc;
 }
+
+/* Tabular view upper right control buttons */
+
+div.ctrl-btns {
+    display: inline-block;
+    float: right;
+    height: 44px;
+    margin-right: 24px;
+    margin-top: 7px;
+}
+
+
+div.ctrl-btns div {
+    display: inline-block;
+    padding: 4px;
+    cursor: pointer;
+}
+
+/* Inactive */
+.light .ctrl-btns div g.icon rect,
+.light .ctrl-btns div:hover g.icon rect {
+    fill: #eee;
+}
+.dark .ctrl-btns div g.icon rect,
+.dark .ctrl-btns div:hover g.icon rect {
+    fill: #222;
+}
+
+.light .ctrl-btns div g.icon use {
+    fill: #ddd;
+}
+.dark .ctrl-btns div g.icon use {
+    fill: #333;
+}
+
+/* Active hover */
+.light .ctrl-btns div.active:hover g.icon rect {
+    fill: #800;
+}
+
+.dark .ctrl-btns div.active:hover g.icon rect {
+    fill: #CE5650;
+}
+
+/* Active */
+.light .ctrl-btns div.active g.icon use {
+    fill: #fff;
+}
+.dark .ctrl-btns div.active g.icon use {
+    fill: #eee;
+}
+
+.light .ctrl-btns div.active g.icon rect {
+    fill: #bbb;
+}
+.dark .ctrl-btns div.active g.icon rect {
+    fill: #444;
+}
+
+/* Refresh button specific */
+.light .ctrl-btns div.refresh:hover g.icon rect {
+    fill: #800;
+}
+
+.dark .ctrl-btns div.refresh:hover g.icon rect {
+    fill: #CE5650;
+}
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 84f11b7..3af8d60 100644
--- a/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js
+++ b/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js
@@ -48,6 +48,7 @@
 
         o.scope.tableData = [];
         o.scope.sortParams = {};
+        o.scope.autoRefresh = true;
 
         function respCb(data) {
             o.scope.tableData = data[root];
@@ -66,11 +67,25 @@
         }
         o.scope.selectCallback = selCb;
 
-        function refresh(params) {
-            $log.debug('Refreshing ' + root + ' page');
-            sortCb(params);
+        function startRefresh() {
+            promise = $interval(function () {
+                $log.debug('Refreshing ' + root + ' page');
+                sortCb(o.scope.sortParams);
+            }, refreshInterval);
         }
-        o.scope.refresh = refresh;
+
+        function stopRefresh() {
+            if (angular.isDefined(promise)) {
+                $interval.cancel(promise);
+                promise = undefined;
+            }
+        }
+
+        function toggleRefresh() {
+            o.scope.autoRefresh = !o.scope.autoRefresh;
+            o.scope.autoRefresh ? startRefresh() : stopRefresh();
+        }
+        o.scope.toggleRefresh = toggleRefresh;
 
         handlers[resp] = respCb;
         wss.bindHandlers(handlers);
@@ -79,17 +94,11 @@
         o.scope.$on('$destroy', function () {
             wss.unbindHandlers(handlers);
             ts.resetSort();
-            if (angular.isDefined(promise)) {
-                $interval.cancel(promise);
-                promise = undefined;
-            }
+            stopRefresh();
         });
 
         sortCb();
-
-        promise = $interval(function () {
-            refresh(o.scope.sortParams);
-        }, refreshInterval);
+        startRefresh();
     }
 
     angular.module('onosWidget')