ONOS-1934 - CORD-GUI -- Basic dashboard page created: gets data and displays it in tables. Icon support and navigation bar added.
Change-Id: I68f2f180f11f958fa0f49411b03d101204662d79
diff --git a/apps/demo/cord-gui/src/main/webapp/app/view/home/home.css b/apps/demo/cord-gui/src/main/webapp/app/view/home/home.css
new file mode 100644
index 0000000..43473e6
--- /dev/null
+++ b/apps/demo/cord-gui/src/main/webapp/app/view/home/home.css
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+div#db-bundle, div#db-users {
+ float: left;
+}
+
+svg.embedded-icon g.icon rect {
+ fill: none;
+}
+
+svg.embedded-icon g.icon .glyph.checkMark {
+ fill: #3eff7d;
+}
+svg.embedded-icon g.icon .glyph.xMark {
+ fill: #a81c22;
+}
diff --git a/apps/demo/cord-gui/src/main/webapp/app/view/home/home.html b/apps/demo/cord-gui/src/main/webapp/app/view/home/home.html
index b535e50..f3b2598 100644
--- a/apps/demo/cord-gui/src/main/webapp/app/view/home/home.html
+++ b/apps/demo/cord-gui/src/main/webapp/app/view/home/home.html
@@ -1,27 +1,57 @@
-<!DOCTYPE html>
-<!--
- ~ 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.
- -->
+<!-- Home page partial html -->
+<div class="container">
+ <nav></nav>
+ <h2>Dashboard</h2>
+ <div id="db-bundle">
+ <table class="title">
+ <tr>
+ <th>{{bundle.name}}</th>
+ </tr>
+ </table>
+ <table class="content">
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Name</th>
+ <th>Active</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat="func in bundle.functions">
+ <td>{{func.id}}</td>
+ <td>{{func.name}}</td>
+ <td ng-if="func.active">
+ <icon size="20" id="checkMark"></icon>
+ </td>
+ <td ng-if="!func.active">
+ <icon size="20" id="xMark"></icon>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
-<html>
-<head lang="en">
- <meta charset="UTF-8">
- <title></title>
-</head>
-<body>
-<h2>Dashboard</h2>
-
-</body>
-</html>
\ No newline at end of file
+ <div id="db-users">
+ <table class="title">
+ <tr>
+ <th>Users</th>
+ </tr>
+ </table>
+ <table class="content">
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>Name</th>
+ <th>Role</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat="user in users">
+ <td>{{user.id}}</td>
+ <td>{{user.name}}</td>
+ <td>{{user.role}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
diff --git a/apps/demo/cord-gui/src/main/webapp/app/view/home/home.js b/apps/demo/cord-gui/src/main/webapp/app/view/home/home.js
index ed4e5a2..b4b8a0d 100644
--- a/apps/demo/cord-gui/src/main/webapp/app/view/home/home.js
+++ b/apps/demo/cord-gui/src/main/webapp/app/view/home/home.js
@@ -17,8 +17,28 @@
(function () {
'use strict';
+ var before = 'http://localhost:8080/rs/dashboard/0',
+ after = 'http://localhost:8080/rs/dashboard/1';
+
angular.module('cordHome', [])
- .controller('CordHomeCtrl', ['$log', function ($log) {
- $log.debug('Cord Home Ctrl has been created.');
+ .controller('CordHomeCtrl', ['$log', '$scope', '$resource',
+ function ($log, $scope, $resource) {
+ var DashboardData, resource;
+ $scope.page = 'dashboard';
+
+ DashboardData = $resource(before);
+ resource = DashboardData.get({},
+ // success
+ function () {
+ $scope.bundle = resource.bundle;
+ $scope.users = resource.users;
+ },
+ // error
+ function () {
+ $log.error('Problem with resource', resource);
+ });
+ $log.debug('Resource received:', resource);
+
+ $log.debug('Cord Home Ctrl has been created.');
}]);
}());