blob: 7db17f0d85796d907f2ee92bb06059d3a21bc55b [file] [log] [blame]
Simon Huntb0ec1e52015-01-28 18:13:49 -08001/*
2 * Copyright 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 -- Topology Panel Module.
19 Defines functions for manipulating the summary, detail, and instance panels.
20 */
21
22(function () {
23 'use strict';
24
25 // injected refs
Bri Prebilic Cole17c6d0a2015-07-16 14:56:40 -070026 var $log, $window, $rootScope, fs, ps, gs, flash, wss, bns, mast, ns;
Simon Huntb0ec1e52015-01-28 18:13:49 -080027
Simon Hunt626d2102015-01-29 11:54:50 -080028 // constants
Simon Hunt08f841d02015-02-10 14:39:20 -080029 var pCls = 'topo-p',
30 idSum = 'topo-p-summary',
Simon Hunt626d2102015-01-29 11:54:50 -080031 idDet = 'topo-p-detail',
Simon Hunt626d2102015-01-29 11:54:50 -080032 panelOpts = {
33 width: 260
Bri Prebilic Cole69d5f4e2015-05-19 15:59:55 -070034 },
Simon Hunt7b41c4a2015-06-10 10:42:01 -070035 sumMax = 240,
Bri Prebilic Cole17c6d0a2015-07-16 14:56:40 -070036 padTop = 20,
37 devPath = 'device';
Simon Hunt626d2102015-01-29 11:54:50 -080038
Simon Hunt0c6b2d32015-03-26 17:46:29 -070039 // internal state
40 var useDetails = true, // should we show details if we have 'em?
Bri Prebilic Coled8745462015-06-01 16:08:57 -070041 haveDetails = false, // do we have details that we could show?
Bri Prebilic Cole0a6ffb62015-06-04 09:32:12 -070042 sumFromTop, // summary panel distance from top of screen
43 unbindWatch;
Simon Huntb0ec1e52015-01-28 18:13:49 -080044
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -070045 // panels
46 var summary, detail;
47
48 // === -----------------------------------------------------
49 // Panel API
50 function createTopoPanel(id, opts) {
51 var p = ps.createPanel(id, opts),
Bri Prebilic Cole35d29712015-05-11 16:01:32 -070052 pid = id,
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -070053 header, body, footer;
54 p.classed(pCls, true);
55
Bri Prebilic Cole35d29712015-05-11 16:01:32 -070056 function panel() {
57 return p;
58 }
59
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -070060 function hAppend(x) {
61 return header.append(x);
62 }
63
64 function bAppend(x) {
65 return body.append(x);
66 }
67
68 function fAppend(x) {
69 return footer.append(x);
70 }
71
72 function setup() {
73 p.empty();
74
75 p.append('div').classed('header', true);
76 p.append('div').classed('body', true);
77 p.append('div').classed('footer', true);
78
79 header = p.el().select('.header');
80 body = p.el().select('.body');
81 footer = p.el().select('.footer');
82 }
83
Bri Prebilic Cole35d29712015-05-11 16:01:32 -070084 function destroy() {
85 ps.destroyPanel(pid);
86 }
87
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -070088 // fromTop is how many pixels from the top of the page the panel is
89 // max is the max height of the panel in pixels
90 // only adjusts if the body content would be 10px or larger
91 function adjustHeight(fromTop, max) {
92 var totalPHeight, avSpace,
93 overflow = 0,
94 pdg = 30;
95
96 if (!fromTop) {
97 $log.warn('adjustHeight: height from top of page not given');
98 return null;
99 } else if (!body || !p) {
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700100 $log.warn('adjustHeight: panel contents are not defined');
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700101 return null;
102 }
103
104 p.el().style('height', null);
105 body.style('height', null);
106
107 totalPHeight = fromTop + p.height();
108 avSpace = fs.windowSize(pdg).height;
109
110 if (totalPHeight >= avSpace) {
111 overflow = totalPHeight - avSpace;
112 }
113
114 function _adjustBody(height) {
115 if (height < 10) {
116 return false;
117 } else {
118 body.style('height', height + 'px');
119 }
120 return true;
121 }
122
123 if (!_adjustBody(fs.noPxStyle(body, 'height') - overflow)) {
124 return;
125 }
126
127 if (max && p.height() > max) {
128 _adjustBody(fs.noPxStyle(body, 'height') - (p.height() - max));
129 }
130 }
131
132 return {
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700133 panel: panel,
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700134 setup: setup,
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700135 destroy: destroy,
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700136 appendHeader: hAppend,
137 appendBody: bAppend,
138 appendFooter: fAppend,
139 adjustHeight: adjustHeight
140 };
141 }
142
Simon Hunt08f841d02015-02-10 14:39:20 -0800143 // === -----------------------------------------------------
144 // Utility functions
Simon Hunt626d2102015-01-29 11:54:50 -0800145
Simon Hunt4b668592015-01-29 17:33:53 -0800146 function addSep(tbody) {
147 tbody.append('tr').append('td').attr('colspan', 2).append('hr');
148 }
149
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700150 function addBtnFooter() {
151 detail.appendFooter('hr');
152 detail.appendFooter('div').classed('actionBtns', true);
153 }
154
Simon Hunt4b668592015-01-29 17:33:53 -0800155 function addProp(tbody, label, value) {
Simon Hunte25c5a22015-04-02 14:37:12 -0700156 var tr = tbody.append('tr'),
Bri Prebilic Colef5e48b12015-04-21 14:52:36 -0700157 lab;
158 if (typeof label === 'string') {
Simon Hunte25c5a22015-04-02 14:37:12 -0700159 lab = label.replace(/_/g, ' ');
Bri Prebilic Colef5e48b12015-04-21 14:52:36 -0700160 } else {
161 lab = label;
162 }
Simon Hunt4b668592015-01-29 17:33:53 -0800163
164 function addCell(cls, txt) {
Simon Hunta36f03b2015-04-01 15:22:49 -0700165 tr.append('td').attr('class', cls).html(txt);
Simon Hunt4b668592015-01-29 17:33:53 -0800166 }
Simon Hunte25c5a22015-04-02 14:37:12 -0700167 addCell('label', lab + ' :');
Simon Hunt4b668592015-01-29 17:33:53 -0800168 addCell('value', value);
169 }
170
Simon Hunt08f841d02015-02-10 14:39:20 -0800171 function listProps(tbody, data) {
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700172 data.propOrder.forEach(function (p) {
Simon Hunt08f841d02015-02-10 14:39:20 -0800173 if (p === '-') {
174 addSep(tbody);
175 } else {
176 addProp(tbody, p, data.props[p]);
177 }
178 });
179 }
180
Bri Prebilic Cole69d5f4e2015-05-19 15:59:55 -0700181 function watchWindow() {
Bri Prebilic Cole0a6ffb62015-06-04 09:32:12 -0700182 unbindWatch = $rootScope.$watchCollection(
Bri Prebilic Cole69d5f4e2015-05-19 15:59:55 -0700183 function () {
184 return {
185 h: $window.innerHeight,
186 w: $window.innerWidth
187 };
188 }, function () {
189 summary.adjustHeight(sumFromTop, sumMax);
190 detail.adjustHeight(detail.ypos.current);
191 }
192 );
193 }
194
Simon Hunt08f841d02015-02-10 14:39:20 -0800195 // === -----------------------------------------------------
196 // Functions for populating the summary panel
197
198 function populateSummary(data) {
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700199 summary.setup();
Simon Hunt08f841d02015-02-10 14:39:20 -0800200
Bri Prebilic Cole8d3de3d2015-05-15 16:02:59 -0700201 var svg = summary.appendHeader('div')
202 .classed('icon', true)
203 .append('svg'),
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700204 title = summary.appendHeader('h2'),
205 table = summary.appendBody('table'),
Simon Hunt629b99e2015-07-27 17:38:33 -0700206 tbody = table.append('tbody'),
207 glyphId = data.type || 'node';
Simon Hunt08f841d02015-02-10 14:39:20 -0800208
Simon Hunt629b99e2015-07-27 17:38:33 -0700209 gs.addGlyph(svg, glyphId, 40);
210
211 if (glyphId === 'node') {
212 gs.addGlyph(svg, 'bird', 24, true, [8,12]);
213 }
Simon Hunt08f841d02015-02-10 14:39:20 -0800214
Simon Hunt0af1ec32015-07-24 12:17:55 -0700215 title.text(data.title);
Simon Hunt08f841d02015-02-10 14:39:20 -0800216 listProps(tbody, data);
217 }
218
219 // === -----------------------------------------------------
220 // Functions for populating the detail panel
221
Simon Huntb745ca62015-07-28 15:37:11 -0700222 var isDevice = {
223 switch: 1,
224 roadm: 1
225 };
226
Simon Hunt08f841d02015-02-10 14:39:20 -0800227 function displaySingle(data) {
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700228 detail.setup();
Simon Hunt08f841d02015-02-10 14:39:20 -0800229
Bri Prebilic Cole8d3de3d2015-05-15 16:02:59 -0700230 var svg = detail.appendHeader('div')
Bri Prebilic Cole17c6d0a2015-07-16 14:56:40 -0700231 .classed('icon clickable', true)
Bri Prebilic Cole8d3de3d2015-05-15 16:02:59 -0700232 .append('svg'),
Bri Prebilic Cole17c6d0a2015-07-16 14:56:40 -0700233 title = detail.appendHeader('h2')
234 .classed('clickable', true),
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700235 table = detail.appendBody('table'),
Simon Huntb745ca62015-07-28 15:37:11 -0700236 tbody = table.append('tbody'),
237 navFn;
Simon Hunt08f841d02015-02-10 14:39:20 -0800238
239 gs.addGlyph(svg, (data.type || 'unknown'), 40);
Simon Huntb745ca62015-07-28 15:37:11 -0700240 title.text(data.title);
241
242 // only add navigation when displaying a device
243 if (isDevice[data.type]) {
244 navFn = function () {
245 ns.navTo(devPath, { devId: data.id });
246 };
247
248 svg.on('click', navFn);
249 title.on('click', navFn);
250 }
Bri Prebilic Cole17c6d0a2015-07-16 14:56:40 -0700251
Simon Hunt08f841d02015-02-10 14:39:20 -0800252 listProps(tbody, data);
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700253 addBtnFooter();
Simon Hunt08f841d02015-02-10 14:39:20 -0800254 }
255
256 function displayMulti(ids) {
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700257 detail.setup();
Simon Hunt08f841d02015-02-10 14:39:20 -0800258
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700259 var title = detail.appendHeader('h3'),
260 table = detail.appendBody('table'),
Simon Hunt08f841d02015-02-10 14:39:20 -0800261 tbody = table.append('tbody');
262
263 title.text('Selected Nodes');
264 ids.forEach(function (d, i) {
265 addProp(tbody, i+1, d);
266 });
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700267 addBtnFooter();
Simon Hunt08f841d02015-02-10 14:39:20 -0800268 }
269
Bri Prebilic Colef5e48b12015-04-21 14:52:36 -0700270 function addAction(o) {
271 var btnDiv = d3.select('#' + idDet)
272 .select('.actionBtns')
273 .append('div')
274 .classed('actionBtn', true);
Simon Hunt3a0598f2015-08-04 19:59:04 -0700275 bns.button(btnDiv, idDet + '-' + o.id, o.gid, o.cb, o.tt);
Simon Hunt08f841d02015-02-10 14:39:20 -0800276 }
277
Simon Hunta36f03b2015-04-01 15:22:49 -0700278 var friendlyIndex = {
279 device: 1,
280 host: 0
281 };
282
283 function friendly(d) {
284 var i = friendlyIndex[d.class] || 0;
285 return (d.labels && d.labels[i]) || '';
286 }
287
288 function linkSummary(d) {
289 var o = d && d.online ? 'online' : 'offline';
290 return d ? d.type + ' / ' + o : '-';
291 }
292
Simon Hunte25c5a22015-04-02 14:37:12 -0700293 // provided to change presentation of internal type name
294 var linkTypePres = {
295 hostLink: 'edge link'
296 };
297
298 function linkType(d) {
299 return linkTypePres[d.type()] || d.type();
300 }
301
302 var coreOrder = [
303 'Type', '-',
304 'A_type', 'A_id', 'A_label', 'A_port', '-',
305 'B_type', 'B_id', 'B_label', 'B_port', '-'
306 ],
307 edgeOrder = [
308 'Type', '-',
309 'A_type', 'A_id', 'A_label', '-',
310 'B_type', 'B_id', 'B_label', 'B_port'
311 ];
312
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700313 function displayLink(data) {
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700314 detail.setup();
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700315
Bri Prebilic Cole8d3de3d2015-05-15 16:02:59 -0700316 var svg = detail.appendHeader('div')
317 .classed('icon', true)
318 .append('svg'),
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700319 title = detail.appendHeader('h2'),
320 table = detail.appendBody('table'),
Simon Hunte25c5a22015-04-02 14:37:12 -0700321 tbody = table.append('tbody'),
322 edgeLink = data.type() === 'hostLink',
323 order = edgeLink ? edgeOrder : coreOrder;
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700324
325 gs.addGlyph(svg, 'ports', 40);
326 title.text('Link');
Simon Hunta36f03b2015-04-01 15:22:49 -0700327
Simon Hunta36f03b2015-04-01 15:22:49 -0700328
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700329 listProps(tbody, {
Simon Hunta36f03b2015-04-01 15:22:49 -0700330 propOrder: order,
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700331 props: {
Simon Hunte25c5a22015-04-02 14:37:12 -0700332 Type: linkType(data),
Simon Hunta36f03b2015-04-01 15:22:49 -0700333
334 A_type: data.source.class,
335 A_id: data.source.id,
336 A_label: friendly(data.source),
337 A_port: data.srcPort,
338
339 B_type: data.target.class,
340 B_id: data.target.id,
341 B_label: friendly(data.target),
342 B_port: data.tgtPort
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700343 }
344 });
Simon Hunta36f03b2015-04-01 15:22:49 -0700345
Simon Hunte25c5a22015-04-02 14:37:12 -0700346 if (!edgeLink) {
347 addProp(tbody, 'A &rarr; B', linkSummary(data.fromSource));
348 addProp(tbody, 'B &rarr; A', linkSummary(data.fromTarget));
349 }
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700350 }
351
352 function displayNothing() {
353 haveDetails = false;
354 hideDetailPanel();
355 }
356
357 function displaySomething() {
358 haveDetails = true;
359 if (useDetails) {
360 showDetailPanel();
361 }
362 }
363
Simon Hunt08f841d02015-02-10 14:39:20 -0800364 // === -----------------------------------------------------
365 // Event Handlers
366
367 function showSummary(data) {
368 populateSummary(data);
369 showSummaryPanel();
370 }
371
Simon Hunt36a58c62015-04-08 11:00:07 -0700372 function toggleSummary(x) {
Simon Huntee7a3ce2015-04-09 13:28:37 -0700373 var kev = (x === 'keyev'),
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700374 on = kev ? !summary.panel().isVisible() : !!x,
Simon Huntee7a3ce2015-04-09 13:28:37 -0700375 verb = on ? 'Show' : 'Hide';
Simon Hunt36a58c62015-04-08 11:00:07 -0700376
377 if (on) {
Simon Hunta0eb0a82015-02-11 12:30:06 -0800378 // ask server to start sending summary data.
Simon Hunt237676b52015-03-10 19:04:26 -0700379 wss.sendEvent('requestSummary');
Simon Hunta0eb0a82015-02-11 12:30:06 -0800380 // note: the summary panel will appear, once data arrives
Simon Hunt36a58c62015-04-08 11:00:07 -0700381 } else {
382 hideSummaryPanel();
Simon Hunt6036b192015-02-11 11:20:26 -0800383 }
Simon Huntee7a3ce2015-04-09 13:28:37 -0700384 flash.flash(verb + ' summary panel');
385 return on;
Simon Hunt6036b192015-02-11 11:20:26 -0800386 }
Simon Hunt08f841d02015-02-10 14:39:20 -0800387
388 // === -----------------------------------------------------
389 // === LOGIC For showing/hiding summary and detail panels...
390
Simon Hunt626d2102015-01-29 11:54:50 -0800391 function showSummaryPanel() {
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700392 function _show() {
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700393 summary.panel().show();
Bri Prebilic Cole69d5f4e2015-05-19 15:59:55 -0700394 summary.adjustHeight(sumFromTop, sumMax);
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700395 }
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700396 if (detail.panel().isVisible()) {
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700397 detail.down(_show);
Simon Hunt6036b192015-02-11 11:20:26 -0800398 } else {
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700399 _show();
Simon Hunt6036b192015-02-11 11:20:26 -0800400 }
Simon Huntc252aa62015-02-10 16:45:39 -0800401 }
402
403 function hideSummaryPanel() {
Simon Hunta0eb0a82015-02-11 12:30:06 -0800404 // instruct server to stop sending summary data
Simon Hunt237676b52015-03-10 19:04:26 -0700405 wss.sendEvent("cancelSummary");
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700406 summary.panel().hide(detail.up);
Simon Hunt4b668592015-01-29 17:33:53 -0800407 }
Simon Hunt626d2102015-01-29 11:54:50 -0800408
Simon Hunt08f841d02015-02-10 14:39:20 -0800409 function showDetailPanel() {
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700410 if (summary.panel().isVisible()) {
411 detail.down(detail.panel().show);
Simon Hunt6036b192015-02-11 11:20:26 -0800412 } else {
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700413 detail.up(detail.panel().show);
Simon Hunt6036b192015-02-11 11:20:26 -0800414 }
Simon Hunt08f841d02015-02-10 14:39:20 -0800415 }
416
417 function hideDetailPanel() {
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700418 detail.panel().hide();
Simon Hunt08f841d02015-02-10 14:39:20 -0800419 }
420
Simon Hunt6036b192015-02-11 11:20:26 -0800421 // ==========================
Simon Hunt08f841d02015-02-10 14:39:20 -0800422
Simon Hunt6036b192015-02-11 11:20:26 -0800423 function augmentDetailPanel() {
Bri Prebilic Coled8745462015-06-01 16:08:57 -0700424 var d = detail,
425 downPos = sumFromTop + sumMax + 20;
426 d.ypos = { up: sumFromTop, down: downPos, current: downPos};
Simon Hunt6036b192015-02-11 11:20:26 -0800427
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700428 d._move = function (y, cb) {
Bri Prebilic Cole69d5f4e2015-05-19 15:59:55 -0700429 var yp = d.ypos,
430 endCb;
431
432 if (fs.isF(cb)) {
433 endCb = function () {
434 cb();
435 d.adjustHeight(d.ypos.current);
436 }
437 } else {
438 endCb = function () {
439 d.adjustHeight(d.ypos.current);
440 }
441 }
Simon Hunt6036b192015-02-11 11:20:26 -0800442 if (yp.current !== y) {
443 yp.current = y;
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700444 d.panel().el().transition().duration(300)
Simon Hunt6036b192015-02-11 11:20:26 -0800445 .each('end', endCb)
446 .style('top', yp.current + 'px');
447 } else {
448 endCb();
449 }
450 };
451
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700452 d.down = function (cb) { d._move(d.ypos.down, cb); };
453 d.up = function (cb) { d._move(d.ypos.up, cb); };
Simon Hunt6036b192015-02-11 11:20:26 -0800454 }
Simon Hunt08f841d02015-02-10 14:39:20 -0800455
Simon Hunt239e5882015-04-23 15:07:04 -0700456 function toggleUseDetailsFlag(x) {
Simon Huntee7a3ce2015-04-09 13:28:37 -0700457 var kev = (x === 'keyev'),
458 verb;
459
460 useDetails = kev ? !useDetails : !!x;
461 verb = useDetails ? 'Enable' : 'Disable';
462
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700463 if (useDetails) {
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700464 if (haveDetails) {
465 showDetailPanel();
466 }
467 } else {
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700468 hideDetailPanel();
469 }
Simon Huntee7a3ce2015-04-09 13:28:37 -0700470 flash.flash(verb + ' details panel');
471 return useDetails;
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700472 }
473
Simon Hunt4b668592015-01-29 17:33:53 -0800474 // ==========================
475
Simon Hunt237676b52015-03-10 19:04:26 -0700476 function initPanels() {
Bri Prebilic Coled8745462015-06-01 16:08:57 -0700477 sumFromTop = mast.mastHeight() + padTop;
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700478 summary = createTopoPanel(idSum, panelOpts);
479 detail = createTopoPanel(idDet, panelOpts);
Simon Hunt6036b192015-02-11 11:20:26 -0800480
481 augmentDetailPanel();
Bri Prebilic Cole69d5f4e2015-05-19 15:59:55 -0700482 watchWindow();
Simon Hunt4b668592015-01-29 17:33:53 -0800483 }
484
485 function destroyPanels() {
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700486 summary.destroy();
487 summary = null;
488
489 detail.destroy();
490 detail = null;
Simon Hunt239e5882015-04-23 15:07:04 -0700491 haveDetails = false;
Bri Prebilic Cole0a6ffb62015-06-04 09:32:12 -0700492 unbindWatch();
Simon Hunt626d2102015-01-29 11:54:50 -0800493 }
494
495 // ==========================
496
Simon Huntb0ec1e52015-01-28 18:13:49 -0800497 angular.module('ovTopo')
498 .factory('TopoPanelService',
Bri Prebilic Cole69d5f4e2015-05-19 15:59:55 -0700499 ['$log', '$window', '$rootScope', 'FnService', 'PanelService', 'GlyphService',
Bri Prebilic Coled8745462015-06-01 16:08:57 -0700500 'FlashService', 'WebSocketService', 'ButtonService', 'MastService',
Bri Prebilic Cole17c6d0a2015-07-16 14:56:40 -0700501 'NavService',
Simon Huntb0ec1e52015-01-28 18:13:49 -0800502
Bri Prebilic Cole69d5f4e2015-05-19 15:59:55 -0700503 function (_$log_, _$window_, _$rootScope_,
Bri Prebilic Cole17c6d0a2015-07-16 14:56:40 -0700504 _fs_, _ps_, _gs_, _flash_, _wss_, _bns_, _mast_, _ns_) {
Simon Huntb0ec1e52015-01-28 18:13:49 -0800505 $log = _$log_;
Bri Prebilic Cole69d5f4e2015-05-19 15:59:55 -0700506 $window = _$window_;
507 $rootScope = _$rootScope_;
Simon Hunt6036b192015-02-11 11:20:26 -0800508 fs = _fs_;
Simon Huntb0ec1e52015-01-28 18:13:49 -0800509 ps = _ps_;
Simon Huntc9b73162015-01-29 14:02:15 -0800510 gs = _gs_;
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700511 flash = _flash_;
Simon Hunt237676b52015-03-10 19:04:26 -0700512 wss = _wss_;
Bri Prebilic Colef5e48b12015-04-21 14:52:36 -0700513 bns = _bns_;
Bri Prebilic Coled8745462015-06-01 16:08:57 -0700514 mast = _mast_;
Bri Prebilic Cole17c6d0a2015-07-16 14:56:40 -0700515 ns = _ns_;
Simon Huntb0ec1e52015-01-28 18:13:49 -0800516
Simon Huntb0ec1e52015-01-28 18:13:49 -0800517 return {
518 initPanels: initPanels,
Simon Hunt626d2102015-01-29 11:54:50 -0800519 destroyPanels: destroyPanels,
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700520 createTopoPanel: createTopoPanel,
Simon Hunt08f841d02015-02-10 14:39:20 -0800521
522 showSummary: showSummary,
Simon Hunt6036b192015-02-11 11:20:26 -0800523 toggleSummary: toggleSummary,
Simon Hunt08f841d02015-02-10 14:39:20 -0800524
Simon Hunt239e5882015-04-23 15:07:04 -0700525 toggleUseDetailsFlag: toggleUseDetailsFlag,
Simon Hunt08f841d02015-02-10 14:39:20 -0800526 displaySingle: displaySingle,
527 displayMulti: displayMulti,
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700528 displayLink: displayLink,
529 displayNothing: displayNothing,
530 displaySomething: displaySomething,
Bri Prebilic Cole684bcb72015-05-11 12:00:24 -0700531 addAction: addAction,
Simon Hunt08f841d02015-02-10 14:39:20 -0800532
Simon Huntc252aa62015-02-10 16:45:39 -0800533 hideSummaryPanel: hideSummaryPanel,
Simon Hunt08f841d02015-02-10 14:39:20 -0800534
Bri Prebilic Cole35d29712015-05-11 16:01:32 -0700535 detailVisible: function () { return detail.panel().isVisible(); },
536 summaryVisible: function () { return summary.panel().isVisible(); }
Simon Huntb0ec1e52015-01-28 18:13:49 -0800537 };
538 }]);
539}());