Bri Prebilic Cole
Committed by Gerrit Code Review

ONOS-1938 - CORD-GUI -- Added animation to bundle page, started work on User page. WIP.

Change-Id: I1395b60c8e19f19b74406bbec90386e902401433
...@@ -49,6 +49,12 @@ div#bundle div.main-right { ...@@ -49,6 +49,12 @@ div#bundle div.main-right {
49 text-align: left; 49 text-align: left;
50 font-style: italic; 50 font-style: italic;
51 } 51 }
52 +/* animation specific */
53 +#bundle tr.fadein.ng-leave td.name,
54 +#bundle tr.fadein.ng-leave-active td.name {
55 + opacity: 0;
56 + border: none;
57 +}
52 58
53 #bundle h2 { 59 #bundle h2 {
54 text-align: center; 60 text-align: center;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
6 <h3>{{name}}</h3> 6 <h3>{{name}}</h3>
7 <p>{{desc}}</p> 7 <p>{{desc}}</p>
8 <table> 8 <table>
9 - <tr ng-repeat="func in funcs"> 9 + <tr ng-repeat="func in funcs" class="fadein">
10 <td class="icon">icon of function</td> 10 <td class="icon">icon of function</td>
11 <td class="name">{{func.name}}</td> 11 <td class="name">{{func.name}}</td>
12 <td class="desc">{{func.desc}}</td> 12 <td class="desc">{{func.desc}}</td>
......
...@@ -93,13 +93,18 @@ svg#icon-defs { ...@@ -93,13 +93,18 @@ svg#icon-defs {
93 .fadein { 93 .fadein {
94 transition: all linear 0.5s; 94 transition: all linear 0.5s;
95 } 95 }
96 -.fadein.ng-enter { 96 +.fadein.ng-enter-stagger,
97 - opacity: 0; 97 +.fadein.ng-leave-stagger {
98 -}
99 -.fadein.ng-enter-stagger {
100 transition-delay: 0.2s; 98 transition-delay: 0.2s;
101 animation-delay: 0.2s; 99 animation-delay: 0.2s;
102 } 100 }
101 +.fadein.ng-enter {
102 + opacity: 0;
103 +}
103 .fadein.ng-enter.ng-enter-active { 104 .fadein.ng-enter.ng-enter-active {
104 opacity: 1; 105 opacity: 1;
105 } 106 }
107 +.fadein.ng-leave,
108 +.fadein.ng-leave-active {
109 + opacity: 0;
110 +}
......
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 +
1 <!-- Users page partial html --> 1 <!-- Users page partial html -->
2 <div class="container"> 2 <div class="container">
3 <nav></nav> 3 <nav></nav>
4 - <h2>Users</h2> 4 + <div id="user">
5 + <table>
6 + <tr>
7 + <th>Name</th>
8 + <th>Mac</th>
9 + <th ng-if="isFamily">URL Filtering</th>
10 + </tr>
11 + <tr ng-repeat="user in users" class="fadein">
12 + <td>{{user.name}}</td>
13 + <td>{{user.mac}}</td>
14 + <td ng-if="isFamily">
15 + <select ng-model="newLevels[user.id]"
16 + ng-options="l for l in levels">
17 + </select>
18 + <!--How to save the id of the user with what level they want
19 + for the submit button, and also have a default value?
20 + Look into forms or study ng-options syntax a bit more-->
21 + </td>
22 + </tr>
23 + </table>
24 + </div>
5 </div> 25 </div>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -17,12 +17,61 @@ ...@@ -17,12 +17,61 @@
17 (function () { 17 (function () {
18 'use strict'; 18 'use strict';
19 19
20 + var bundleUrl = 'http://localhost:8080/rs/bundle',
21 + userUrl = 'http://localhost:8080/rs/users',
22 + family = 'family',
23 + url_filter = 'url_filter';
24 +
20 angular.module('cordUser', []) 25 angular.module('cordUser', [])
21 - .controller('CordUserCtrl', ['$log', '$scope', function ($log, $scope) { 26 + .controller('CordUserCtrl', ['$log', '$scope', '$resource',
22 - $scope.page = 'user'; 27 + function ($log, $scope, $resource) {
28 + var BundleData, bundleResource, UserData, userResource;
29 + $scope.page = 'user';
30 + $scope.isFamily = false;
31 + $scope.newLevels = {};
32 +
33 + BundleData = $resource(bundleUrl);
34 + bundleResource = BundleData.get({},
35 + // success
36 + function () {
37 + var result;
38 + $scope.isFamily = (bundleResource.bundle.id === family);
39 + if ($scope.isFamily) {
40 + result = $.grep(
41 + bundleResource.bundle.functions,
42 + function (elem) {
43 + if (elem.id === url_filter) { return true; }
44 + }
45 + );
46 + $scope.levels = result[0].params.levels;
47 + }
48 + },
49 + // error
50 + function () {
51 + $log.error('Problem with resource', bundleResource);
52 + }
53 + );
54 +
55 + UserData = $resource(userUrl);
56 + userResource = UserData.get({},
57 + // success
58 + function () {
59 + $scope.users = userResource.users;
60 + },
61 + // error
62 + function () {
63 + $log.error('Problem with resource', userResource);
64 + }
65 + );
23 66
24 $log.debug('Cord User Ctrl has been created.'); 67 $log.debug('Cord User Ctrl has been created.');
68 + }])
69 + .directive('editUser', [function () {
70 + return {
71 + link: function (scope, elem) {
72 +
73 + }
74 + };
25 }]); 75 }]);
26 76
27 - // can have a directive here that uses templateUrl for editable and readonly
28 }()); 77 }());
......