ONOS-2202 - GUI -- Moved flow, port, and group navigation buttons out of device details panel. Created tab-like behavior to switch between the three views when viewing any of them.

Change-Id: Ibc4291689e913a3537bd621e8e579f5e198ae5f2
diff --git a/web/gui/src/main/webapp/app/fw/svg/icon.js b/web/gui/src/main/webapp/app/fw/svg/icon.js
index 6f9421f..164fc4c 100644
--- a/web/gui/src/main/webapp/app/fw/svg/icon.js
+++ b/web/gui/src/main/webapp/app/fw/svg/icon.js
@@ -47,6 +47,9 @@
 
         devIcon_SWITCH: 'switch',
         devIcon_ROADM: 'roadm',
+        flowTable: 'flowTable',
+        portTable: 'portTable',
+        groupTable: 'groupTable',
 
         hostIcon_endstation: 'endstation',
         hostIcon_router: 'router',
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 36ad139..e1dc708 100644
--- a/web/gui/src/main/webapp/app/fw/widget/table.css
+++ b/web/gui/src/main/webapp/app/fw/widget/table.css
@@ -115,6 +115,12 @@
     cursor: pointer;
 }
 
+div.ctrl-btns div.separator  {
+    cursor: auto;
+    width: 24px;
+    border: none;
+}
+
 /* Inactive */
 .light .ctrl-btns div g.icon rect,
 .light .ctrl-btns div:hover g.icon rect {
diff --git a/web/gui/src/main/webapp/app/view/app/app.css b/web/gui/src/main/webapp/app/view/app/app.css
index 2b84e83..9413369 100644
--- a/web/gui/src/main/webapp/app/view/app/app.css
+++ b/web/gui/src/main/webapp/app/view/app/app.css
@@ -26,12 +26,6 @@
     width: 290px;
 }
 
-#ov-app div.ctrl-btns div.separator  {
-    cursor: auto;
-    width: 24px;
-    border: none;
-}
-
 #ov-app form#inputFileForm,
 #ov-app input#uploadFile {
     display: none;
diff --git a/web/gui/src/main/webapp/app/view/device/device.css b/web/gui/src/main/webapp/app/view/device/device.css
index fd1ddd0..e4a30b1 100644
--- a/web/gui/src/main/webapp/app/view/device/device.css
+++ b/web/gui/src/main/webapp/app/view/device/device.css
@@ -23,7 +23,7 @@
 }
 
 #ov-device div.ctrl-btns {
-    width: 45px;
+    width: 240px;
 }
 
 /* More in generic panel.css */
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 564d6c4..4a63519 100644
--- a/web/gui/src/main/webapp/app/view/device/device.html
+++ b/web/gui/src/main/webapp/app/view/device/device.html
@@ -4,8 +4,21 @@
         <h2>Devices ({{tableData.length}} total)</h2>
         <div class="ctrl-btns">
             <div class="refresh" ng-class="{active: autoRefresh}"
-                 icon icon-size="36" icon-id="refresh"
+                 icon icon-id="refresh" icon-size="36"
                  ng-click="toggleRefresh()"></div>
+            <div class="separator"></div>
+
+            <div ng-class="{active: !!selId}"
+                 icon icon-id="flowTable" icon-size="36"
+                 ng-click="nav('flow')"></div>
+
+            <div ng-class="{active: !!selId}"
+                 icon icon-id="portTable" icon-size="36"
+                 ng-click="nav('port')"></div>
+
+            <div ng-class="{active: !!selId}"
+                 icon icon-id="groupTable" icon-size="36"
+                 ng-click="nav('group')"></div>
         </div>
     </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 4178653..baf1e96 100644
--- a/web/gui/src/main/webapp/app/view/device/device.js
+++ b/web/gui/src/main/webapp/app/view/device/device.js
@@ -22,7 +22,7 @@
     'use strict';
 
     // injected refs
-    var $log, $scope, fs, mast, ps, wss, is, bns, ns, ttip;
+    var $log, $scope, fs, mast, ps, wss, is, ns;
 
     // internal state
     var detailsPanel,
@@ -35,12 +35,8 @@
         ctnrPdg = 24,
         scrollSize = 17,
         portsTblPdg = 50,
-        flowPath = 'flow',
-        portPath = 'port',
-        groupPath = 'group',
 
         pName = 'device-details-panel',
-        bName = 'dev-dets-p',
         detailsReq = 'deviceDetailsRequest',
         detailsResp = 'deviceDetailsResponse',
 
@@ -85,7 +81,6 @@
         tblDiv.append('div').classed('left', true).append('table');
         tblDiv.append('div').classed('right', true).append('table');
 
-        top.append('div').classed('actionBtns', true);
         top.append('hr');
 
         bottom = container.append('div').classed('bottom', true);
@@ -103,7 +98,7 @@
         addCell('value', value);
     }
 
-    function populateTop(tblDiv, btnsDiv, details) {
+    function populateTop(tblDiv, details) {
         var leftTbl = tblDiv.select('.left')
                         .select('table')
                         .append('tbody'),
@@ -118,34 +113,6 @@
             // properties are split into two tables
             addProp(i < 3 ? leftTbl : rightTbl, i, details[prop]);
         });
-
-        bns.button(
-            btnsDiv,
-            bName + '-flows',
-            'flowTable',
-            function () {
-                ns.navTo(flowPath, { devId: details.id });
-            },
-            'Show flow view for this device'
-        );
-        bns.button(
-            btnsDiv,
-            bName + '-ports',
-            'portTable',
-            function () {
-                ns.navTo(portPath, { devId: details.id });
-            },
-            'Show port view for this device'
-        );
-        bns.button(
-            btnsDiv,
-            bName + '-groups',
-            'groupTable',
-            function () {
-                ns.navTo(groupPath, { devId: details.id });
-            },
-            'Show group view for this device'
-        );
     }
 
     function addPortRow(tbody, port) {
@@ -187,15 +154,14 @@
     }
 
     function populateDetails(details) {
-        var topTbs, btnsDiv, btmTbl, ports;
+        var topTbs, btmTbl, ports;
         setUpPanel();
 
         topTbs = top.select('.top-tables');
-        btnsDiv = top.select('.actionBtns');
         btmTbl = bottom.select('table');
         ports = details.ports;
 
-        populateTop(topTbs, btnsDiv, details);
+        populateTop(topTbs, details);
         populateBottom(btmTbl, ports);
 
         detailsPanel.height(pHeight);
@@ -223,10 +189,10 @@
     .controller('OvDeviceCtrl',
         ['$log', '$scope', 'TableBuilderService', 'FnService',
             'MastService', 'PanelService', 'WebSocketService', 'IconService',
-            'ButtonService', 'NavService', 'TooltipService',
+            'NavService',
 
         function (_$log_, _$scope_,
-                  tbs, _fs_, _mast_, _ps_, _wss_, _is_, _bns_, _ns_, _ttip_) {
+                  tbs, _fs_, _mast_, _ps_, _wss_, _is_, _ns_) {
             $log = _$log_;
             $scope = _$scope_;
             fs = _fs_;
@@ -234,9 +200,7 @@
             ps = _ps_;
             wss = _wss_;
             is = _is_;
-            bns = _bns_;
             ns = _ns_;
-            ttip = _ttip_;
             var handlers = {};
             $scope.panelData = [];
 
@@ -260,6 +224,12 @@
             handlers[detailsResp] = respDetailsCb;
             wss.bindHandlers(handlers);
 
+            $scope.nav = function (path) {
+                if ($scope.selId) {
+                    ns.navTo(path, { devId: $scope.selId });
+                }
+            };
+
             $scope.$on('$destroy', function () {
                 wss.unbindHandlers(handlers);
             });
@@ -293,7 +263,7 @@
                         return {
                             h: $window.innerHeight,
                             w: $window.innerWidth
-                        }
+                        };
                     }, function () {
                         if (!fs.isEmptyObject(scope.panelData)) {
                             heightCalc();
diff --git a/web/gui/src/main/webapp/app/view/flow/flow.css b/web/gui/src/main/webapp/app/view/flow/flow.css
index b1fe49d..9aadffa 100644
--- a/web/gui/src/main/webapp/app/view/flow/flow.css
+++ b/web/gui/src/main/webapp/app/view/flow/flow.css
@@ -23,7 +23,21 @@
 }
 
 #ov-flow div.ctrl-btns {
-    width: 45px;
+    width: 240px;
+}
+
+.light #ov-flow .current-view use {
+    fill: white;
+}
+.dark #ov-flow .current-view use {
+    fill: #304860;
+}
+
+.light #ov-flow .current-view rect {
+    fill: deepskyblue;
+}
+.dark #ov-flow .current-view rect {
+    fill: #eee;
 }
 
 .light #ov-flow tr:nth-child(6n + 1),
diff --git a/web/gui/src/main/webapp/app/view/flow/flow.html b/web/gui/src/main/webapp/app/view/flow/flow.html
index 38059cd..da22520 100644
--- a/web/gui/src/main/webapp/app/view/flow/flow.html
+++ b/web/gui/src/main/webapp/app/view/flow/flow.html
@@ -9,6 +9,19 @@
             <div class="refresh" ng-class="{active: autoRefresh}"
                  icon icon-size="36" icon-id="refresh"
                  ng-click="toggleRefresh()"></div>
+
+            <div class="separator"></div>
+
+            <div class="current-view"
+                 icon icon-id="flowTable" icon-size="36"></div>
+
+            <div class="active"
+                 icon icon-id="portTable" icon-size="36"
+                 ng-click="nav('port')"></div>
+
+            <div class="active"
+                 icon icon-id="groupTable" icon-size="36"
+                 ng-click="nav('group')"></div>
         </div>
     </div>
 
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 8ee39d5..b9ef0fb 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,21 @@
     'use strict';
 
     // injected references
-    var $log, $scope, $location, fs, tbs;
+    var $log, $scope, $location, fs, tbs, ns;
 
     angular.module('ovFlow', [])
     .controller('OvFlowCtrl',
         ['$log', '$scope', '$location',
-            'FnService', 'TableBuilderService',
+            'FnService', 'TableBuilderService', 'NavService',
 
-        function (_$log_, _$scope_, _$location_, _fs_, _tbs_) {
+        function (_$log_, _$scope_, _$location_, _fs_, _tbs_, _ns_) {
             var params;
             $log = _$log_;
             $scope = _$scope_;
             $location = _$location_;
             fs = _fs_;
             tbs = _tbs_;
+            ns = _ns_;
 
             params = $location.search();
             if (params.hasOwnProperty('devId')) {
@@ -48,6 +49,12 @@
                 query: params
             });
 
+            $scope.nav = function (path) {
+                if ($scope.devId) {
+                    ns.navTo(path, { devId: $scope.devId });
+                }
+            };
+
             $log.log('OvFlowCtrl has been created');
         }]);
 }());
diff --git a/web/gui/src/main/webapp/app/view/group/group.css b/web/gui/src/main/webapp/app/view/group/group.css
index 182f44c..cf6b9af 100644
--- a/web/gui/src/main/webapp/app/view/group/group.css
+++ b/web/gui/src/main/webapp/app/view/group/group.css
@@ -23,7 +23,21 @@
 }
 
 #ov-group div.ctrl-btns {
-    width: 45px;
+    width: 240px;
+}
+
+.light #ov-group .current-view use {
+    fill: white;
+}
+.dark #ov-group .current-view use {
+    fill: #304860;
+}
+
+.light #ov-group .current-view rect {
+    fill: deepskyblue;
+}
+.dark #ov-group .current-view rect {
+    fill: #eee;
 }
 
 .light #ov-group tr:nth-child(4n + 1),
diff --git a/web/gui/src/main/webapp/app/view/group/group.html b/web/gui/src/main/webapp/app/view/group/group.html
index a2b38e0..2b09b94 100644
--- a/web/gui/src/main/webapp/app/view/group/group.html
+++ b/web/gui/src/main/webapp/app/view/group/group.html
@@ -25,6 +25,19 @@
             <div class="refresh" ng-class="{active: autoRefresh}"
                  icon icon-size="36" icon-id="refresh"
                  ng-click="toggleRefresh()"></div>
+
+            <div class="separator"></div>
+
+            <div class="active"
+                 icon icon-id="flowTable" icon-size="36"
+                 ng-click="nav('flow')"></div>
+
+            <div class="active"
+                 icon icon-id="portTable" icon-size="36"
+                 ng-click="nav('port')"></div>
+
+            <div class="current-view"
+                 icon icon-id="groupTable" icon-size="36"></div>
         </div>
     </div>
 
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 64b6861..b8f4d45 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,21 @@
     'use strict';
 
     // injected references
-    var $log, $scope, $location, fs, tbs;
+    var $log, $scope, $location, fs, tbs, ns;
 
     angular.module('ovGroup', [])
     .controller('OvGroupCtrl',
         ['$log', '$scope', '$location', '$sce',
-            'FnService', 'TableBuilderService',
+            'FnService', 'TableBuilderService', 'NavService',
 
-        function (_$log_, _$scope_, _$location_, $sce, _fs_, _tbs_) {
+        function (_$log_, _$scope_, _$location_, $sce, _fs_, _tbs_, _ns_) {
             var params;
             $log = _$log_;
             $scope = _$scope_;
             $location = _$location_;
             fs = _fs_;
             tbs = _tbs_;
+            ns = _ns_;
 
             params = $location.search();
             if (params.hasOwnProperty('devId')) {
@@ -56,6 +57,12 @@
                 }
             });
 
+            $scope.nav = function (path) {
+                if ($scope.devId) {
+                    ns.navTo(path, { devId: $scope.devId });
+                }
+            };
+
             $log.log('OvGroupCtrl has been created');
         }]);
 }());
diff --git a/web/gui/src/main/webapp/app/view/port/port.css b/web/gui/src/main/webapp/app/view/port/port.css
index 860f879..6639539 100644
--- a/web/gui/src/main/webapp/app/view/port/port.css
+++ b/web/gui/src/main/webapp/app/view/port/port.css
@@ -23,9 +23,23 @@
 }
 
 #ov-port div.ctrl-btns {
-    width: 45px;
+    width: 240px;
 }
 
-#ov-port tr:not(.no-data) td {
+.light #ov-port .current-view use {
+    fill: white;
+}
+.dark #ov-port .current-view use {
+    fill: #304860;
+}
+
+.light #ov-port .current-view rect {
+    fill: deepskyblue;
+}
+.dark #ov-port .current-view rect {
+    fill: #eee;
+}
+
+#ov-port td {
     text-align: right;
 }
\ No newline at end of file
diff --git a/web/gui/src/main/webapp/app/view/port/port.html b/web/gui/src/main/webapp/app/view/port/port.html
index 5e48cbf..326aebb 100644
--- a/web/gui/src/main/webapp/app/view/port/port.html
+++ b/web/gui/src/main/webapp/app/view/port/port.html
@@ -25,6 +25,19 @@
             <div class="refresh" ng-class="{active: autoRefresh}"
                  icon icon-size="36" icon-id="refresh"
                  ng-click="toggleRefresh()"></div>
+
+            <div class="separator"></div>
+
+            <div class="active"
+                 icon icon-id="flowTable" icon-size="36"
+                 ng-click="nav('flow')"></div>
+
+            <div class="current-view"
+                 icon icon-id="portTable" icon-size="36"></div>
+
+            <div class="active"
+                 icon icon-id="groupTable" icon-size="36"
+                 ng-click="nav('group')"></div>
         </div>
     </div>
 
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 b596ef5..9cb8a04 100644
--- a/web/gui/src/main/webapp/app/view/port/port.js
+++ b/web/gui/src/main/webapp/app/view/port/port.js
@@ -22,19 +22,21 @@
     'use strict';
 
     // injected references
-    var $log, $scope, $location, fs, tbs;
+    var $log, $scope, $location, fs, tbs, ns;
 
     angular.module('ovPort', [])
     .controller('OvPortCtrl',
-        ['$log', '$scope', '$location', 'FnService', 'TableBuilderService',
+        ['$log', '$scope', '$location',
+            'FnService', 'TableBuilderService', 'NavService',
 
-        function (_$log_, _$scope_, _$location_, _fs_, _tbs_) {
+        function (_$log_, _$scope_, _$location_, _fs_, _tbs_, _ns_) {
             var params;
             $log = _$log_;
             $scope = _$scope_;
             $location = _$location_;
             fs = _fs_;
             tbs = _tbs_;
+            ns = _ns_;
 
             params = $location.search();
             if (params.hasOwnProperty('devId')) {
@@ -47,6 +49,12 @@
                 query: params
             });
 
+            $scope.nav = function (path) {
+                if ($scope.devId) {
+                    ns.navTo(path, { devId: $scope.devId });
+                }
+            };
+
             $log.log('OvPortCtrl has been created');
         }]);
 }());
diff --git a/web/gui/src/main/webapp/onos.js b/web/gui/src/main/webapp/onos.js
index 01e910d..8c7a557 100644
--- a/web/gui/src/main/webapp/onos.js
+++ b/web/gui/src/main/webapp/onos.js
@@ -81,7 +81,7 @@
                 self.$route = $route;
                 self.$routeParams = $routeParams;
                 self.$location = $location;
-                self.version = '1.2.0';
+                self.version = '1.3.0';
 
                 // initialize services...
                 ts.init();