Simon Hunt

GUI -- Created NavService and implemented simple navigation (click on the bird!)

Change-Id: I2bda5a3a1b279167194a84564408760eebcb59fd
...@@ -39,6 +39,12 @@ ...@@ -39,6 +39,12 @@
39 height: 38px; 39 height: 38px;
40 padding-left: 8px; 40 padding-left: 8px;
41 padding-right: 8px; 41 padding-right: 8px;
42 + cursor: pointer;
43 +}
44 +
45 +#mast img.logo:hover {
46 + /* need something better */
47 + /*background-color: #888;*/
42 } 48 }
43 49
44 #mast .title { 50 #mast .title {
......
1 <!-- Masthead partial HTML --> 1 <!-- Masthead partial HTML -->
2 -<img class="logo" src="../data/img/onos-logo.png">
3 -<span class="title">Open Network Operating System</span>
...\ No newline at end of file ...\ No newline at end of file
2 +<img class="logo" src="../data/img/onos-logo.png" ng-click="mastCtrl.toggleNav()">
3 +<span class="title">Open Network Operating System</span>
......
...@@ -22,14 +22,22 @@ ...@@ -22,14 +22,22 @@
22 (function () { 22 (function () {
23 'use strict'; 23 'use strict';
24 24
25 - angular.module('onosMast', []) 25 + var $log;
26 - .controller('MastCtrl', ['$log', function (_$log_) { 26 +
27 - var $log = _$log_, 27 + angular.module('onosMast', ['onosNav'])
28 - self = this; 28 + .controller('MastCtrl', ['$log', 'NavService', function (_$log_, ns) {
29 + var self = this;
30 +
31 + $log = _$log_;
29 32
30 // initialize mast controller here... 33 // initialize mast controller here...
31 self.radio = null; 34 self.radio = null;
32 35
36 + // delegate to NavService
37 + self.toggleNav = function () {
38 + ns.toggleNav();
39 + };
40 +
33 $log.log('MastCtrl has been created'); 41 $log.log('MastCtrl has been created');
34 }]); 42 }]);
35 43
......
1 +/*
2 + * Copyright 2014,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 +/*
18 + ONOS GUI -- Navigation -- CSS file
19 +
20 + @author Simon Hunt
21 + @author Bri Prebilic Cole
22 + */
23 +
24 +#nav {
25 + position: absolute;
26 + top: 50px;
27 + left: 8px;
28 + width: 160px;
29 + height: 100px;
30 + padding: 4px;
31 + z-index: 3000;
32 + visibility: hidden;
33 +}
34 +
35 +.light #nav {
36 + background-color: #ccf;
37 + box-shadow: 0 2px 8px #777;
38 +}
39 +.dark #nav {
40 + background-color: #444;
41 + box-shadow: 0 2px 8px #777;
42 +}
43 +
44 +#nav ul li {
45 + font-size: 10pt;
46 +}
47 +
48 +
49 +#nav h2 {
50 + font-size: 12pt;
51 + margin: 0;
52 +}
53 +#nav h3 {
54 + font-size: 8pt;
55 + font-style: italic;
56 + margin: 0;
57 +}
58 +
59 +.light #nav h2,
60 +.light #nav h3 {
61 + color: black;
62 +}
63 +
64 +.dark #nav h2,
65 +.dark #nav h3 {
66 + color: #ddd;
67 +}
68 +
69 +.dark #nav a {
70 + color: #ddd;
71 +}
72 +
1 +<!-- Navigation partial HTML -->
2 +<h2>Navigation</h2>
3 +<h3>(Note - this is temporary)</h3>
4 +
5 +<ul>
6 + <li> <a ng-click="navCtrl.hideNav()" href="#/sample">Sample View</a></li>
7 + <li> <a ng-click="navCtrl.hideNav()" href="#/topo">Topology View</a></li>
8 +</ul>
1 +/*
2 + * Copyright 2014,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 +/*
18 + ONOS GUI -- Navigation Module
19 +
20 + @author Simon Hunt
21 + @author Bri Prebilic Cole
22 + */
23 +(function () {
24 + 'use strict';
25 +
26 + // injected dependencies
27 + var $log;
28 +
29 + // internal state
30 + var navShown = false;
31 +
32 + function updatePane() {
33 + var vis = navShown ? 'visible' : 'hidden';
34 + d3.select('#nav').style('visibility', vis);
35 + }
36 +
37 +
38 + function showNav() {
39 + navShown = true;
40 + updatePane();
41 + }
42 + function hideNav() {
43 + navShown = false;
44 + updatePane();
45 + }
46 + function toggleNav() {
47 + navShown = !navShown;
48 + updatePane();
49 + }
50 +
51 + angular.module('onosNav', [])
52 + .controller('NavCtrl', [
53 + '$log', function (_$log_) {
54 + var self = this;
55 + $log = _$log_;
56 +
57 + self.hideNav = hideNav;
58 + $log.log('NavCtrl has been created');
59 + }
60 + ])
61 + .factory('NavService', ['$log', function (_$log_) {
62 + $log = _$log_;
63 +
64 + return {
65 + showNav: showNav,
66 + hideNav: hideNav,
67 + toggleNav: toggleNav
68 + };
69 + }]);
70 +
71 +}());
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
39 <script src="fw/util/keys.js"></script> 39 <script src="fw/util/keys.js"></script>
40 40
41 <script src="fw/mast/mast.js"></script> 41 <script src="fw/mast/mast.js"></script>
42 + <script src="fw/nav/nav.js"></script>
42 43
43 <script src="fw/svg/svg.js"></script> 44 <script src="fw/svg/svg.js"></script>
44 <script src="fw/svg/glyph.js"></script> 45 <script src="fw/svg/glyph.js"></script>
...@@ -50,6 +51,7 @@ ...@@ -50,6 +51,7 @@
50 <!-- TODO: use a single catenated-minified file here --> 51 <!-- TODO: use a single catenated-minified file here -->
51 <link rel="stylesheet" href="onos.css"> 52 <link rel="stylesheet" href="onos.css">
52 <link rel="stylesheet" href="fw/mast/mast.css"> 53 <link rel="stylesheet" href="fw/mast/mast.css">
54 + <link rel="stylesheet" href="fw/nav/nav.css">
53 55
54 <!-- This is where contributed javascript will get injected --> 56 <!-- This is where contributed javascript will get injected -->
55 <!-- {INJECTED-JAVASCRIPT} --> 57 <!-- {INJECTED-JAVASCRIPT} -->
...@@ -71,6 +73,10 @@ ...@@ -71,6 +73,10 @@
71 73
72 <div id="view" ng-view></div> 74 <div id="view" ng-view></div>
73 75
76 + <div id="nav"
77 + ng-controller="NavCtrl as navCtrl"
78 + ng-include="'fw/nav/nav.html'"></div>
79 +
74 <div id="floatpanels"></div> 80 <div id="floatpanels"></div>
75 <div id="alerts"></div> 81 <div id="alerts"></div>
76 <div id="flash"></div> 82 <div id="flash"></div>
......
...@@ -29,5 +29,5 @@ ...@@ -29,5 +29,5 @@
29 } 29 }
30 30
31 #ov-topo svg { 31 #ov-topo svg {
32 - background-color: #88f; 32 + background-color: #dde;
33 } 33 }
......