blob: aaa431de19cb3609edd5f6a72eb529e44a06158c [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
Simon Hunt86388b12015-01-09 14:23:26 -080019 */
20(function () {
21 'use strict';
22
23 // injected dependencies
24 var $log;
25
26 // internal state
27 var navShown = false;
28
29 function updatePane() {
30 var vis = navShown ? 'visible' : 'hidden';
31 d3.select('#nav').style('visibility', vis);
32 }
33
34
35 function showNav() {
36 navShown = true;
37 updatePane();
38 }
39 function hideNav() {
40 navShown = false;
41 updatePane();
42 }
43 function toggleNav() {
44 navShown = !navShown;
45 updatePane();
46 }
47
48 angular.module('onosNav', [])
49 .controller('NavCtrl', [
50 '$log', function (_$log_) {
51 var self = this;
52 $log = _$log_;
53
54 self.hideNav = hideNav;
55 $log.log('NavCtrl has been created');
56 }
57 ])
58 .factory('NavService', ['$log', function (_$log_) {
59 $log = _$log_;
60
61 return {
62 showNav: showNav,
63 hideNav: hideNav,
64 toggleNav: toggleNav
65 };
66 }]);
67
68}());