Bri Prebilic Cole

ONOS-1935 - CORD-GUI -- CSS for demo bundles page created, apply button switches…

… bundles user is subscribed to. WIP.

Change-Id: Iedc42682ea7d939a540a1c60ef1b61e26dab8fca
...@@ -26,6 +26,7 @@ div.foot { ...@@ -26,6 +26,7 @@ div.foot {
26 margin-right: auto; 26 margin-right: auto;
27 border-top-left-radius: 3px; 27 border-top-left-radius: 3px;
28 border-top-right-radius: 3px; 28 border-top-right-radius: 3px;
29 + z-index: 100;
29 } 30 }
30 31
31 .foot div { 32 .foot div {
......
1 <div id="available" ng-controller="CordAvailable as ctrl"> 1 <div id="available" ng-controller="CordAvailable as ctrl">
2 - <h2>{{available.name}}</h2> 2 + <h3>{{available.name}}</h3>
3 <p>{{available.desc}}</p> 3 <p>{{available.desc}}</p>
4 <button type="button">Apply</button> 4 <button type="button">Apply</button>
5 </div> 5 </div>
......
...@@ -19,24 +19,58 @@ div#bundle div.main-left { ...@@ -19,24 +19,58 @@ div#bundle div.main-left {
19 } 19 }
20 div#bundle div.main-right { 20 div#bundle div.main-right {
21 width: 38%; 21 width: 38%;
22 + height: 85vh;
23 + background-color: rgba(173, 216, 230, 0.25);
24 + border-radius: 5px;
22 } 25 }
23 26
24 #bundle table { 27 #bundle table {
25 - width: 100%; 28 + width: 95%;
29 + margin-top: 5%;
30 + margin-left: 2%;
31 + border-radius: 3px;
26 } 32 }
27 33
28 #bundle td { 34 #bundle td {
29 - text-align: center; 35 + font-size: 90%;
30 } 36 }
31 #bundle td.icon { 37 #bundle td.icon {
38 + text-align: center;
32 width: 50px; 39 width: 50px;
33 height: 50px; 40 height: 50px;
41 + padding: 4%;
42 +}
43 +#bundle td.name {
44 + border-left: solid 1px rgba(136, 0, 0, 0.25);
45 + padding-left: 3%;
34 } 46 }
35 #bundle td.desc { 47 #bundle td.desc {
36 width: 50%; 48 width: 50%;
37 text-align: left; 49 text-align: left;
50 + font-style: italic;
51 +}
52 +
53 +#bundle h2 {
54 + text-align: center;
55 + padding: 3%;
56 + background-color: rgba(173, 216, 230, 0.75);
57 + border-top-left-radius: 5px;
58 + border-top-right-radius: 5px;
59 + color: white;
60 + font-weight: normal;
61 +}
62 +
63 +div#available {
64 + padding: 5%;
65 +}
66 +
67 +#available p {
68 + text-indent: initial;
69 + text-align: initial;
38 } 70 }
39 71
40 #available button { 72 #available button {
41 float: right; 73 float: right;
42 -}
...\ No newline at end of file ...\ No newline at end of file
74 + width: 33%;
75 + margin-top: 5%;
76 +}
......
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
2 <div id="bundle" class="container"> 2 <div id="bundle" class="container">
3 <nav></nav> 3 <nav></nav>
4 <div class="main-left"> 4 <div class="main-left">
5 - <h3>You are subscribed to the</h3> 5 + <h4>You are subscribed to the</h4>
6 - <h2>{{name}}</h2> 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">
10 <td class="icon">icon of function</td> 10 <td class="icon">icon of function</td>
11 - <td>{{func.name}}</td> 11 + <td class="name">{{func.name}}</td>
12 <td class="desc">{{func.desc}}</td> 12 <td class="desc">{{func.desc}}</td>
13 - <td>{{func.params.level && "Level: " + func.params.level}}</td>
14 </tr> 13 </tr>
15 </table> 14 </table>
16 </div> 15 </div>
17 <div class="main-right"> 16 <div class="main-right">
18 <h2>Available Bundles</h2> 17 <h2>Available Bundles</h2>
19 <div bundle-available></div> 18 <div bundle-available></div>
19 + <!--Can use ng-repeat on the above div for how many bundles are available-->
20 </div> 20 </div>
21 </div> 21 </div>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -24,13 +24,48 @@ ...@@ -24,13 +24,48 @@
24 var basic = 'basic', 24 var basic = 'basic',
25 family = 'family', 25 family = 'family',
26 current, 26 current,
27 + bundleScope,
28 + avScope,
27 avCb; 29 avCb;
28 30
31 + function setInfo(resource, scope) {
32 + current = resource.bundle.id;
33 + scope.name = resource.bundle.name;
34 + scope.desc = resource.bundle.desc;
35 + scope.funcs = resource.bundle.functions;
36 + avCb(resource);
37 + }
38 +
29 angular.module('cordBundle', []) 39 angular.module('cordBundle', [])
40 + .directive('bundleAvailable', ['$resource', function ($resource) {
41 + return {
42 + templateUrl: 'app/view/bundle/available.html',
43 + link: function (scope, elem) {
44 + var button = $(elem).find('button'),
45 + ApplyData, resource;
46 +
47 + button.click(function () {
48 + ApplyData = $resource(url + '/' + avScope.available.id);
49 + resource = ApplyData.get({},
50 + // success
51 + function () {
52 + setInfo(resource, bundleScope);
53 + },
54 + // error
55 + function () {
56 + $log.error('Problem with resource', resource);
57 + }
58 + );
59 + });
60 + }
61 + };
62 + }])
63 +
30 .controller('CordBundleCtrl', ['$log', '$scope', '$resource', 64 .controller('CordBundleCtrl', ['$log', '$scope', '$resource',
31 function (_$log_, $scope, _$resource_) { 65 function (_$log_, $scope, _$resource_) {
32 var BundleData, resource; 66 var BundleData, resource;
33 $scope.page = 'bundle'; 67 $scope.page = 'bundle';
68 + bundleScope = $scope;
34 $log = _$log_; 69 $log = _$log_;
35 $resource = _$resource_; 70 $resource = _$resource_;
36 71
...@@ -38,11 +73,7 @@ ...@@ -38,11 +73,7 @@
38 resource = BundleData.get({}, 73 resource = BundleData.get({},
39 // success 74 // success
40 function () { 75 function () {
41 - current = resource.bundle.id; 76 + setInfo(resource, $scope);
42 - $scope.name = resource.bundle.name;
43 - $scope.desc = resource.bundle.desc;
44 - $scope.funcs = resource.bundle.functions;
45 - avCb(resource);
46 }, 77 },
47 // error 78 // error
48 function () { 79 function () {
...@@ -54,6 +85,7 @@ ...@@ -54,6 +85,7 @@
54 85
55 .controller('CordAvailable', ['$scope', 86 .controller('CordAvailable', ['$scope',
56 function ($scope) { 87 function ($scope) {
88 + avScope = $scope;
57 avCb = function (resource) { 89 avCb = function (resource) {
58 $scope.id = (current === basic) ? family : basic; 90 $scope.id = (current === basic) ? family : basic;
59 $scope.bundles = resource.bundles; 91 $scope.bundles = resource.bundles;
...@@ -66,11 +98,5 @@ ...@@ -66,11 +98,5 @@
66 }; 98 };
67 99
68 $log.debug('Cord Available Ctrl has been created.'); 100 $log.debug('Cord Available Ctrl has been created.');
69 - }]) 101 + }]);
70 -
71 - .directive('bundleAvailable', function () {
72 - return {
73 - templateUrl: 'app/view/bundle/available.html'
74 - };
75 - });
76 }()); 102 }());
......
...@@ -30,9 +30,46 @@ p, a, li, th, td { ...@@ -30,9 +30,46 @@ p, a, li, th, td {
30 body { 30 body {
31 background-color: #efefef; 31 background-color: #efefef;
32 } 32 }
33 +table {
34 + border-spacing: 0;
35 + border-collapse: collapse;
36 +}
33 th, td { 37 th, td {
34 color: rgba(0, 0, 0, 0.8); 38 color: rgba(0, 0, 0, 0.8);
35 } 39 }
40 +h3 {
41 + font-weight: normal;
42 + margin-bottom: 4%;
43 +}
44 +h4 {
45 + color: rgb(107, 107, 107);
46 + font-style: italic;
47 + font-weight: normal;
48 + font-size: 90%;
49 + margin-bottom: 1%;
50 +}
51 +p {
52 + font-size: 70%;
53 + color: rgba(0,0,0, 0.8);
54 + text-indent: 20px;
55 + text-align: justify;
56 +}
57 +
58 +button {
59 + height: 30px;
60 + box-shadow: none;
61 + border: none;
62 + outline: none;
63 + cursor: pointer;
64 + letter-spacing: 0.02em;
65 + font-size: 14px;
66 + background-color: lightgray;
67 + transition: background-color 0.4s;
68 +}
69 +button:hover {
70 + color: white;
71 + background-color: #CE5650;
72 +}
36 73
37 div.container { 74 div.container {
38 width: 75%; 75 width: 75%;
...@@ -51,3 +88,18 @@ div.main-right { ...@@ -51,3 +88,18 @@ div.main-right {
51 svg#icon-defs { 88 svg#icon-defs {
52 display: none; 89 display: none;
53 } 90 }
91 +
92 +/* animation */
93 +.fadein {
94 + transition: all linear 0.5s;
95 +}
96 +.fadein.ng-enter {
97 + opacity: 0;
98 +}
99 +.fadein.ng-enter-stagger {
100 + transition-delay: 0.2s;
101 + animation-delay: 0.2s;
102 +}
103 +.fadein.ng-enter.ng-enter-active {
104 + opacity: 1;
105 +}
......
...@@ -28,10 +28,6 @@ ...@@ -28,10 +28,6 @@
28 text-align: center; 28 text-align: center;
29 } 29 }
30 30
31 -#home table.content {
32 - border-spacing: 0;
33 - border-collapse: collapse;
34 -}
35 #home table.content th, 31 #home table.content th,
36 #home table.content td { 32 #home table.content td {
37 font-size: 90%; 33 font-size: 90%;
...@@ -51,23 +47,3 @@ ...@@ -51,23 +47,3 @@
51 text-align: left; 47 text-align: left;
52 padding: 2%; 48 padding: 2%;
53 } 49 }
54 -
55 -#home h3 {
56 - font-weight: normal;
57 - margin-bottom: 4%;
58 -}
59 -
60 -#home h4 {
61 - color: rgb(107, 107, 107);
62 - font-style: italic;
63 - font-weight: normal;
64 - font-size: 90%;
65 - margin-bottom: 1%;
66 -}
67 -
68 -#home p {
69 - font-size: 70%;
70 - color: rgba(0,0,0, 0.8);
71 - text-indent: 20px;
72 - text-align: justify;
73 -}
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
28 </tr> 28 </tr>
29 </thead> 29 </thead>
30 <tbody> 30 <tbody>
31 - <tr ng-repeat="user in users"> 31 + <tr ng-repeat="user in users" class="fadein">
32 <td>{{user.name}}</td> 32 <td>{{user.name}}</td>
33 <td>{{user.mac}}</td> 33 <td>{{user.mac}}</td>
34 </tr> 34 </tr>
......