blob: adf7d2a8f89710be3b6e6f38e4000d56493cc095 [file] [log] [blame]
Simon Huntef31fb22014-12-19 13:16:44 -08001/*
Simon Hunt8ead3a22015-01-06 11:00:15 -08002 * Copyright 2014,2015 Open Networking Laboratory
Simon Huntef31fb22014-12-19 13:16:44 -08003 *
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 -- Topology View Module
19
20 @author Simon Hunt
21 */
22
23(function () {
24 'use strict';
Simon Hunt6cc53692015-01-07 11:33:45 -080025
26 var moduleDependencies = [
27 'onosUtil',
28 'onosSvg'
29 ];
30
31 // references to injected services etc.
32 var $log, ks, gs;
33
34 // DOM elements
35 var defs;
36
37 // Internal state
38 // ...
39
40 // Note: "exported" state should be properties on 'self' variable
41
42 var keyBindings = {
43 W: [logWarning, 'log a warning'],
44 E: [logError, 'log an error']
45 };
46
47 // -----------------
48 // these functions are necessarily temporary examples....
49 function logWarning() {
50 $log.warn('You have been warned!');
51 }
52 function logError() {
53 $log.error('You are erroneous!');
54 }
55 // -----------------
56
57 function setUpKeys() {
58 ks.keyBindings(keyBindings);
59 }
60
61 function setUpDefs() {
62 defs = d3.select('#ov-topo svg').append('defs');
63 gs.loadDefs(defs);
64 }
65
66
67 angular.module('ovTopo', moduleDependencies)
68
69 .controller('OvTopoCtrl', [
70 '$log', 'KeyService', 'GlyphService',
71
72 function (_$log_, _ks_, _gs_) {
73 var self = this;
74
75 $log = _$log_;
76 ks = _ks_;
77 gs = _gs_;
Simon Huntef31fb22014-12-19 13:16:44 -080078
79 self.message = 'Topo View Rocks!';
80
Simon Hunt6cc53692015-01-07 11:33:45 -080081 setUpKeys();
82 setUpDefs();
83
84 $log.log('OvTopoCtrl has been created');
Simon Huntef31fb22014-12-19 13:16:44 -080085 }]);
86}());