blob: 5843b568e546c9aeb424898bab4e766aa1ad0cae [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
Simon Huntef31fb22014-12-19 13:16:44 -080019 */
20
21(function () {
22 'use strict';
Simon Hunt6cc53692015-01-07 11:33:45 -080023
24 var moduleDependencies = [
Simon Hunt36a58c62015-04-08 11:00:07 -070025 'ngCookies',
Simon Hunt6cc53692015-01-07 11:33:45 -080026 'onosUtil',
Simon Hunt1e4a0012015-01-21 11:36:08 -080027 'onosSvg',
28 'onosRemote'
Simon Hunt6cc53692015-01-07 11:33:45 -080029 ];
30
31 // references to injected services etc.
Simon Hunt36a58c62015-04-08 11:00:07 -070032 var $log, $cookies, fs, ks, zs, gs, ms, sus, flash, wss,
Bri Prebilic Coleb5f2b152015-04-07 14:58:09 -070033 tes, tfs, tps, tis, tss, tls, tts, tos, fltr, ttbs;
Simon Hunt6cc53692015-01-07 11:33:45 -080034
35 // DOM elements
Simon Hunt7c8ab8d2015-02-03 15:05:15 -080036 var ovtopo, svg, defs, zoomLayer, mapG, forceG, noDevsLayer;
Simon Hunt6cc53692015-01-07 11:33:45 -080037
38 // Internal state
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -070039 var zoomer, actionMap;
Simon Hunt6cc53692015-01-07 11:33:45 -080040
Simon Huntcacce342015-01-07 16:13:05 -080041 // --- Short Cut Keys ------------------------------------------------
42
Simon Hunt5724fb42015-02-05 16:59:40 -080043 function setUpKeys() {
44 // key bindings need to be made after the services have been injected
45 // thus, deferred to here...
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -070046 actionMap = {
Simon Hunt36a58c62015-04-08 11:00:07 -070047 I: [toggleInstances, 'Toggle ONOS instances panel'],
48 O: [tps.toggleSummary, 'Toggle ONOS summary panel'],
49 D: [tps.toggleDetails, 'Disable / enable details panel'],
Simon Huntac4c6f72015-02-03 19:50:53 -080050
Simon Hunt5724fb42015-02-05 16:59:40 -080051 H: [tfs.toggleHosts, 'Toggle host visibility'],
52 M: [tfs.toggleOffline, 'Toggle offline visibility'],
Simon Hunt9e2104c2015-02-26 10:48:59 -080053 P: [tfs.togglePorts, 'Toggle Port Highlighting'],
Simon Hunt86b7c882015-04-02 23:06:08 -070054 dash: [tfs.showBadLinks, 'Show bad links'],
55 B: [toggleMap, 'Toggle background map'],
Simon Huntac4c6f72015-02-03 19:50:53 -080056
Simon Hunt5724fb42015-02-05 16:59:40 -080057 //X: [toggleNodeLock, 'Lock / unlock node positions'],
Simon Hunt96f88c62015-02-19 17:57:25 -080058 Z: [tos.toggleOblique, 'Toggle oblique view (Experimental)'],
Bri Prebilic Coleb5f2b152015-04-07 14:58:09 -070059 N: [fltr.clickAction, 'Cycle node layers'],
Simon Hunt5724fb42015-02-05 16:59:40 -080060 L: [tfs.cycleDeviceLabels, 'Cycle device labels'],
Simon Hunt445e8152015-02-06 13:00:12 -080061 U: [tfs.unpin, 'Unpin node (hover mouse over)'],
Simon Hunt5724fb42015-02-05 16:59:40 -080062 R: [resetZoom, 'Reset pan / zoom'],
Simon Hunt90dcc3e2015-03-25 15:01:27 -070063 dot: [ttbs.toggleToolbar, 'Toggle Toolbar'],
Simon Huntac4c6f72015-02-03 19:50:53 -080064
Simon Huntf542d842015-02-11 16:20:33 -080065 V: [tts.showRelatedIntentsAction, 'Show all related intents'],
66 rightArrow: [tts.showNextIntentAction, 'Show next related intent'],
67 leftArrow: [tts.showPrevIntentAction, 'Show previous related intent'],
68 W: [tts.showSelectedIntentTrafficAction, 'Monitor traffic of selected intent'],
69 A: [tts.showAllTrafficAction, 'Monitor all traffic'],
70 F: [tts.showDeviceLinkFlowsAction, 'Show device link flows'],
Simon Huntac4c6f72015-02-03 19:50:53 -080071
Simon Hunt0e48c292015-02-19 16:11:37 -080072 E: [equalizeMasters, 'Equalize mastership roles'],
Simon Huntac4c6f72015-02-03 19:50:53 -080073
Simon Hunt08f841d02015-02-10 14:39:20 -080074 esc: handleEscape,
Simon Huntac4c6f72015-02-03 19:50:53 -080075
Simon Hunt09060142015-03-18 20:23:32 -070076 _keyListener: ttbs.keyListener,
77
Simon Hunt5724fb42015-02-05 16:59:40 -080078 _helpFormat: [
Simon Hunt86b7c882015-04-02 23:06:08 -070079 ['I', 'O', 'D', '-', 'H', 'M', 'P', 'dash', 'B' ],
Bri Prebilic Coleb5f2b152015-04-07 14:58:09 -070080 ['X', 'Z', 'N', 'L', 'U', 'R', '-', 'dot'],
Simon Hunt5724fb42015-02-05 16:59:40 -080081 ['V', 'rightArrow', 'leftArrow', 'W', 'A', 'F', '-', 'E' ]
82 ]
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -070083 };
84
85 ks.keyBindings(actionMap);
Simon Huntac4c6f72015-02-03 19:50:53 -080086
Simon Hunt639dc662015-02-18 14:19:20 -080087 ks.gestureNotes([
Simon Hunt5724fb42015-02-05 16:59:40 -080088 ['click', 'Select the item and show details'],
89 ['shift-click', 'Toggle selection state'],
90 ['drag', 'Reposition (and pin) device / host'],
91 ['cmd-scroll', 'Zoom in / out'],
92 ['cmd-drag', 'Pan']
Simon Hunt639dc662015-02-18 14:19:20 -080093 ]);
Simon Hunt5724fb42015-02-05 16:59:40 -080094 }
Simon Hunt6cc53692015-01-07 11:33:45 -080095
Simon Hunt08f841d02015-02-10 14:39:20 -080096 // --- Keystroke functions -------------------------------------------
Simon Huntac4c6f72015-02-03 19:50:53 -080097
Simon Hunt6036b192015-02-11 11:20:26 -080098 // NOTE: this really belongs in the TopoPanelService -- but how to
99 // cleanly link in the updateDeviceColors() call? To be fixed later.
Simon Hunt36a58c62015-04-08 11:00:07 -0700100 function toggleInstances(x) {
101 if (x === 'keyev') {
102 tis.toggle();
103 updateCookieState('insts', tis.isVisible());
104 } else if (x) {
105 tis.show();
106 } else {
107 tis.hide();
108 }
Simon Huntac4c6f72015-02-03 19:50:53 -0800109 tfs.updateDeviceColors();
Simon Hunt6cc53692015-01-07 11:33:45 -0800110 }
Simon Huntac4c6f72015-02-03 19:50:53 -0800111
Simon Hunt36a58c62015-04-08 11:00:07 -0700112 function toggleMap(x) {
113 var on = (x === 'keyev') ? !sus.visible(mapG) : !!x;
114 sus.visible(mapG, on);
115 updateCookieState('bg', on);
Simon Hunt18bf9822015-02-12 17:35:45 -0800116 }
117
Simon Hunt36a58c62015-04-08 11:00:07 -0700118 // TODO: need wrapper functions for state changes needed in cookies
119
Simon Hunt08f841d02015-02-10 14:39:20 -0800120 function resetZoom() {
121 zoomer.reset();
122 }
123
Simon Hunt0e48c292015-02-19 16:11:37 -0800124 function equalizeMasters() {
Simon Hunt237676b52015-03-10 19:04:26 -0700125 wss.sendEvent('equalizeMasters');
Simon Hunt0e48c292015-02-19 16:11:37 -0800126 flash.flash('Equalizing master roles');
127 }
128
Simon Hunt08f841d02015-02-10 14:39:20 -0800129 function handleEscape() {
Simon Hunta142dd22015-02-12 22:07:51 -0800130 if (tis.showMaster()) {
131 // if an instance is selected, cancel the affinity mapping
132 tis.cancelAffinity()
Simon Hunt08f841d02015-02-10 14:39:20 -0800133
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700134 } else if (tss.deselectAll()) {
Simon Hunta0eb0a82015-02-11 12:30:06 -0800135 // else if we have node selections, deselect them all
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700136 // (work already done)
137
138 } else if (tls.deselectLink()) {
139 // else if we have a link selected, deselect it
140 // (work already done)
Simon Hunt08f841d02015-02-10 14:39:20 -0800141
Simon Hunta0eb0a82015-02-11 12:30:06 -0800142 } else if (tis.isVisible()) {
143 // else if the Instance Panel is visible, hide it
144 tis.hide();
145 tfs.updateDeviceColors();
Simon Hunt08f841d02015-02-10 14:39:20 -0800146
Simon Hunta0eb0a82015-02-11 12:30:06 -0800147 } else if (tps.summaryVisible()) {
148 // else if the Summary Panel is visible, hide it
149 tps.hideSummaryPanel();
Simon Hunt08f841d02015-02-10 14:39:20 -0800150
Simon Hunta0eb0a82015-02-11 12:30:06 -0800151 } else {
152 // TODO: set hover mode to hoverModeNone
Simon Hunt62c2f8f2015-02-19 14:19:10 -0800153 // talk to Thomas about this: shouldn't it be done
154 // when we deselect the node (if tss.haveDetails()...)
Simon Hunta0eb0a82015-02-11 12:30:06 -0800155 }
Simon Hunt08f841d02015-02-10 14:39:20 -0800156 }
Simon Huntcacce342015-01-07 16:13:05 -0800157
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700158 // --- Toolbar Functions ---------------------------------------------
159
160 function getActionEntry(key) {
161 var entry = actionMap[key];
162 return fs.isA(entry) || [entry, ''];
163 }
164
165 function setUpToolbar() {
166 ttbs.init({
167 getActionEntry: getActionEntry
168 });
169 ttbs.createToolbar();
170 }
171
Simon Huntcacce342015-01-07 16:13:05 -0800172 // --- Glyphs, Icons, and the like -----------------------------------
173
Simon Hunt6cc53692015-01-07 11:33:45 -0800174 function setUpDefs() {
Simon Huntcacce342015-01-07 16:13:05 -0800175 defs = svg.append('defs');
Simon Hunt6cc53692015-01-07 11:33:45 -0800176 gs.loadDefs(defs);
Simon Hunt0ee28682015-02-12 20:48:11 -0800177 sus.loadGlowDefs(defs);
Simon Hunt6cc53692015-01-07 11:33:45 -0800178 }
179
180
Simon Huntcacce342015-01-07 16:13:05 -0800181 // --- Pan and Zoom --------------------------------------------------
182
183 // zoom enabled predicate. ev is a D3 source event.
184 function zoomEnabled(ev) {
Simon Huntd552ee92015-04-02 17:06:35 -0700185 return fs.isMobile() || (ev.metaKey || ev.altKey);
Simon Huntcacce342015-01-07 16:13:05 -0800186 }
187
188 function zoomCallback() {
Simon Hunt5724fb42015-02-05 16:59:40 -0800189 var sc = zoomer.scale();
Simon Huntcacce342015-01-07 16:13:05 -0800190
Simon Hunt0541fb82015-01-14 18:59:57 -0800191 // keep the map lines constant width while zooming
Simon Hunt737c89f2015-01-28 12:23:19 -0800192 mapG.style('stroke-width', (2.0 / sc) + 'px');
Simon Huntcacce342015-01-07 16:13:05 -0800193 }
194
195 function setUpZoom() {
Simon Hunta7b6a6b2015-01-13 19:53:09 -0800196 zoomLayer = svg.append('g').attr('id', 'topo-zoomlayer');
Simon Huntcacce342015-01-07 16:13:05 -0800197 zoomer = zs.createZoomer({
198 svg: svg,
199 zoomLayer: zoomLayer,
200 zoomEnabled: zoomEnabled,
201 zoomCallback: zoomCallback
202 });
203 }
204
205
Simon Hunt0541fb82015-01-14 18:59:57 -0800206 // callback invoked when the SVG view has been resized..
Simon Hunt3a6eec02015-02-09 21:16:43 -0800207 function svgResized(s) {
208 tfs.newDim([s.width, s.height]);
Simon Hunt0541fb82015-01-14 18:59:57 -0800209 }
210
Simon Hunta7b6a6b2015-01-13 19:53:09 -0800211 // --- Background Map ------------------------------------------------
212
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800213 function setUpNoDevs() {
214 var g, box;
215 noDevsLayer = svg.append('g').attr({
216 id: 'topo-noDevsLayer',
217 transform: sus.translate(500,500)
218 });
219 // Note, SVG viewbox is '0 0 1000 1000', defined in topo.html.
220 // We are translating this layer to have its origin at the center
221
222 g = noDevsLayer.append('g');
223 gs.addGlyph(g, 'bird', 100).attr('class', 'noDevsBird');
224 g.append('text').text('No devices are connected')
225 .attr({ x: 120, y: 80});
226
227 box = g.node().getBBox();
228 box.x -= box.width/2;
229 box.y -= box.height/2;
230 g.attr('transform', sus.translate(box.x, box.y));
231
232 showNoDevs(true);
233 }
234
235 function showNoDevs(b) {
Simon Hunt18bf9822015-02-12 17:35:45 -0800236 sus.visible(noDevsLayer, b);
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800237 }
238
Simon Hunt0541fb82015-01-14 18:59:57 -0800239 function setUpMap() {
Simon Hunt737c89f2015-01-28 12:23:19 -0800240 mapG = zoomLayer.append('g').attr('id', 'topo-map');
Simon Huntac4c6f72015-02-03 19:50:53 -0800241 // returns a promise for the projection...
242 return ms.loadMapInto(mapG, '*continental_us');
Simon Hunt0541fb82015-01-14 18:59:57 -0800243 }
244
Simon Huntc3c5b672015-02-20 11:32:13 -0800245 function opacifyMap(b) {
246 mapG.transition()
247 .duration(1000)
248 .attr('opacity', b ? 1 : 0);
249 }
Simon Hunt737c89f2015-01-28 12:23:19 -0800250
Simon Hunt36a58c62015-04-08 11:00:07 -0700251 // --- Config from Cookies -------------------------------------------
252
253 // TODO: write a general purpose cookie service, rather than custom here
254
255 // NOTE: in Angular 1.3.5, $cookies is just a simple object, and
256 // cookie values are just strings. From the 1.3.5 docs:
257 //
258 // "Only a simple Object is exposed and by adding or removing
259 // properties to/from this object, new cookies are created/deleted
260 // at the end of current $eval. The object's properties can only
261 // be strings."
262 //
263 // We may want to upgrade the version of Angular sometime soon
264 // since later version support objects as cookie values.
265
266 var defaultCookieState = {
267 bg: 1,
268 insts: 1,
269 summary: 1,
270 detail: 1,
271 hosts: 0
272 };
273
274 var cookieState = {};
275
276 function writeCookieState() {
277 var bits = [],
278 str;
279 angular.forEach(cookieState, function (value, key) {
280 bits.push(key + ':' + value);
281 });
282 str = bits.join(',');
283
284 // The angular way of doing this...
285 // $cookies.topo_state = str;
286 // ...but it appears that this gets delayed, and doesn't 'stick' ??
287
288 // FORCE cookie to be set by writing directly to document.cookie...
289 document.cookie = 'topo_state=' + encodeURIComponent(str);
290 $log.debug('<<>> Wrote cookie:', str);
291 }
292
293 function readCookieState() {
294 var cook = $cookies.topo_state || '',
295 bits;
296
297 if (!cook) {
298 cookieState = angular.extend({}, defaultCookieState);
299 writeCookieState(); // seed the pot
300
301 } else {
302 bits = cook.split(',');
303 bits.forEach(function (value) {
304 var x = value.split(':');
305 cookieState[x[0]] = Number(x[1]);
306 });
307 }
308 }
309
310 function updateCookieState(what, b) {
311 cookieState[what] = b ? 1 : 0;
312 writeCookieState();
313 }
314
315 function restoreConfigFromCookies() {
316 readCookieState();
317 $log.debug('Cookie State:', cookieState);
318
319 toggleInstances(cookieState.insts);
320 tps.toggleSummary(cookieState.summary);
321 tps.toggleDetails(cookieState.detail);
322 }
323
324
Simon Huntcacce342015-01-07 16:13:05 -0800325 // --- Controller Definition -----------------------------------------
326
Simon Hunt6cc53692015-01-07 11:33:45 -0800327 angular.module('ovTopo', moduleDependencies)
Simon Hunt237676b52015-03-10 19:04:26 -0700328 .controller('OvTopoCtrl', ['$scope', '$log', '$location', '$timeout',
Simon Hunt36a58c62015-04-08 11:00:07 -0700329 '$cookies', 'FnService', 'MastService', 'KeyService', 'ZoomService',
Simon Hunt0e48c292015-02-19 16:11:37 -0800330 'GlyphService', 'MapService', 'SvgUtilService', 'FlashService',
Simon Hunt237676b52015-03-10 19:04:26 -0700331 'WebSocketService',
Simon Huntb0ec1e52015-01-28 18:13:49 -0800332 'TopoEventService', 'TopoForceService', 'TopoPanelService',
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700333 'TopoInstService', 'TopoSelectService', 'TopoLinkService',
Bri Prebilic Coleb5f2b152015-04-07 14:58:09 -0700334 'TopoTrafficService', 'TopoObliqueService', 'TopoFilterService',
335 'TopoToolbarService',
Simon Hunt6cc53692015-01-07 11:33:45 -0800336
Simon Hunt36a58c62015-04-08 11:00:07 -0700337 function ($scope, _$log_, $loc, $timeout, _$cookies_, _fs_, mast, _ks_,
338 _zs_, _gs_, _ms_, _sus_, _flash_, _wss_, _tes_, _tfs_, _tps_,
Bri Prebilic Coleb5f2b152015-04-07 14:58:09 -0700339 _tis_, _tss_, _tls_, _tts_, _tos_, _fltr_, _ttbs_) {
Simon Huntac4c6f72015-02-03 19:50:53 -0800340 var self = this,
Simon Hunt1894d792015-02-04 17:09:20 -0800341 projection,
Simon Hunt3a6eec02015-02-09 21:16:43 -0800342 dim,
Simon Hunt1894d792015-02-04 17:09:20 -0800343 uplink = {
344 // provides function calls back into this space
345 showNoDevs: showNoDevs,
346 projection: function () { return projection; },
Simon Huntc3c5b672015-02-20 11:32:13 -0800347 zoomLayer: function () { return zoomLayer; },
Simon Huntfb8ea1f2015-02-24 21:38:09 -0800348 zoomer: function () { return zoomer; },
Simon Hunt237676b52015-03-10 19:04:26 -0700349 opacifyMap: opacifyMap
Simon Huntac4c6f72015-02-03 19:50:53 -0800350 };
351
Simon Hunt6cc53692015-01-07 11:33:45 -0800352 $log = _$log_;
Simon Hunt36a58c62015-04-08 11:00:07 -0700353 $cookies = _$cookies_;
Simon Hunta11b4eb2015-01-28 16:20:50 -0800354 fs = _fs_;
Simon Hunt6cc53692015-01-07 11:33:45 -0800355 ks = _ks_;
Simon Huntcacce342015-01-07 16:13:05 -0800356 zs = _zs_;
Simon Hunt6cc53692015-01-07 11:33:45 -0800357 gs = _gs_;
Simon Hunt1e8eff42015-01-08 17:19:02 -0800358 ms = _ms_;
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800359 sus = _sus_;
Simon Hunt0e48c292015-02-19 16:11:37 -0800360 flash = _flash_;
Simon Hunt237676b52015-03-10 19:04:26 -0700361 wss = _wss_;
Simon Huntc252aa62015-02-10 16:45:39 -0800362 tes = _tes_;
Simon Hunt737c89f2015-01-28 12:23:19 -0800363 tfs = _tfs_;
Simon Hunt96f88c62015-02-19 17:57:25 -0800364 // TODO: consider funnelling actions through TopoForceService...
365 // rather than injecting references to these 'sub-modules',
366 // just so we can invoke functions on them.
Simon Huntc252aa62015-02-10 16:45:39 -0800367 tps = _tps_;
Simon Huntac4c6f72015-02-03 19:50:53 -0800368 tis = _tis_;
Simon Hunt6036b192015-02-11 11:20:26 -0800369 tss = _tss_;
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700370 tls = _tls_;
Simon Huntf542d842015-02-11 16:20:33 -0800371 tts = _tts_;
Simon Hunt96f88c62015-02-19 17:57:25 -0800372 tos = _tos_;
Bri Prebilic Coleb5f2b152015-04-07 14:58:09 -0700373 fltr = _fltr_;
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700374 ttbs = _ttbs_;
Simon Huntef31fb22014-12-19 13:16:44 -0800375
Simon Hunt426bd862015-01-14 16:48:41 -0800376 self.notifyResize = function () {
Simon Huntb0ec1e52015-01-28 18:13:49 -0800377 svgResized(fs.windowSize(mast.mastHeight()));
Simon Hunt426bd862015-01-14 16:48:41 -0800378 };
Simon Huntef31fb22014-12-19 13:16:44 -0800379
Simon Hunt54442fa2015-01-26 14:17:38 -0800380 // Cleanup on destroyed scope..
Simon Hunt584122a2015-01-21 15:32:40 -0800381 $scope.$on('$destroy', function () {
382 $log.log('OvTopoCtrl is saying Buh-Bye!');
Thomas Vachuska329af532015-03-10 02:08:33 -0700383 tes.stop();
Simon Hunt626d2102015-01-29 11:54:50 -0800384 tps.destroyPanels();
Simon Hunt4b668592015-01-29 17:33:53 -0800385 tis.destroyInst();
Simon Hunt3a6eec02015-02-09 21:16:43 -0800386 tfs.destroyForce();
Bri Prebilic Coled6219052015-03-19 14:34:02 -0700387 ttbs.destroyToolbar();
Simon Hunt584122a2015-01-21 15:32:40 -0800388 });
389
Simon Huntcacce342015-01-07 16:13:05 -0800390 // svg layer and initialization of components
Simon Hunt426bd862015-01-14 16:48:41 -0800391 ovtopo = d3.select('#ov-topo');
392 svg = ovtopo.select('svg');
Simon Hunta11b4eb2015-01-28 16:20:50 -0800393 // set the svg size to match that of the window, less the masthead
394 svg.attr(fs.windowSize(mast.mastHeight()));
Simon Hunt3a6eec02015-02-09 21:16:43 -0800395 dim = [svg.attr('width'), svg.attr('height')];
Simon Hunt426bd862015-01-14 16:48:41 -0800396
Simon Hunt6cc53692015-01-07 11:33:45 -0800397 setUpKeys();
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700398 setUpToolbar();
Simon Hunt6cc53692015-01-07 11:33:45 -0800399 setUpDefs();
Simon Huntcacce342015-01-07 16:13:05 -0800400 setUpZoom();
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800401 setUpNoDevs();
Simon Hunt1894d792015-02-04 17:09:20 -0800402 setUpMap().then(
403 function (proj) {
404 projection = proj;
405 $log.debug('** We installed the projection: ', proj);
Simon Hunt36a58c62015-04-08 11:00:07 -0700406 toggleMap(cookieState.bg);
Simon Hunt1894d792015-02-04 17:09:20 -0800407 }
408 );
Simon Huntfd1231a2015-01-26 22:14:51 -0800409
Simon Hunt1894d792015-02-04 17:09:20 -0800410 forceG = zoomLayer.append('g').attr('id', 'topo-force');
Simon Huntfb8ea1f2015-02-24 21:38:09 -0800411 tfs.initForce(svg, forceG, uplink, dim);
Simon Hunta142dd22015-02-12 22:07:51 -0800412 tis.initInst({ showMastership: tfs.showMastership });
Simon Hunt237676b52015-03-10 19:04:26 -0700413 tps.initPanels();
Thomas Vachuska329af532015-03-10 02:08:33 -0700414 tes.start();
Simon Hunt6cc53692015-01-07 11:33:45 -0800415
Simon Hunt36a58c62015-04-08 11:00:07 -0700416 // temporary solution for persisting user settings
417 restoreConfigFromCookies();
418
Simon Hunt6cc53692015-01-07 11:33:45 -0800419 $log.log('OvTopoCtrl has been created');
Simon Huntef31fb22014-12-19 13:16:44 -0800420 }]);
421}());