ONOS-1819 - GUI -- Group view added (WIP). Enum Cell Formatter created.

Change-Id: I6ade17a1dfd17cf2049bafe654d6411244d4ad07
diff --git a/web/gui/src/main/webapp/app/view/group/group.css b/web/gui/src/main/webapp/app/view/group/group.css
new file mode 100644
index 0000000..8553ddc
--- /dev/null
+++ b/web/gui/src/main/webapp/app/view/group/group.css
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ ONOS GUI -- Group View -- CSS file
+ */
+
+#ov-group h2 {
+    display: inline-block;
+}
+
+#ov-group div.ctrl-btns {
+    width: 45px;
+}
+
+.light #ov-group tr:nth-child(4n + 2),
+.light #ov-group tr:nth-child(4n + 3) {
+    background-color: #eee;
+}
+.light #ov-group tr:nth-child(4n + 4),
+.light #ov-group tr:nth-child(4n + 1) {
+    background-color: #ddd;
+}
+.dark #ov-group tr:nth-child(4n + 2),
+.dark #ov-group tr:nth-child(4n + 3) {
+    background-color: #444;
+}
+.dark #ov-group tr:nth-child(4n + 4),
+.dark #ov-group tr:nth-child(4n + 1) {
+    background-color: #333;
+}
+
+#ov-group td.buckets {
+    padding-left: 36px;
+    opacity: 0.65;
+}
diff --git a/web/gui/src/main/webapp/app/view/group/group.html b/web/gui/src/main/webapp/app/view/group/group.html
new file mode 100644
index 0000000..ad1e8a1
--- /dev/null
+++ b/web/gui/src/main/webapp/app/view/group/group.html
@@ -0,0 +1,72 @@
+<!--
+  ~ Copyright 2015 Open Networking Laboratory
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!-- Group partial HTML -->
+<div id="ov-group">
+    <div class="tabular-header">
+        <h2>
+            Groups for Device {{devId || "(No device selected)"}}
+            ({{tableData.length}} total)
+        </h2>
+        <div class="ctrl-btns">
+            <div class="refresh active"
+                 icon icon-size="36" icon-id="refresh"
+                 ng-click="refresh()"></div>
+        </div>
+    </div>
+
+    <div class="summary-list" onos-fixed-header>
+
+        <div class="table-header"
+             onos-sortable-header sort-callback="sortCallback(requestParams)">
+            <table>
+                <tr>
+                    <td colId="id" sortable>Group ID </td>
+                    <td colId="app_id" sortable>App ID </td>
+                    <td colId="state" sortable>State </td>
+                    <td colId="type" sortable>Type </td>
+                    <td colId="packets" sortable>Packets </td>
+                    <td colId="bytes" sortable>Bytes </td>
+                </tr>
+            </table>
+        </div>
+
+        <div class="table-body">
+            <table>
+                <tr ng-hide="tableData.length" class="no-data ignore-width">
+                    <td colspan="6">
+                        No Groups found
+                    </td>
+                </tr>
+
+                <tr ng-repeat-start="group in tableData">
+                    <td>{{group.id}}</td>
+                    <td>{{group.app_id}}</td>
+                    <td>{{group.state}}</td>
+                    <td>{{group.type}}</td>
+                    <td>{{group.packets}}</td>
+                    <td>{{group.bytes}}</td>
+                </tr>
+                <tr class="ignore-width"
+                    ng-repeat-end ng-repeat-done>
+                    <td class="buckets" colspan="6">{{group.buckets}}</td>
+                </tr>
+            </table>
+        </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
new file mode 100644
index 0000000..1602da1
--- /dev/null
+++ b/web/gui/src/main/webapp/app/view/group/group.js
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ ONOS GUI -- Group View Module
+ */
+
+(function () {
+    'use strict';
+
+    // injected references
+    var $log, $scope, $location, fs, ts, tbs;
+
+    angular.module('ovGroup', [])
+    .controller('OvGroupCtrl',
+        ['$log', '$scope', '$location',
+            'FnService', 'TableService', 'TableBuilderService',
+
+        function (_$log_, _$scope_, _$location_, _fs_, _ts_, _tbs_) {
+            var params;
+            $log = _$log_;
+            $scope = _$scope_;
+            $location = _$location_;
+            fs = _fs_;
+            ts = _ts_;
+            tbs = _tbs_;
+
+            params = $location.search();
+            if (params.hasOwnProperty('devId')) {
+                $scope.devId = params['devId'];
+            }
+
+            tbs.buildTable({
+                scope: $scope,
+                tag: 'group',
+                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/index.html b/web/gui/src/main/webapp/index.html
index caa8b26..7dd2f42 100644
--- a/web/gui/src/main/webapp/index.html
+++ b/web/gui/src/main/webapp/index.html
@@ -112,6 +112,7 @@
     <script src="app/view/device/device.js"></script>
     <script src="app/view/flow/flow.js"></script>
     <script src="app/view/port/port.js"></script>
+    <script src="app/view/group/group.js"></script>
     <script src="app/view/link/link.js"></script>
     <script src="app/view/host/host.js"></script>
     <script src="app/view/intent/intent.js"></script>
@@ -127,6 +128,7 @@
     <link rel="stylesheet" href="app/view/device/device.css">
     <link rel="stylesheet" href="app/view/flow/flow.css">
     <link rel="stylesheet" href="app/view/port/port.css">
+    <link rel="stylesheet" href="app/view/group/group.css">
     <link rel="stylesheet" href="app/view/link/link.css">
     <link rel="stylesheet" href="app/view/host/host.css">
     <link rel="stylesheet" href="app/view/intent/intent.css">
diff --git a/web/gui/src/main/webapp/onos.js b/web/gui/src/main/webapp/onos.js
index 3af48bc..d49d2c0 100644
--- a/web/gui/src/main/webapp/onos.js
+++ b/web/gui/src/main/webapp/onos.js
@@ -40,6 +40,7 @@
         'device',
         'flow',
         'port',
+        'group',
         'host',
         'app',
         'intent',