blob: 07b29c7cbf270318ee674398428dc2dcebb85f88 [file] [log] [blame]
Simon Huntef31fb22014-12-19 13:16:44 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2014-present Open Networking Foundation
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',
Steven Burrows1c2a9682017-07-14 16:52:46 +010028 'onosRemote',
Simon Hunt6cc53692015-01-07 11:33:45 -080029 ];
30
Simon Hunta4281242016-02-26 20:18:45 -080031 // references to injected services
Steven Burrows1c2a9682017-07-14 16:52:46 +010032 var $scope, $log, $loc, $timeout,
Simon Hunt7faabd52016-08-18 16:16:19 -070033 fs, ks, zs, gs, ms, sus, flash, wss, ps, th, tds, t3s, tes, tfs, tps,
Steven Burrows1c2a9682017-07-14 16:52:46 +010034 tis, tms, tss, tls, tos, fltr, ttbs, tspr, tov;
Simon Hunt6cc53692015-01-07 11:33:45 -080035
36 // DOM elements
Simon Hunt2052e5d2015-04-13 17:40:44 -070037 var ovtopo, svg, defs, zoomLayer, mapG, spriteG, forceG, noDevsLayer;
Simon Hunt6cc53692015-01-07 11:33:45 -080038
39 // Internal state
Simon Hunt5989ddf2017-08-02 20:38:12 -070040 var zoomer,
41 actionMap,
Steven Burrows1c2a9682017-07-14 16:52:46 +010042 topoLion = function (x) { return '#' + x + '#'; }; // func replaced later
Simon Hunt6cc53692015-01-07 11:33:45 -080043
Simon Huntcacce342015-01-07 16:13:05 -080044 // --- Short Cut Keys ------------------------------------------------
45
Simon Hunt8d22c4b2015-08-06 16:24:43 -070046 function setUpKeys(overlayKeys) {
Simon Hunt5724fb42015-02-05 16:59:40 -080047 // key bindings need to be made after the services have been injected
48 // thus, deferred to here...
Simon Hunt5989ddf2017-08-02 20:38:12 -070049
50 // we need functions that can be invoked after LION bundle loaded
Steven Burrows1c2a9682017-07-14 16:52:46 +010051 function togInst() { return topoLion('tbtt_tog_instances'); }
52 function togSumm() { return topoLion('tbtt_tog_summary'); }
53 function togUseDet() { return topoLion('tbtt_tog_use_detail'); }
Simon Hunt5989ddf2017-08-02 20:38:12 -070054
Steven Burrows1c2a9682017-07-14 16:52:46 +010055 function togHost() { return topoLion('tbtt_tog_host'); }
56 function togOff() { return topoLion('tbtt_tog_offline'); }
57 function togPortHi() { return topoLion('tbtt_tog_porthi'); }
Simon Hunt5989ddf2017-08-02 20:38:12 -070058
Steven Burrows1c2a9682017-07-14 16:52:46 +010059 function showBad() { return topoLion('tbtt_bad_links'); }
60 function togMap() { return topoLion('tbtt_tog_map'); }
61 function selMap() { return topoLion('tbtt_sel_map'); }
62 function togSpr() { return topoLion('tbtt_tog_sprite'); }
Simon Hunt5989ddf2017-08-02 20:38:12 -070063
Steven Burrows1c2a9682017-07-14 16:52:46 +010064 function rstLoc() { return topoLion('tbtt_reset_loc'); }
65 function togOb() { return topoLion('tbtt_tog_oblique'); }
66 function cycLayer() { return topoLion('tbtt_cyc_layers'); }
67 function cycDev() { return topoLion('tbtt_cyc_dev_labs'); }
68 function cycHost() { return topoLion('tbtt_cyc_host_labs'); }
Simon Hunt5989ddf2017-08-02 20:38:12 -070069
Steven Burrows1c2a9682017-07-14 16:52:46 +010070 function unpin() { return topoLion('tbtt_unpin_node'); }
71 function rzoom() { return topoLion('tbtt_reset_zoom'); }
72 function togtb() { return topoLion('tbtt_tog_toolbar'); }
73 function eqmaster() { return topoLion('tbtt_eq_master'); }
Simon Hunt5989ddf2017-08-02 20:38:12 -070074
Steven Burrows1c2a9682017-07-14 16:52:46 +010075 function uiClick() { return topoLion('click'); }
76 function uiShClick() { return topoLion('shift_click'); }
77 function uiDrag() { return topoLion('drag'); }
78 function uiCmdScr() { return topoLion('cmd_scroll'); }
79 function uiCmdDrag() { return topoLion('cmd_drag'); }
Simon Hunt5989ddf2017-08-02 20:38:12 -070080
Steven Burrows1c2a9682017-07-14 16:52:46 +010081 function uiClickTxt() { return topoLion('qh_gest_click'); }
82 function uiShClickTxt() { return topoLion('qh_gest_shift_click'); }
83 function uiDragTxt() { return topoLion('qh_gest_drag'); }
84 function uiCmdScrTxt() { return topoLion('qh_gest_cmd_scroll'); }
85 function uiCmdDragTxt() { return topoLion('qh_gest_cmd_drag'); }
Simon Hunt5989ddf2017-08-02 20:38:12 -070086
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -070087 actionMap = {
Simon Hunt5989ddf2017-08-02 20:38:12 -070088 I: [toggleInstances, togInst],
89 O: [toggleSummary, togSumm],
90 D: [toggleUseDetailsFlag, togUseDet],
Simon Huntac4c6f72015-02-03 19:50:53 -080091
Simon Hunt5989ddf2017-08-02 20:38:12 -070092 H: [toggleHosts, togHost],
93 M: [toggleOffline, togOff],
94 P: [togglePorts, togPortHi],
Simon Huntac4c6f72015-02-03 19:50:53 -080095
Simon Hunt5989ddf2017-08-02 20:38:12 -070096 dash: [tfs.showBadLinks, showBad],
97 B: [toggleMap, togMap],
98 G: [openMapSelection, selMap],
99 S: [toggleSprites, togSpr],
Simon Huntac4c6f72015-02-03 19:50:53 -0800100
Simon Hunt5989ddf2017-08-02 20:38:12 -0700101 X: [tfs.resetAllLocations, rstLoc],
102 Z: [tos.toggleOblique, togOb],
103 N: [fltr.clickAction, cycLayer],
104 L: [tfs.cycleDeviceLabels, cycDev],
105 'shift-L': [tfs.cycleHostLabels, cycHost],
106
107 U: [tfs.unpin, unpin],
108 R: [resetZoom, rzoom],
109 dot: [ttbs.toggleToolbar, togtb],
110 E: [equalizeMasters, eqmaster],
Simon Huntac4c6f72015-02-03 19:50:53 -0800111
Steven Burrows1c2a9682017-07-14 16:52:46 +0100112 // -- instance color palette debug
Simon Hunta9761342016-06-10 18:02:53 -0700113 // 9: function () { sus.cat7().testCard(svg); },
114
Simon Hunt5b024d72016-01-29 11:02:43 -0800115 // topology overlay selections
116 F1: function () { ttbs.fnkey(0); },
117 F2: function () { ttbs.fnkey(1); },
118 F3: function () { ttbs.fnkey(2); },
119 F4: function () { ttbs.fnkey(3); },
120 F5: function () { ttbs.fnkey(4); },
121
Simon Hunt08f841d02015-02-10 14:39:20 -0800122 esc: handleEscape,
Simon Huntac4c6f72015-02-03 19:50:53 -0800123
Simon Hunt09060142015-03-18 20:23:32 -0700124 _keyListener: ttbs.keyListener,
125
Simon Hunt5724fb42015-02-05 16:59:40 -0800126 _helpFormat: [
Steven Burrows1c2a9682017-07-14 16:52:46 +0100127 ['I', 'O', 'D', 'H', 'M', 'P', 'dash', 'B', 'G', 'S'],
Simon Hunt10618f62017-06-15 19:30:52 -0700128 ['X', 'Z', 'N', 'L', 'shift-L', 'U', 'R', '-', 'E', '-', 'dot'],
Steven Burrows1c2a9682017-07-14 16:52:46 +0100129 [], // this column reserved for overlay actions
130 ],
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700131 };
132
Simon Hunt8d22c4b2015-08-06 16:24:43 -0700133 if (fs.isO(overlayKeys)) {
134 mergeKeys(overlayKeys);
135 }
136
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700137 ks.keyBindings(actionMap);
Simon Huntac4c6f72015-02-03 19:50:53 -0800138
Simon Hunt639dc662015-02-18 14:19:20 -0800139 ks.gestureNotes([
Simon Hunt5989ddf2017-08-02 20:38:12 -0700140 [uiClick, uiClickTxt],
141 [uiShClick, uiShClickTxt],
142 [uiDrag, uiDragTxt],
143 [uiCmdScr, uiCmdScrTxt],
Steven Burrows1c2a9682017-07-14 16:52:46 +0100144 [uiCmdDrag, uiCmdDragTxt],
Simon Hunt639dc662015-02-18 14:19:20 -0800145 ]);
Simon Hunt5724fb42015-02-05 16:59:40 -0800146 }
Simon Hunt6cc53692015-01-07 11:33:45 -0800147
Simon Hunt8d22c4b2015-08-06 16:24:43 -0700148 // when a topology overlay is activated, we need to bind their keystrokes
149 // and include them in the quick-help panel
150 function mergeKeys(extra) {
151 var _hf = actionMap._helpFormat[2];
Simon Hunt71892222015-09-29 13:39:40 -0700152
153 ks.checkNotGlobal(extra);
154
Simon Hunt8d22c4b2015-08-06 16:24:43 -0700155 extra._keyOrder.forEach(function (k) {
156 var d = extra[k],
157 cb = d && d.cb,
158 tt = d && d.tt;
159 // NOTE: ignore keys that are already defined
160 if (d && !actionMap[k]) {
161 actionMap[k] = [cb, tt];
162 _hf.push(k);
163 }
164 });
165 }
166
Simon Hunt08f841d02015-02-10 14:39:20 -0800167 // --- Keystroke functions -------------------------------------------
Simon Huntac4c6f72015-02-03 19:50:53 -0800168
Simon Hunt36a58c62015-04-08 11:00:07 -0700169 function toggleInstances(x) {
Simon Huntee7a3ce2015-04-09 13:28:37 -0700170 updatePrefsState('insts', tis.toggle(x));
Simon Huntac4c6f72015-02-03 19:50:53 -0800171 tfs.updateDeviceColors();
Simon Hunt6cc53692015-01-07 11:33:45 -0800172 }
Simon Huntac4c6f72015-02-03 19:50:53 -0800173
Simon Huntee7a3ce2015-04-09 13:28:37 -0700174 function toggleSummary(x) {
175 updatePrefsState('summary', tps.toggleSummary(x));
Simon Hunt18bf9822015-02-12 17:35:45 -0800176 }
177
Simon Hunt239e5882015-04-23 15:07:04 -0700178 function toggleUseDetailsFlag(x) {
179 updatePrefsState('detail', tps.toggleUseDetailsFlag(x));
Simon Huntee7a3ce2015-04-09 13:28:37 -0700180 }
181
Simon Huntfcbde892015-04-16 12:05:28 -0700182 function toggleHosts(x) {
183 updatePrefsState('hosts', tfs.toggleHosts(x));
184 }
185
186 function toggleOffline(x) {
187 updatePrefsState('offdev', tfs.toggleOffline(x));
188 }
189
190 function togglePorts(x) {
191 updatePrefsState('porthl', tfs.togglePorts(x));
192 }
193
194 function _togSvgLayer(x, G, tag, what) {
195 var on = (x === 'keyev') ? !sus.visible(G) : !!x,
Simon Hunt3f89cb42017-08-10 13:32:00 -0700196 verb = on ? topoLion('show') : topoLion('hide');
Simon Huntfcbde892015-04-16 12:05:28 -0700197 sus.visible(G, on);
198 updatePrefsState(tag, on);
199 flash.flash(verb + ' ' + what);
200 }
201
202 function toggleMap(x) {
Simon Hunt3f89cb42017-08-10 13:32:00 -0700203 _togSvgLayer(x, mapG, 'bg', topoLion('fl_background_map'));
Simon Huntee7a3ce2015-04-09 13:28:37 -0700204 }
Simon Hunt36a58c62015-04-08 11:00:07 -0700205
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700206 function openMapSelection() {
207 tms.openMapSelection();
208 }
209
Simon Hunt2052e5d2015-04-13 17:40:44 -0700210 function toggleSprites(x) {
Simon Hunt3f89cb42017-08-10 13:32:00 -0700211 _togSvgLayer(x, spriteG, 'spr', topoLion('fl_sprite_layer'));
Simon Hunt2052e5d2015-04-13 17:40:44 -0700212 }
213
Simon Hunt08f841d02015-02-10 14:39:20 -0800214 function resetZoom() {
215 zoomer.reset();
Simon Hunt3f89cb42017-08-10 13:32:00 -0700216 flash.flash(topoLion('fl_pan_zoom_reset'));
Simon Hunt08f841d02015-02-10 14:39:20 -0800217 }
218
Simon Hunt0e48c292015-02-19 16:11:37 -0800219 function equalizeMasters() {
Simon Hunt237676b52015-03-10 19:04:26 -0700220 wss.sendEvent('equalizeMasters');
Simon Hunt3f89cb42017-08-10 13:32:00 -0700221 flash.flash(topoLion('fl_eq_masters'));
Simon Hunt0e48c292015-02-19 16:11:37 -0800222 }
223
Simon Hunt08f841d02015-02-10 14:39:20 -0800224 function handleEscape() {
Simon Hunta142dd22015-02-12 22:07:51 -0800225 if (tis.showMaster()) {
226 // if an instance is selected, cancel the affinity mapping
Steven Burrows1c2a9682017-07-14 16:52:46 +0100227 tis.cancelAffinity();
Simon Hunt08f841d02015-02-10 14:39:20 -0800228
Simon Hunt8d22c4b2015-08-06 16:24:43 -0700229 } else if (tov.hooks.escape()) {
230 // else if the overlay consumed the ESC event...
231 // (work already done)
232
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700233 } else if (tss.deselectAll()) {
Simon Hunta0eb0a82015-02-11 12:30:06 -0800234 // else if we have node selections, deselect them all
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700235 // (work already done)
236
Prince Pereira46c82d42016-09-19 13:30:50 +0530237 } else if (tls.deselectAllLinks()) {
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700238 // else if we have a link selected, deselect it
239 // (work already done)
Simon Hunt08f841d02015-02-10 14:39:20 -0800240
Simon Hunta0eb0a82015-02-11 12:30:06 -0800241 } else if (tis.isVisible()) {
242 // else if the Instance Panel is visible, hide it
243 tis.hide();
244 tfs.updateDeviceColors();
Simon Hunt08f841d02015-02-10 14:39:20 -0800245
Simon Hunta0eb0a82015-02-11 12:30:06 -0800246 } else if (tps.summaryVisible()) {
247 // else if the Summary Panel is visible, hide it
Simon Hunt356da762016-05-27 11:54:02 -0700248 tps.hideSummary();
Simon Hunta0eb0a82015-02-11 12:30:06 -0800249 }
Simon Hunt08f841d02015-02-10 14:39:20 -0800250 }
Simon Huntcacce342015-01-07 16:13:05 -0800251
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700252 // --- Toolbar Functions ---------------------------------------------
253
Bri Prebilic Cole2efc7152015-04-29 15:47:06 -0700254 function notValid(what) {
Simon Hunt8d22c4b2015-08-06 16:24:43 -0700255 $log.warn('topo.js getActionEntry(): Not a valid ' + what);
Bri Prebilic Cole2efc7152015-04-29 15:47:06 -0700256 }
Simon Hunt8d22c4b2015-08-06 16:24:43 -0700257
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700258 function getActionEntry(key) {
Bri Prebilic Cole2efc7152015-04-29 15:47:06 -0700259 var entry;
260
261 if (!key) {
262 notValid('key');
263 return null;
264 }
265
266 entry = actionMap[key];
267
268 if (!entry) {
269 notValid('actionMap entry');
270 return null;
271 }
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700272 return fs.isA(entry) || [entry, ''];
273 }
274
275 function setUpToolbar() {
276 ttbs.init({
Simon Hunt8d22c4b2015-08-06 16:24:43 -0700277 getActionEntry: getActionEntry,
Steven Burrows1c2a9682017-07-14 16:52:46 +0100278 setUpKeys: setUpKeys,
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700279 });
280 ttbs.createToolbar();
281 }
282
Simon Huntcacce342015-01-07 16:13:05 -0800283 // --- Glyphs, Icons, and the like -----------------------------------
284
Simon Hunt6cc53692015-01-07 11:33:45 -0800285 function setUpDefs() {
Simon Huntcacce342015-01-07 16:13:05 -0800286 defs = svg.append('defs');
Simon Hunt6cc53692015-01-07 11:33:45 -0800287 gs.loadDefs(defs);
Simon Hunt0ee28682015-02-12 20:48:11 -0800288 sus.loadGlowDefs(defs);
Simon Hunt6cc53692015-01-07 11:33:45 -0800289 }
290
291
Simon Huntcacce342015-01-07 16:13:05 -0800292 // --- Pan and Zoom --------------------------------------------------
293
294 // zoom enabled predicate. ev is a D3 source event.
295 function zoomEnabled(ev) {
Simon Huntd552ee92015-04-02 17:06:35 -0700296 return fs.isMobile() || (ev.metaKey || ev.altKey);
Simon Huntcacce342015-01-07 16:13:05 -0800297 }
298
299 function zoomCallback() {
Simon Huntbb5e0d82015-04-16 14:25:46 -0700300 var sc = zoomer.scale(),
301 tr = zoomer.translate();
302
Steven Burrows1c2a9682017-07-14 16:52:46 +0100303 ps.setPrefs('topo_zoom', { tx: tr[0], ty: tr[1], sc: sc });
Simon Huntcacce342015-01-07 16:13:05 -0800304
Simon Hunt0541fb82015-01-14 18:59:57 -0800305 // keep the map lines constant width while zooming
Simon Hunt737c89f2015-01-28 12:23:19 -0800306 mapG.style('stroke-width', (2.0 / sc) + 'px');
Steven Burrowsf17f0ab2017-04-11 11:03:58 -0700307
308 tfs.setNodeScale(sc);
Simon Huntcacce342015-01-07 16:13:05 -0800309 }
310
311 function setUpZoom() {
Simon Hunta7b6a6b2015-01-13 19:53:09 -0800312 zoomLayer = svg.append('g').attr('id', 'topo-zoomlayer');
Simon Huntcacce342015-01-07 16:13:05 -0800313 zoomer = zs.createZoomer({
314 svg: svg,
315 zoomLayer: zoomLayer,
316 zoomEnabled: zoomEnabled,
Steven Burrows1c2a9682017-07-14 16:52:46 +0100317 zoomCallback: zoomCallback,
Simon Huntcacce342015-01-07 16:13:05 -0800318 });
319 }
320
321
Simon Hunt0541fb82015-01-14 18:59:57 -0800322 // callback invoked when the SVG view has been resized..
Simon Hunt3a6eec02015-02-09 21:16:43 -0800323 function svgResized(s) {
324 tfs.newDim([s.width, s.height]);
Simon Hunt0541fb82015-01-14 18:59:57 -0800325 }
326
Simon Hunta7b6a6b2015-01-13 19:53:09 -0800327 // --- Background Map ------------------------------------------------
328
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800329 function setUpNoDevs() {
330 var g, box;
331 noDevsLayer = svg.append('g').attr({
332 id: 'topo-noDevsLayer',
Steven Burrows1c2a9682017-07-14 16:52:46 +0100333 transform: sus.translate(500, 500),
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800334 });
335 // Note, SVG viewbox is '0 0 1000 1000', defined in topo.html.
336 // We are translating this layer to have its origin at the center
337
338 g = noDevsLayer.append('g');
339 gs.addGlyph(g, 'bird', 100).attr('class', 'noDevsBird');
Simon Hunt3f89cb42017-08-10 13:32:00 -0700340 g.append('text').text(topoLion('no_devices_are_connected'))
Steven Burrows1c2a9682017-07-14 16:52:46 +0100341 .attr({ x: 120, y: 80 });
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800342
343 box = g.node().getBBox();
344 box.x -= box.width/2;
345 box.y -= box.height/2;
346 g.attr('transform', sus.translate(box.x, box.y));
347
348 showNoDevs(true);
349 }
350
Simon Hunt3f89cb42017-08-10 13:32:00 -0700351 function lionNoDevs() {
352 d3.select('#topo-noDevsLayer g text')
353 .text(topoLion('no_devices_are_connected'));
354 }
355
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800356 function showNoDevs(b) {
Simon Hunt18bf9822015-02-12 17:35:45 -0800357 sus.visible(noDevsLayer, b);
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800358 }
359
Simon Hunt2362b072015-06-11 20:08:22 -0700360
361 var countryFilters = {
Simon Hunt2362b072015-06-11 20:08:22 -0700362 s_america: function (c) {
363 return c.properties.continent === 'South America';
364 },
365
Simon Huntac099e82015-12-03 09:17:47 -0800366 ns_america: function (c) {
367 return c.properties.custom === 'US-cont' ||
368 c.properties.subregion === 'Central America' ||
Simon Huntd4712622015-12-02 11:19:50 -0800369 c.properties.continent === 'South America';
370 },
371
Simon Hunt2362b072015-06-11 20:08:22 -0700372 japan: function (c) {
373 return c.properties.geounit === 'Japan';
374 },
375
376 europe: function (c) {
377 return c.properties.continent === 'Europe';
378 },
379
380 italy: function (c) {
381 return c.properties.geounit === 'Italy';
382 },
383
384 uk: function (c) {
385 // technically, Ireland is not part of the United Kingdom,
386 // but the map looks weird without it showing.
387 return c.properties.adm0_a3 === 'GBR' ||
388 c.properties.adm0_a3 === 'IRL';
Simon Hunt1178d5b2015-09-02 17:02:37 -0700389 },
390
391 s_korea: function (c) {
392 return c.properties.adm0_a3 === 'KOR';
393 },
394
395 australia: function (c) {
396 return c.properties.adm0_a3 === 'AUS';
Steven Burrows1c2a9682017-07-14 16:52:46 +0100397 },
Simon Hunt2362b072015-06-11 20:08:22 -0700398 };
399
Simon Hunta34fcb52016-02-25 16:27:32 -0800400 var tintOn = 0,
401 shadeFlip = 0,
402 shadePalette = {
403 light: {
404 sea: 'aliceblue',
405 land: 'white',
Steven Burrows1c2a9682017-07-14 16:52:46 +0100406 outline: '#ddd',
Simon Hunta34fcb52016-02-25 16:27:32 -0800407 },
408 dark: {
409 sea: '#001830',
410 land: '#232331',
Steven Burrows1c2a9682017-07-14 16:52:46 +0100411 outline: '#3a3a3a',
412 },
Simon Hunta34fcb52016-02-25 16:27:32 -0800413 };
414
415 function shading() {
416 return tintOn ? {
417 palette: shadePalette[th.theme()],
Steven Burrows1c2a9682017-07-14 16:52:46 +0100418 flip: shadeFlip,
Simon Hunta34fcb52016-02-25 16:27:32 -0800419 } : '';
420 }
Simon Hunt2362b072015-06-11 20:08:22 -0700421
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700422 function setMap(map) {
423 ps.setPrefs('topo_mapid', map);
Simon Hunt90053ed2016-04-06 12:49:02 -0700424 setUpMap();
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700425 opacifyMap(true);
426 }
427
428 function currentMap() {
429 return ps.getPrefs(
430 'topo_mapid',
Steven Burrows3a9a6442016-05-05 15:31:16 +0100431 {
432 mapid: 'usa',
433 mapscale: 1,
434 mapfilepath: '*continental_us',
Steven Burrows1c2a9682017-07-14 16:52:46 +0100435 tint: 'off',
Steven Burrows3a9a6442016-05-05 15:31:16 +0100436 },
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700437 $loc.search()
438 );
439 }
440
Simon Hunt90053ed2016-04-06 12:49:02 -0700441 function setUpMap() {
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700442 var prefs = currentMap(),
Simon Hunt8a119b02016-03-29 16:00:32 -0700443 mapId = prefs.mapid,
Steven Burrows3a9a6442016-05-05 15:31:16 +0100444 mapFilePath = prefs.mapfilepath,
Simon Hunt8a119b02016-03-29 16:00:32 -0700445 mapScale = prefs.mapscale,
446 tint = prefs.tint,
Simon Hunt2362b072015-06-11 20:08:22 -0700447 promise,
Simon Huntfacad992016-02-25 09:58:33 -0800448 cfilter;
Simon Hunt2362b072015-06-11 20:08:22 -0700449
Simon Hunta34fcb52016-02-25 16:27:32 -0800450 tintOn = tint === 'on' ? 1 : 0;
451
Simon Hunt18491362016-03-04 11:09:42 -0800452 $log.debug('setUpMap() mapId:', mapId, ', mapScale:', mapScale,
453 ', tint:', tint);
454
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700455 mapG = d3.select('#topo-map');
456 if (mapG.empty()) {
457 mapG = zoomLayer.append('g').attr('id', 'topo-map');
458 } else {
Steven Burrows1c2a9682017-07-14 16:52:46 +0100459 mapG.each(function (d, i) {
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700460 d3.selectAll(this.childNodes).remove();
461 });
462 }
Steven Burrows3a9a6442016-05-05 15:31:16 +0100463
464 if (mapFilePath === '*countries') {
465
Simon Hunt90053ed2016-04-06 12:49:02 -0700466 cfilter = countryFilters[mapId] || countryFilters.uk;
Steven Burrows3a9a6442016-05-05 15:31:16 +0100467
Simon Hunta34fcb52016-02-25 16:27:32 -0800468 promise = ms.loadMapRegionInto(mapG, {
469 countryFilter: cfilter,
470 adjustScale: mapScale,
Steven Burrows1c2a9682017-07-14 16:52:46 +0100471 shading: shading(),
Simon Hunta34fcb52016-02-25 16:27:32 -0800472 });
Steven Burrows3a9a6442016-05-05 15:31:16 +0100473 } else {
474
475 promise = ms.loadMapInto(mapG, mapFilePath, mapId, {
476 adjustScale: mapScale,
Steven Burrows1c2a9682017-07-14 16:52:46 +0100477 shading: shading(),
Steven Burrows3a9a6442016-05-05 15:31:16 +0100478 });
Simon Hunt2362b072015-06-11 20:08:22 -0700479 }
Steven Burrows3a9a6442016-05-05 15:31:16 +0100480
Simon Hunt8a119b02016-03-29 16:00:32 -0700481 ps.setPrefs('topo_mapid', prefs);
Simon Hunt2362b072015-06-11 20:08:22 -0700482 return promise;
Simon Hunt0541fb82015-01-14 18:59:57 -0800483 }
484
Simon Huntf51bf462016-06-29 16:22:57 -0700485 function mapReshader() {
Steven Burrows1c2a9682017-07-14 16:52:46 +0100486 $log.debug('... Re-shading map ...');
Simon Huntf51bf462016-06-29 16:22:57 -0700487 ms.reshade(shading());
488 }
489
Simon Hunta34fcb52016-02-25 16:27:32 -0800490 // set up theme listener to re-shade the map when required.
491 function mapShader(on) {
492 if (on) {
Simon Huntf51bf462016-06-29 16:22:57 -0700493 th.addListener(mapReshader);
Simon Hunta34fcb52016-02-25 16:27:32 -0800494 } else {
Simon Huntf51bf462016-06-29 16:22:57 -0700495 th.removeListener(mapReshader);
Simon Hunta34fcb52016-02-25 16:27:32 -0800496 }
497 }
498
Simon Huntc3c5b672015-02-20 11:32:13 -0800499 function opacifyMap(b) {
500 mapG.transition()
501 .duration(1000)
502 .attr('opacity', b ? 1 : 0);
503 }
Simon Hunt737c89f2015-01-28 12:23:19 -0800504
Simon Hunt90053ed2016-04-06 12:49:02 -0700505 function setUpSprites() {
Simon Hunt8a119b02016-03-29 16:00:32 -0700506 var prefs = ps.getPrefs('topo_sprites', { sprites: '' }, $loc.search()),
507 sprId = prefs.sprites;
Simon Huntf9fc0e72015-04-16 15:10:57 -0700508
Steven Burrows1c2a9682017-07-14 16:52:46 +0100509 spriteG = zoomLayer.append('g').attr('id', 'topo-sprites');
Simon Huntf9fc0e72015-04-16 15:10:57 -0700510 if (sprId) {
Simon Hunt8a119b02016-03-29 16:00:32 -0700511 ps.setPrefs('topo_sprites', prefs);
Simon Huntf9fc0e72015-04-16 15:10:57 -0700512 tspr.loadSprites(spriteG, defs, sprId);
513 }
514 }
Simon Hunt9c1c45e2015-04-10 13:38:27 -0700515
Simon Huntc7ae7952015-04-08 18:59:27 -0700516 // --- User Preferemces ----------------------------------------------
Simon Hunt36a58c62015-04-08 11:00:07 -0700517
Simon Huntc7ae7952015-04-08 18:59:27 -0700518 var prefsState = {};
Simon Hunt36a58c62015-04-08 11:00:07 -0700519
Simon Huntc7ae7952015-04-08 18:59:27 -0700520 function updatePrefsState(what, b) {
521 prefsState[what] = b ? 1 : 0;
522 ps.setPrefs('topo_prefs', prefsState);
Simon Hunt36a58c62015-04-08 11:00:07 -0700523 }
524
Simon Hunt36a58c62015-04-08 11:00:07 -0700525
Simon Huntc7ae7952015-04-08 18:59:27 -0700526 function restoreConfigFromPrefs() {
527 // NOTE: toolbar will have set this for us..
Simon Huntfc5c5842017-02-01 23:32:18 -0800528 prefsState = ps.asNumbers(
529 ps.getPrefs('topo_prefs', ttbs.defaultPrefs), ['ovid'], true
530 );
Simon Hunt36a58c62015-04-08 11:00:07 -0700531
Simon Hunte1ce4292015-06-12 13:07:02 -0700532 $log.debug('TOPO- Prefs State:', prefsState);
Simon Huntc7ae7952015-04-08 18:59:27 -0700533
Simon Huntf41f3092015-04-16 10:33:26 -0700534 flash.enable(false);
Simon Huntc7ae7952015-04-08 18:59:27 -0700535 toggleInstances(prefsState.insts);
Simon Huntee7a3ce2015-04-09 13:28:37 -0700536 toggleSummary(prefsState.summary);
Simon Hunt239e5882015-04-23 15:07:04 -0700537 toggleUseDetailsFlag(prefsState.detail);
Bri Prebilic Cole9b80ca02015-08-03 11:26:54 -0700538 toggleHosts(prefsState.hosts);
539 toggleOffline(prefsState.offdev);
540 togglePorts(prefsState.porthl);
541 toggleMap(prefsState.bg);
Simon Huntf9fc0e72015-04-16 15:10:57 -0700542 toggleSprites(prefsState.spr);
Thomas Vachuska0af26912016-03-21 21:37:30 -0700543 t3s.setDevLabIndex(prefsState.dlbls);
Simon Hunt10618f62017-06-15 19:30:52 -0700544 t3s.setHostLabIndex(prefsState.hlbls);
Simon Huntf41f3092015-04-16 10:33:26 -0700545 flash.enable(true);
Simon Hunt36a58c62015-04-08 11:00:07 -0700546 }
547
548
Simon Hunte1ce4292015-06-12 13:07:02 -0700549 // somewhat hackish, because summary update cannot happen until we
550 // have opened the websocket to the server; hence this extra function
551 // invoked after tes.start()
552 function restoreSummaryFromPrefs() {
Simon Huntfc5c5842017-02-01 23:32:18 -0800553 prefsState = ps.asNumbers(
554 ps.getPrefs('topo_prefs', ttbs.defaultPrefs), ['ovid'], true
555 );
Simon Hunte1ce4292015-06-12 13:07:02 -0700556 $log.debug('TOPO- Prefs SUMMARY State:', prefsState.summary);
557
558 flash.enable(false);
559 toggleSummary(prefsState.summary);
560 flash.enable(true);
561 }
562
Simon Hunt8419efd2017-01-12 12:36:28 -0800563 // initial set of topo events received, now do post-processing
Simon Hunt4a6b54b2015-10-27 22:08:25 -0700564 function topoStartDone() {
Simon Hunt8419efd2017-01-12 12:36:28 -0800565 // give a small delay before attempting to reselect node(s) and
566 // highlight elements, since they have to be re-added to the DOM first...
Simon Hunt7faabd52016-08-18 16:16:19 -0700567 $timeout(function () {
Simon Hunt8419efd2017-01-12 12:36:28 -0800568 $log.debug('^^ topo.topoStartDone() ^^');
569
570 // reselect the previous selection...
Simon Hunt7faabd52016-08-18 16:16:19 -0700571 tss.reselect();
Simon Hunt8419efd2017-01-12 12:36:28 -0800572
573 // if an intent should be shown, invoke the appropriate callback
574 if ($scope.intentData) {
Simon Hunt8419efd2017-01-12 12:36:28 -0800575 tov.hooks.showIntent($scope.intentData);
Simon Hunt7faabd52016-08-18 16:16:19 -0700576 }
Simon Hunt8419efd2017-01-12 12:36:28 -0800577
Simon Hunt7faabd52016-08-18 16:16:19 -0700578 }, 200);
Simon Hunt4a6b54b2015-10-27 22:08:25 -0700579 }
Simon Hunte1ce4292015-06-12 13:07:02 -0700580
Simon Huntcacce342015-01-07 16:13:05 -0800581 // --- Controller Definition -----------------------------------------
582
Simon Hunt6cc53692015-01-07 11:33:45 -0800583 angular.module('ovTopo', moduleDependencies)
Simon Hunt5989ddf2017-08-02 20:38:12 -0700584 .controller('OvTopoCtrl',
585 ['$scope', '$log', '$location', '$timeout', '$cookies',
586 'FnService', 'MastService', 'KeyService', 'ZoomService',
Simon Hunt0e48c292015-02-19 16:11:37 -0800587 'GlyphService', 'MapService', 'SvgUtilService', 'FlashService',
Simon Hunta34fcb52016-02-25 16:27:32 -0800588 'WebSocketService', 'PrefsService', 'ThemeService',
Simon Hunt5989ddf2017-08-02 20:38:12 -0700589 'TopoDialogService', 'TopoD3Service', 'TopoEventService',
590 'TopoForceService', 'TopoPanelService', 'TopoInstService',
591 'TopoSelectService', 'TopoLinkService', 'TopoTrafficService',
592 'TopoObliqueService', 'TopoFilterService', 'TopoToolbarService',
593 'TopoMapService', 'TopoSpriteService', 'TooltipService',
594 'TopoOverlayService', 'LionService',
Simon Hunt6cc53692015-01-07 11:33:45 -0800595
Simon Hunt5989ddf2017-08-02 20:38:12 -0700596 function (_$scope_, _$log_, _$loc_, _$timeout_, _$cookies_,
597 _fs_, mast, _ks_, _zs_,
598 _gs_, _ms_, _sus_, _flash_,
599 _wss_, _ps_, _th_,
Thomas Vachuska0af26912016-03-21 21:37:30 -0700600 _tds_, _t3s_, _tes_,
Simon Hunt5989ddf2017-08-02 20:38:12 -0700601 _tfs_, _tps_, _tis_,
602 _tss_, _tls_, _tts_,
603 _tos_, _fltr_, _ttbs_,
604 _tms_, _tspr_, _ttip_,
605 _tov_, lion) {
Simon Huntfc5c5842017-02-01 23:32:18 -0800606
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700607 var params = _$loc_.search(),
Simon Huntfc5c5842017-02-01 23:32:18 -0800608 selOverlay = params.overlayId,
Simon Hunt4a6b54b2015-10-27 22:08:25 -0700609 projection,
Simon Hunt3a6eec02015-02-09 21:16:43 -0800610 dim,
Simon Hunt1894d792015-02-04 17:09:20 -0800611 uplink = {
612 // provides function calls back into this space
613 showNoDevs: showNoDevs,
614 projection: function () { return projection; },
Simon Huntc3c5b672015-02-20 11:32:13 -0800615 zoomLayer: function () { return zoomLayer; },
Simon Huntfb8ea1f2015-02-24 21:38:09 -0800616 zoomer: function () { return zoomer; },
Simon Hunt4a6b54b2015-10-27 22:08:25 -0700617 opacifyMap: opacifyMap,
Steven Burrows1c2a9682017-07-14 16:52:46 +0100618 topoStartDone: topoStartDone,
Simon Huntac4c6f72015-02-03 19:50:53 -0800619 };
620
Bri Prebilic Cole068814d2015-05-14 16:06:38 -0700621 $scope = _$scope_;
Simon Hunt6cc53692015-01-07 11:33:45 -0800622 $log = _$log_;
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700623 $loc = _$loc_;
Simon Hunt7faabd52016-08-18 16:16:19 -0700624 $timeout = _$timeout_;
Simon Hunta11b4eb2015-01-28 16:20:50 -0800625 fs = _fs_;
Simon Hunt6cc53692015-01-07 11:33:45 -0800626 ks = _ks_;
Simon Huntcacce342015-01-07 16:13:05 -0800627 zs = _zs_;
Simon Hunt6cc53692015-01-07 11:33:45 -0800628 gs = _gs_;
Simon Hunt1e8eff42015-01-08 17:19:02 -0800629 ms = _ms_;
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800630 sus = _sus_;
Simon Hunt0e48c292015-02-19 16:11:37 -0800631 flash = _flash_;
Simon Hunt237676b52015-03-10 19:04:26 -0700632 wss = _wss_;
Simon Huntc7ae7952015-04-08 18:59:27 -0700633 ps = _ps_;
Simon Hunta34fcb52016-02-25 16:27:32 -0800634 th = _th_;
Simon Hunta211f7f2015-11-09 12:48:23 -0800635 tds = _tds_;
Thomas Vachuska0af26912016-03-21 21:37:30 -0700636 t3s = _t3s_;
Simon Huntc252aa62015-02-10 16:45:39 -0800637 tes = _tes_;
Simon Hunt737c89f2015-01-28 12:23:19 -0800638 tfs = _tfs_;
Simon Hunt96f88c62015-02-19 17:57:25 -0800639 // TODO: consider funnelling actions through TopoForceService...
640 // rather than injecting references to these 'sub-modules',
641 // just so we can invoke functions on them.
Simon Huntc252aa62015-02-10 16:45:39 -0800642 tps = _tps_;
Simon Huntac4c6f72015-02-03 19:50:53 -0800643 tis = _tis_;
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700644 tms = _tms_;
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700645 tls = _tls_;
Simon Hunt96f88c62015-02-19 17:57:25 -0800646 tos = _tos_;
Bri Prebilic Coleb5f2b152015-04-07 14:58:09 -0700647 fltr = _fltr_;
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700648 ttbs = _ttbs_;
Simon Hunta4281242016-02-26 20:18:45 -0800649 tspr = _tspr_;
Simon Hunt72e44bf2015-07-21 21:34:20 -0700650 tov = _tov_;
Steven Burrows1c2a9682017-07-14 16:52:46 +0100651 tss = _tss_;
Simon Huntef31fb22014-12-19 13:16:44 -0800652
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700653 tms.start({
654 toggleMap: toggleMap,
655 currentMap: currentMap,
Steven Burrows1c2a9682017-07-14 16:52:46 +0100656 setMap: setMap,
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700657 });
658
Simon Hunt441c9ae2017-02-03 18:22:31 -0800659 // pull intent data from the query string...
Viswanath KSP0f297702016-08-13 18:02:43 +0530660 if (params.key && params.appId && params.appName) {
Simon Hunt4a6b54b2015-10-27 22:08:25 -0700661 $scope.intentData = {
Viswanath KSP0f297702016-08-13 18:02:43 +0530662 key: params.key,
663 appId: params.appId,
Simon Hunt441c9ae2017-02-03 18:22:31 -0800664 appName: params.appName,
Steven Burrows1c2a9682017-07-14 16:52:46 +0100665 intentType: params.intentType,
Simon Hunt4a6b54b2015-10-27 22:08:25 -0700666 };
667 }
668
Bri Prebilic Cole068814d2015-05-14 16:06:38 -0700669 $scope.notifyResize = function () {
Simon Huntb0ec1e52015-01-28 18:13:49 -0800670 svgResized(fs.windowSize(mast.mastHeight()));
Simon Hunt426bd862015-01-14 16:48:41 -0800671 };
Simon Huntef31fb22014-12-19 13:16:44 -0800672
Simon Hunt54442fa2015-01-26 14:17:38 -0800673 // Cleanup on destroyed scope..
Simon Hunt584122a2015-01-21 15:32:40 -0800674 $scope.$on('$destroy', function () {
675 $log.log('OvTopoCtrl is saying Buh-Bye!');
Thomas Vachuska329af532015-03-10 02:08:33 -0700676 tes.stop();
Thomas Vachuska26be4f32016-03-31 01:10:27 -0700677 tms.stop();
Bri Prebilic Cole9dcaea52015-07-21 14:39:48 -0700678 ks.unbindKeys();
Simon Hunt626d2102015-01-29 11:54:50 -0800679 tps.destroyPanels();
Simon Hunta211f7f2015-11-09 12:48:23 -0800680 tds.closeDialog();
Simon Hunt4b668592015-01-29 17:33:53 -0800681 tis.destroyInst();
Simon Hunt3a6eec02015-02-09 21:16:43 -0800682 tfs.destroyForce();
Bri Prebilic Coled6219052015-03-19 14:34:02 -0700683 ttbs.destroyToolbar();
Simon Hunta34fcb52016-02-25 16:27:32 -0800684 mapShader(false);
Simon Hunt584122a2015-01-21 15:32:40 -0800685 });
686
Simon Huntcacce342015-01-07 16:13:05 -0800687 // svg layer and initialization of components
Simon Hunt426bd862015-01-14 16:48:41 -0800688 ovtopo = d3.select('#ov-topo');
689 svg = ovtopo.select('svg');
Simon Hunta11b4eb2015-01-28 16:20:50 -0800690 // set the svg size to match that of the window, less the masthead
691 svg.attr(fs.windowSize(mast.mastHeight()));
Simon Hunt3a6eec02015-02-09 21:16:43 -0800692 dim = [svg.attr('width'), svg.attr('height')];
Simon Hunt426bd862015-01-14 16:48:41 -0800693
Simon Hunt6cc53692015-01-07 11:33:45 -0800694 setUpKeys();
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700695 setUpToolbar();
Simon Hunt6cc53692015-01-07 11:33:45 -0800696 setUpDefs();
Simon Huntcacce342015-01-07 16:13:05 -0800697 setUpZoom();
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800698 setUpNoDevs();
Simon Hunt90053ed2016-04-06 12:49:02 -0700699 setUpMap().then(
Simon Hunt1894d792015-02-04 17:09:20 -0800700 function (proj) {
Steven Burrows1c2a9682017-07-14 16:52:46 +0100701 var z = ps.getPrefs('topo_zoom', { tx: 0, ty: 0, sc: 1 });
Simon Huntbb5e0d82015-04-16 14:25:46 -0700702 zoomer.panZoom([z.tx, z.ty], z.sc);
703 $log.debug('** Zoom restored:', z);
704
Simon Hunt1894d792015-02-04 17:09:20 -0800705 projection = proj;
Simon Huntbb5e0d82015-04-16 14:25:46 -0700706 $log.debug('** We installed the projection:', proj);
Simon Huntf41f3092015-04-16 10:33:26 -0700707 flash.enable(false);
Simon Huntc7ae7952015-04-08 18:59:27 -0700708 toggleMap(prefsState.bg);
Simon Huntf41f3092015-04-16 10:33:26 -0700709 flash.enable(true);
Simon Hunta34fcb52016-02-25 16:27:32 -0800710 mapShader(true);
Simon Hunte1ce4292015-06-12 13:07:02 -0700711
Simon Hunt5989ddf2017-08-02 20:38:12 -0700712 // piggyback off the deferred map loading to load the
713 // localization bundle after the uber bundle has arrived...
714 $scope.lion = lion.bundle('core.view.Topo');
715 topoLion = $scope.lion;
716 $log.debug('Loaded Topo LION Bundle:', topoLion);
717
Simon Hunt3f89cb42017-08-10 13:32:00 -0700718 // insert localized text into already established
719 // DOM elements...
720 lionNoDevs();
721
Simon Hunte1ce4292015-06-12 13:07:02 -0700722 // now we have the map projection, we are ready for
723 // the server to send us device/host data...
724 tes.start();
725 // need to do the following so we immediately get
726 // the summary panel data back from the server
727 restoreSummaryFromPrefs();
Simon Hunt1894d792015-02-04 17:09:20 -0800728 }
729 );
Simon Hunta4281242016-02-26 20:18:45 -0800730 tes.bindHandlers();
Simon Hunt90053ed2016-04-06 12:49:02 -0700731 setUpSprites();
Simon Huntfd1231a2015-01-26 22:14:51 -0800732
Simon Hunt1894d792015-02-04 17:09:20 -0800733 forceG = zoomLayer.append('g').attr('id', 'topo-force');
Simon Huntfb8ea1f2015-02-24 21:38:09 -0800734 tfs.initForce(svg, forceG, uplink, dim);
Simon Hunta142dd22015-02-12 22:07:51 -0800735 tis.initInst({ showMastership: tfs.showMastership });
Simon Hunt237676b52015-03-10 19:04:26 -0700736 tps.initPanels();
Simon Hunt6cc53692015-01-07 11:33:45 -0800737
Simon Huntc7ae7952015-04-08 18:59:27 -0700738 restoreConfigFromPrefs();
Simon Huntfc5c5842017-02-01 23:32:18 -0800739
740 ttbs.selectOverlay(selOverlay || prefsState.ovid);
Simon Hunt36a58c62015-04-08 11:00:07 -0700741
Simon Hunt72e44bf2015-07-21 21:34:20 -0700742 $log.debug('registered overlays...', tov.list());
Simon Hunt6cc53692015-01-07 11:33:45 -0800743 $log.log('OvTopoCtrl has been created');
Simon Huntef31fb22014-12-19 13:16:44 -0800744 }]);
745}());