blob: 7ab6981447d42db0101840b4c66fa480b728758d [file] [log] [blame]
Simon Hunt86388b12015-01-09 14:23:26 -08001/*
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}());