Bri Prebilic Cole
Committed by Gerrit Code Review

ONOS-1934 - CORD-GUI -- Basic dashboard page created: gets data and displays it …

…in tables. Icon support and navigation bar added.

Change-Id: I68f2f180f11f958fa0f49411b03d101204662d79
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +(function () {
18 + 'use strict';
19 +
20 + angular.module('cordGui')
21 +
22 + .directive('icon', [function () {
23 + return {
24 + restrict: 'E',
25 + compile: function (element, attrs) {
26 + var html =
27 + '<svg class="embedded-icon" width="' + attrs.size + '" ' +
28 + 'height="' + attrs.size + '" viewBox="0 0 50 50">' +
29 + '<g class="icon">' +
30 + '<rect width="50" height="50"></rect>' +
31 + '<use width="50" height="50" class="glyph '
32 + + attrs.id + '" xlink:href="#' + attrs.id +
33 + '"></use>' +
34 + '</g>' +
35 + '</svg>';
36 + element.replaceWith(html);
37 + }
38 + };
39 + }]);
40 +}());
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
18 18
19 <div class="mast"> 19 <div class="mast">
20 <div class="left"> 20 <div class="left">
21 - <h1>CORD</h1> 21 + <a href="#/home" class="logo"><h1>CORD</h1></a>
22 </div> 22 </div>
23 23
24 <div class="right"> 24 <div class="right">
......
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +.nav ul {
18 + list-style-type: none;
19 + width: 100%;
20 +}
21 +
22 +.nav li {
23 + display: inline;
24 +}
1 +<!--
2 + ~ Copyright 2015 Open Networking Laboratory
3 + ~
4 + ~ Licensed under the Apache License, Version 2.0 (the "License");
5 + ~ you may not use this file except in compliance with the License.
6 + ~ You may obtain a copy of the License at
7 + ~
8 + ~ http://www.apache.org/licenses/LICENSE-2.0
9 + ~
10 + ~ Unless required by applicable law or agreed to in writing, software
11 + ~ distributed under the License is distributed on an "AS IS" BASIS,
12 + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + ~ See the License for the specific language governing permissions and
14 + ~ limitations under the License.
15 + -->
16 +
17 +<div class="nav">
18 + <ul>
19 + <a href="#/home">
20 + <li ng-class="{selected: page === 'dashboard'}">Dashboard</li>
21 + </a>
22 + <a href="#/user">
23 + <li ng-class="{selected: page === 'user'}">Users</li>
24 + </a>
25 + <a href="#/bundle">
26 + <li ng-class="{selected: page === 'bundle'}">Bundles</li>
27 + </a>
28 + </ul>
29 +</div>
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +angular.module('cordNav', [])
18 + .directive('nav', function () {
19 + return {
20 + restrict: 'E',
21 + templateUrl: 'app/fw/nav/nav.html'
22 + };
23 + });
1 -<!DOCTYPE html>
2 -<!--
3 - ~ Copyright 2015 Open Networking Laboratory
4 - ~
5 - ~ Licensed under the Apache License, Version 2.0 (the "License");
6 - ~ you may not use this file except in compliance with the License.
7 - ~ You may obtain a copy of the License at
8 - ~
9 - ~ http://www.apache.org/licenses/LICENSE-2.0
10 - ~
11 - ~ Unless required by applicable law or agreed to in writing, software
12 - ~ distributed under the License is distributed on an "AS IS" BASIS,
13 - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 - ~ See the License for the specific language governing permissions and
15 - ~ limitations under the License.
16 - -->
17 -
18 -<html>
19 -<head lang="en">
20 - <meta charset="UTF-8">
21 - <title></title>
22 -</head>
23 -<body>
24 -<h2>Subscriber Bundle</h2>
25 -
26 -</body>
27 -</html>
...\ No newline at end of file ...\ No newline at end of file
1 +<!-- Bundle page partial html -->
2 +<div class="container">
3 + <nav></nav>
4 + <h2>Subscriber Bundles</h2>
5 +</div>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -18,7 +18,10 @@ ...@@ -18,7 +18,10 @@
18 'use strict'; 18 'use strict';
19 19
20 angular.module('cordBundle', []) 20 angular.module('cordBundle', [])
21 - .controller('CordBundleCtrl', ['$log', function ($log) { 21 + .controller('CordBundleCtrl', ['$log', '$scope',
22 + function ($log, $scope) {
23 + $scope.page = 'bundle';
24 +
22 $log.debug('Cord Bundle Ctrl has been created.'); 25 $log.debug('Cord Bundle Ctrl has been created.');
23 }]); 26 }]);
24 27
......
...@@ -14,15 +14,28 @@ ...@@ -14,15 +14,28 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17 -head, body, footer, h1, h2, h3, h4, h5, h6, p, div, a { 17 +head, body, footer,
18 +h1, h2, h3, h4, h5, h6, p,
19 +a, ul, li, div,
20 +table, tr, td, th, thead, tbody {
18 padding: 0; 21 padding: 0;
19 margin: 0; 22 margin: 0;
20 } 23 }
21 24
22 -h1, h2, h3, h4, h5, h6, p, a { 25 +h1, h2, h3, h4, h5, h6,
26 +p, a, li, th, td {
23 font-family: "Lucida Grande", "Droid Sans", Arial, Helvetica, sans-serif; 27 font-family: "Lucida Grande", "Droid Sans", Arial, Helvetica, sans-serif;
24 } 28 }
25 29
26 #view h2 { 30 #view h2 {
27 text-align: center; 31 text-align: center;
28 } 32 }
33 +
34 +#view div.container {
35 + width: 960px;
36 + margin: 0 auto;
37 +}
38 +
39 +svg#icon-defs {
40 + display: none;
41 +}
......
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +div#db-bundle, div#db-users {
18 + float: left;
19 +}
20 +
21 +svg.embedded-icon g.icon rect {
22 + fill: none;
23 +}
24 +
25 +svg.embedded-icon g.icon .glyph.checkMark {
26 + fill: #3eff7d;
27 +}
28 +svg.embedded-icon g.icon .glyph.xMark {
29 + fill: #a81c22;
30 +}
1 -<!DOCTYPE html> 1 +<!-- Home page partial html -->
2 -<!-- 2 +<div class="container">
3 - ~ Copyright 2015 Open Networking Laboratory 3 + <nav></nav>
4 - ~ 4 + <h2>Dashboard</h2>
5 - ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 + <div id="db-bundle">
6 - ~ you may not use this file except in compliance with the License. 6 + <table class="title">
7 - ~ You may obtain a copy of the License at 7 + <tr>
8 - ~ 8 + <th>{{bundle.name}}</th>
9 - ~ http://www.apache.org/licenses/LICENSE-2.0 9 + </tr>
10 - ~ 10 + </table>
11 - ~ Unless required by applicable law or agreed to in writing, software 11 + <table class="content">
12 - ~ distributed under the License is distributed on an "AS IS" BASIS, 12 + <thead>
13 - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 + <tr>
14 - ~ See the License for the specific language governing permissions and 14 + <th>ID</th>
15 - ~ limitations under the License. 15 + <th>Name</th>
16 - --> 16 + <th>Active</th>
17 + </tr>
18 + </thead>
19 + <tbody>
20 + <tr ng-repeat="func in bundle.functions">
21 + <td>{{func.id}}</td>
22 + <td>{{func.name}}</td>
23 + <td ng-if="func.active">
24 + <icon size="20" id="checkMark"></icon>
25 + </td>
26 + <td ng-if="!func.active">
27 + <icon size="20" id="xMark"></icon>
28 + </td>
29 + </tr>
30 + </tbody>
31 + </table>
32 + </div>
17 33
18 -<html>
19 -<head lang="en">
20 - <meta charset="UTF-8">
21 - <title></title>
22 -</head>
23 -<body>
24 -<h2>Dashboard</h2>
25 -
26 -</body>
27 -</html>
...\ No newline at end of file ...\ No newline at end of file
34 + <div id="db-users">
35 + <table class="title">
36 + <tr>
37 + <th>Users</th>
38 + </tr>
39 + </table>
40 + <table class="content">
41 + <thead>
42 + <tr>
43 + <th>ID</th>
44 + <th>Name</th>
45 + <th>Role</th>
46 + </tr>
47 + </thead>
48 + <tbody>
49 + <tr ng-repeat="user in users">
50 + <td>{{user.id}}</td>
51 + <td>{{user.name}}</td>
52 + <td>{{user.role}}</td>
53 + </tr>
54 + </tbody>
55 + </table>
56 + </div>
57 +</div>
......
...@@ -17,8 +17,28 @@ ...@@ -17,8 +17,28 @@
17 (function () { 17 (function () {
18 'use strict'; 18 'use strict';
19 19
20 + var before = 'http://localhost:8080/rs/dashboard/0',
21 + after = 'http://localhost:8080/rs/dashboard/1';
22 +
20 angular.module('cordHome', []) 23 angular.module('cordHome', [])
21 - .controller('CordHomeCtrl', ['$log', function ($log) { 24 + .controller('CordHomeCtrl', ['$log', '$scope', '$resource',
25 + function ($log, $scope, $resource) {
26 + var DashboardData, resource;
27 + $scope.page = 'dashboard';
28 +
29 + DashboardData = $resource(before);
30 + resource = DashboardData.get({},
31 + // success
32 + function () {
33 + $scope.bundle = resource.bundle;
34 + $scope.users = resource.users;
35 + },
36 + // error
37 + function () {
38 + $log.error('Problem with resource', resource);
39 + });
40 + $log.debug('Resource received:', resource);
41 +
22 $log.debug('Cord Home Ctrl has been created.'); 42 $log.debug('Cord Home Ctrl has been created.');
23 }]); 43 }]);
24 }()); 44 }());
......
1 -<!DOCTYPE html> 1 +<!-- Login page partial html -->
2 -<!--
3 - ~ Copyright 2015 Open Networking Laboratory
4 - ~
5 - ~ Licensed under the Apache License, Version 2.0 (the "License");
6 - ~ you may not use this file except in compliance with the License.
7 - ~ You may obtain a copy of the License at
8 - ~
9 - ~ http://www.apache.org/licenses/LICENSE-2.0
10 - ~
11 - ~ Unless required by applicable law or agreed to in writing, software
12 - ~ distributed under the License is distributed on an "AS IS" BASIS,
13 - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 - ~ See the License for the specific language governing permissions and
15 - ~ limitations under the License.
16 - -->
17 -
18 -<html>
19 -<head lang="en">
20 - <meta charset="UTF-8">
21 - <title></title>
22 -</head>
23 -<body>
24 <div id="login-header"> 2 <div id="login-header">
25 <h2>Login to Subscriber Portal</h2> 3 <h2>Login to Subscriber Portal</h2>
26 </div> 4 </div>
...@@ -34,6 +12,3 @@ ...@@ -34,6 +12,3 @@
34 <a href="#/home"><input type="submit" value="Submit"></a> 12 <a href="#/home"><input type="submit" value="Submit"></a>
35 </form> 13 </form>
36 </div> 14 </div>
...\ No newline at end of file ...\ No newline at end of file
37 -
38 -</body>
39 -</html>
...\ No newline at end of file ...\ No newline at end of file
......
1 -<!DOCTYPE html>
2 -<!--
3 - ~ Copyright 2015 Open Networking Laboratory
4 - ~
5 - ~ Licensed under the Apache License, Version 2.0 (the "License");
6 - ~ you may not use this file except in compliance with the License.
7 - ~ You may obtain a copy of the License at
8 - ~
9 - ~ http://www.apache.org/licenses/LICENSE-2.0
10 - ~
11 - ~ Unless required by applicable law or agreed to in writing, software
12 - ~ distributed under the License is distributed on an "AS IS" BASIS,
13 - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 - ~ See the License for the specific language governing permissions and
15 - ~ limitations under the License.
16 - -->
17 -
18 -<html>
19 -<head lang="en">
20 - <meta charset="UTF-8">
21 - <title></title>
22 -</head>
23 -<body>
24 -<h2>Users</h2>
25 -
26 -</body>
27 -</html>
...\ No newline at end of file ...\ No newline at end of file
1 +<!-- Users page partial html -->
2 +<div class="container">
3 + <nav></nav>
4 + <h2>Users</h2>
5 +</div>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -18,7 +18,9 @@ ...@@ -18,7 +18,9 @@
18 'use strict'; 18 'use strict';
19 19
20 angular.module('cordUser', []) 20 angular.module('cordUser', [])
21 - .controller('CordUserCtrl', ['$log', function ($log) { 21 + .controller('CordUserCtrl', ['$log', '$scope', function ($log, $scope) {
22 + $scope.page = 'user';
23 +
22 $log.debug('Cord User Ctrl has been created.'); 24 $log.debug('Cord User Ctrl has been created.');
23 }]); 25 }]);
24 26
......
...@@ -19,8 +19,10 @@ ...@@ -19,8 +19,10 @@
19 19
20 var modules = [ 20 var modules = [
21 'ngRoute', 21 'ngRoute',
22 + 'ngResource',
22 'cordMast', 23 'cordMast',
23 - 'cordFoot' 24 + 'cordFoot',
25 + 'cordNav'
24 ], 26 ],
25 viewIds = [ 27 viewIds = [
26 'login', 28 'login',
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
24 <script src="tp/angular.js"></script> 24 <script src="tp/angular.js"></script>
25 <script src="tp/angular-route.js"></script> 25 <script src="tp/angular-route.js"></script>
26 <script src="tp/angular-animate.js"></script> 26 <script src="tp/angular-animate.js"></script>
27 + <script src="tp/angular-resource.js"></script>
27 <script src="tp/jquery-2.1.4.js"></script> 28 <script src="tp/jquery-2.1.4.js"></script>
28 29
29 <script src="cord.js"></script> 30 <script src="cord.js"></script>
...@@ -34,10 +35,16 @@ ...@@ -34,10 +35,16 @@
34 <script src="app/fw/foot/foot.js"></script> 35 <script src="app/fw/foot/foot.js"></script>
35 <link rel="stylesheet" href="app/fw/foot/foot.css"> 36 <link rel="stylesheet" href="app/fw/foot/foot.css">
36 37
38 + <script src="app/fw/nav/nav.js"></script>
39 + <link rel="stylesheet" href="app/fw/nav/nav.css">
40 +
41 + <script src="app/fw/icon/icon.js"></script>
42 +
37 <script src="app/view/login/login.js"></script> 43 <script src="app/view/login/login.js"></script>
38 <link rel="stylesheet" href="app/view/login/login.css"> 44 <link rel="stylesheet" href="app/view/login/login.css">
39 45
40 <script src="app/view/home/home.js"></script> 46 <script src="app/view/home/home.js"></script>
47 + <link rel="stylesheet" href="app/view/home/home.css">
41 48
42 <script src="app/view/user/user.js"></script> 49 <script src="app/view/user/user.js"></script>
43 50
...@@ -50,5 +57,23 @@ ...@@ -50,5 +57,23 @@
50 <div id="view" ng-view></div> 57 <div id="view" ng-view></div>
51 <foot></foot> 58 <foot></foot>
52 59
60 +<svg id="icon-defs">
61 + <defs>
62 + <symbol id="checkMark" viewBox="0 0 10 10">
63 + <path d="M2.6,4.5c0,0,0.7-0.4,1.2,0.3l1.0,1.8c0,0,2.7-5.4,2.8-5.7c
64 + 0,0,0.5-0.9,1.4-0.1c0,0,0.5,0.5,0,1.3S6.8,7.3,5.6,9.2c0,0-0.4,0.5
65 + -1.2,0.1S2.2,5.4,2.2,5.4S2.2,4.7,2.6,4.5z"></path>
66 + </symbol>
67 + <symbol id="xMark" viewBox="0 0 10 10">
68 + <path d="M9.0,7.2C8.2,6.9,7.4,6.1,6.7,5.2c0.4-0.5,0.7-0.8,0.8-1.0C
69 + 7.8,3.5,9.4,1.6,8.1,1.1C6.8,0.6,6.6,1.7,6.6,1.7C6.4,2.1,6.0,2.7,
70 + 5.4,3.4C4.9,2.5,4.5,1.9,4.5,1.9S3.8,0.2,2.9,0.7C1.9,1.1,2.3,2.3,
71 + 2.3,2.3c0.3,1.1,0.8,2.1,1.4,2.9C2.5,6.4,1.3,7.4,1.3,7.4S0.8,7.8,
72 + 0.8,8.1C0.9,8.3,0.9,9.6,2.4,9.1C3.1,8.8,4.1,7.9,5.1,7.0c1.3,1.3,
73 + 2.5,1.9,2.5,1.9s0.5,0.5,1.4-0.2C9.8,7.9,9.0,7.2,9.0,7.2z"></path>
74 + </symbol>
75 + </defs>
76 +</svg>
77 +
53 </body> 78 </body>
54 </html> 79 </html>
......
This diff is collapsed. Click to expand it.