blob: 80413aa1f820f47d0d60378573f7e9d670592938 [file] [log] [blame]
Simon Hunta4242de2015-02-24 17:11:55 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Simon Hunta4242de2015-02-24 17:11:55 -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 D3 Module.
19 Functions for manipulating the D3 visualizations of the Topology
20 */
21
22(function () {
23 'use strict';
24
25 // injected refs
Thomas Vachuska0af26912016-03-21 21:37:30 -070026 var $log, fs, sus, is, ts, ps, ttbs;
Simon Hunta4242de2015-02-24 17:11:55 -080027
28 // api to topoForce
29 var api;
30 /*
31 node() // get ref to D3 selection of nodes
32 link() // get ref to D3 selection of links
33 linkLabel() // get ref to D3 selection of link labels
34 instVisible() // true if instances panel is visible
35 posNode() // position node
36 showHosts() // true if hosts are to be shown
37 restyleLinkElement() // update link styles based on backing data
38 updateLinkLabelModel() // update backing data for link labels
39 */
40
41 // configuration
Simon Hunta5487ad2016-06-16 13:10:41 -070042 var devIconDim = 36,
Simon Hunte9062fc2016-12-22 11:40:06 -080043 devColorDim = 32,
Simon Hunta5487ad2016-06-16 13:10:41 -070044 labelPad = 4,
45 hostRadius = 14,
46 badgeConfig = {
Simon Hunt5674db92015-10-22 16:12:48 -070047 radius: 12,
Simon Hunt004fc2c2015-10-23 11:55:58 -070048 yoff: 5,
49 gdelta: 10
Simon Hunta5487ad2016-06-16 13:10:41 -070050 },
51 halfDevIcon = devIconDim / 2,
52 devBadgeOff = { dx: -halfDevIcon, dy: -halfDevIcon },
53 hostBadgeOff = { dx: -hostRadius, dy: -hostRadius },
54 status = {
55 i: 'badgeInfo',
56 w: 'badgeWarn',
57 e: 'badgeError'
Simon Huntf44d7262016-06-14 14:46:56 -070058 };
59
Simon Hunt1eee51d2016-02-26 19:12:13 -080060 // NOTE: this type of hack should go away once we have implemented
61 // the server-side UiModel code.
62 // {virtual -> cord} is for the E-CORD demo at ONS 2016
63 var remappedDeviceTypes = {
Simon Hunte9062fc2016-12-22 11:40:06 -080064 virtual: 'cord',
65
66 // for now, map to the new glyphs via this lookup.
67 // may have to find a better way to do this...
68 'switch': 'm_switch',
69 roadm: 'm_roadm',
70 otn: 'm_otn',
71 roadm_otn: 'm_roadm_otn',
72 fiber_switch: 'm_fiberSwitch',
73 microwave: 'm_microwave',
74 };
75
76 var remappedHostTypes = {
77 router: 'm_router',
78 endstation: 'm_endstation',
79 bgpSpeaker: 'm_bgpSpeaker'
Simon Hunt1eee51d2016-02-26 19:12:13 -080080 };
81
82 function mapDeviceTypeToGlyph(type) {
83 return remappedDeviceTypes[type] || type || 'unknown';
84 }
85
Simon Hunte9062fc2016-12-22 11:40:06 -080086 function mapHostTypeToGlyph(type) {
87 return remappedHostTypes[type] || type || 'unknown';
88 }
89
Simon Hunt5674db92015-10-22 16:12:48 -070090 function badgeStatus(badge) {
91 return status[badge.status] || status.i;
92 }
93
Simon Hunta4242de2015-02-24 17:11:55 -080094 // internal state
95 var deviceLabelIndex = 0,
96 hostLabelIndex = 0;
97
Simon Hunta5487ad2016-06-16 13:10:41 -070098 // note: these are the device icon colors without affinity (no master)
Simon Hunta4242de2015-02-24 17:11:55 -080099 var dColTheme = {
100 light: {
Simon Huntf44d7262016-06-14 14:46:56 -0700101 online: '#444444',
102 offline: '#cccccc'
Simon Hunta4242de2015-02-24 17:11:55 -0800103 },
104 dark: {
Simon Huntf44d7262016-06-14 14:46:56 -0700105 // TODO: theme
106 online: '#444444',
107 offline: '#cccccc'
Simon Hunta4242de2015-02-24 17:11:55 -0800108 }
109 };
110
Simon Huntf44d7262016-06-14 14:46:56 -0700111 function devGlyphColor(d) {
112 var o = d.online,
113 id = d.master,
114 otag = o ? 'online' : 'offline';
115 return o ? sus.cat7().getColor(id, 0, ts.theme())
116 : dColTheme[ts.theme()][otag];
Simon Hunta4242de2015-02-24 17:11:55 -0800117 }
118
119 function setDeviceColor(d) {
Simon Hunte9062fc2016-12-22 11:40:06 -0800120 // want to color the square rectangle (no longer the 'use' glyph)
121 d.el.selectAll('rect').filter(function (d, i) {return i === 1;})
Simon Huntf44d7262016-06-14 14:46:56 -0700122 .style('fill', devGlyphColor(d));
Simon Hunta4242de2015-02-24 17:11:55 -0800123 }
124
Simon Hunta4242de2015-02-24 17:11:55 -0800125 function incDevLabIndex() {
Steven Burrowsbbe3dda2016-09-26 14:41:59 -0700126 setDevLabIndex(deviceLabelIndex+1);
Bri Prebilic Cole9cf1a8d2015-04-21 13:15:29 -0700127 switch(deviceLabelIndex) {
128 case 0: return 'Hide device labels';
129 case 1: return 'Show friendly device labels';
130 case 2: return 'Show device ID labels';
131 }
Simon Hunta4242de2015-02-24 17:11:55 -0800132 }
133
Thomas Vachuska0af26912016-03-21 21:37:30 -0700134 function setDevLabIndex(mode) {
135 deviceLabelIndex = mode % 3;
136 var p = ps.getPrefs('topo_prefs', ttbs.defaultPrefs);
137 p.dlbls = deviceLabelIndex;
138 ps.setPrefs('topo_prefs', p);
139 }
140
Simon Hunta4242de2015-02-24 17:11:55 -0800141 function hostLabel(d) {
142 var idx = (hostLabelIndex < d.labels.length) ? hostLabelIndex : 0;
143 return d.labels[idx];
144 }
Simon Huntf44d7262016-06-14 14:46:56 -0700145
Simon Hunta4242de2015-02-24 17:11:55 -0800146 function deviceLabel(d) {
147 var idx = (deviceLabelIndex < d.labels.length) ? deviceLabelIndex : 0;
148 return d.labels[idx];
149 }
Simon Huntf44d7262016-06-14 14:46:56 -0700150
Simon Hunta4242de2015-02-24 17:11:55 -0800151 function trimLabel(label) {
152 return (label && label.trim()) || '';
153 }
154
Simon Huntf44d7262016-06-14 14:46:56 -0700155 function computeLabelWidth(n) {
156 var text = n.select('text'),
157 box = text.node().getBBox();
158 return box.width + labelPad * 2;
159 }
160
161 function iconBox(dim, labelWidth) {
Simon Hunta4242de2015-02-24 17:11:55 -0800162 return {
Simon Huntf44d7262016-06-14 14:46:56 -0700163 x: -dim/2,
164 y: -dim/2,
165 width: dim + labelWidth,
166 height: dim
167 }
Simon Hunta4242de2015-02-24 17:11:55 -0800168 }
169
Simon Hunt5674db92015-10-22 16:12:48 -0700170 function updateDeviceRendering(d) {
Simon Huntf44d7262016-06-14 14:46:56 -0700171 var node = d.el,
172 bdg = d.badge,
173 label = trimLabel(deviceLabel(d)),
174 labelWidth;
Simon Hunta4242de2015-02-24 17:11:55 -0800175
Simon Huntf44d7262016-06-14 14:46:56 -0700176 node.select('text').text(label);
177 labelWidth = label ? computeLabelWidth(node) : 0;
Simon Hunta4242de2015-02-24 17:11:55 -0800178
179 node.select('rect')
180 .transition()
Simon Huntf44d7262016-06-14 14:46:56 -0700181 .attr(iconBox(devIconDim, labelWidth));
Simon Hunta4242de2015-02-24 17:11:55 -0800182
Simon Hunt5674db92015-10-22 16:12:48 -0700183 if (bdg) {
Simon Hunta5487ad2016-06-16 13:10:41 -0700184 renderBadge(node, bdg, devBadgeOff);
Simon Hunte9343f32015-10-21 18:07:46 -0700185 }
186 }
187
Andrea Campanella52125412015-12-03 14:50:40 -0800188 function updateHostRendering(d) {
189 var node = d.el,
Simon Huntc2bfe332015-12-04 11:01:24 -0800190 bdg = d.badge;
Andrea Campanella52125412015-12-03 14:50:40 -0800191
192 updateHostLabel(d);
Andrea Campanella52125412015-12-03 14:50:40 -0800193
Andrea Campanella52125412015-12-03 14:50:40 -0800194 if (bdg) {
Simon Hunta5487ad2016-06-16 13:10:41 -0700195 renderBadge(node, bdg, hostBadgeOff);
Simon Huntc2bfe332015-12-04 11:01:24 -0800196 }
197 }
Andrea Campanella52125412015-12-03 14:50:40 -0800198
Simon Huntc2bfe332015-12-04 11:01:24 -0800199 function renderBadge(node, bdg, boff) {
200 var bsel,
201 bcr = badgeConfig.radius,
202 bcgd = badgeConfig.gdelta;
Andrea Campanella52125412015-12-03 14:50:40 -0800203
Simon Huntc2bfe332015-12-04 11:01:24 -0800204 node.select('g.badge').remove();
Andrea Campanella52125412015-12-03 14:50:40 -0800205
Simon Huntc2bfe332015-12-04 11:01:24 -0800206 bsel = node.append('g')
207 .classed('badge', true)
208 .classed(badgeStatus(bdg), true)
209 .attr('transform', sus.translate(boff.dx, boff.dy));
Andrea Campanella52125412015-12-03 14:50:40 -0800210
Simon Huntc2bfe332015-12-04 11:01:24 -0800211 bsel.append('circle')
212 .attr('r', bcr);
213
214 if (bdg.txt) {
215 bsel.append('text')
216 .attr('dy', badgeConfig.yoff)
217 .attr('text-anchor', 'middle')
218 .text(bdg.txt);
219 } else if (bdg.gid) {
220 bsel.append('use')
221 .attr({
222 width: bcgd * 2,
223 height: bcgd * 2,
224 transform: sus.translate(-bcgd, -bcgd),
225 'xlink:href': '#' + bdg.gid
226 });
Andrea Campanella52125412015-12-03 14:50:40 -0800227 }
228 }
229
Simon Hunta4242de2015-02-24 17:11:55 -0800230 function updateHostLabel(d) {
231 var label = trimLabel(hostLabel(d));
232 d.el.select('text').text(label);
233 }
234
235 function updateDeviceColors(d) {
236 if (d) {
237 setDeviceColor(d);
238 } else {
239 api.node().filter('.device').each(function (d) {
240 setDeviceColor(d);
241 });
242 }
243 }
244
245
246 // ==========================
247 // updateNodes - subfunctions
248
249 function deviceExisting(d) {
250 var node = d.el;
251 node.classed('online', d.online);
Simon Hunt5674db92015-10-22 16:12:48 -0700252 updateDeviceRendering(d);
Simon Hunta4242de2015-02-24 17:11:55 -0800253 api.posNode(d, true);
254 }
255
256 function hostExisting(d) {
Andrea Campanella52125412015-12-03 14:50:40 -0800257 updateHostRendering(d);
Simon Hunta4242de2015-02-24 17:11:55 -0800258 api.posNode(d, true);
259 }
260
261 function deviceEnter(d) {
262 var node = d3.select(this),
Simon Hunt1eee51d2016-02-26 19:12:13 -0800263 glyphId = mapDeviceTypeToGlyph(d.type),
Simon Hunta4242de2015-02-24 17:11:55 -0800264 label = trimLabel(deviceLabel(d)),
Simon Hunte9062fc2016-12-22 11:40:06 -0800265 rect, crect, text, glyph, labelWidth;
Simon Hunta4242de2015-02-24 17:11:55 -0800266
267 d.el = node;
268
Simon Huntf44d7262016-06-14 14:46:56 -0700269 rect = node.append('rect');
Simon Hunte9062fc2016-12-22 11:40:06 -0800270 crect = node.append('rect');
Simon Hunta4242de2015-02-24 17:11:55 -0800271
Simon Huntf44d7262016-06-14 14:46:56 -0700272 text = node.append('text').text(label)
273 .attr('text-anchor', 'left')
274 .attr('y', '0.3em')
Simon Hunta5487ad2016-06-16 13:10:41 -0700275 .attr('x', halfDevIcon + labelPad);
Simon Hunta4242de2015-02-24 17:11:55 -0800276
Simon Huntf44d7262016-06-14 14:46:56 -0700277 glyph = is.addDeviceIcon(node, glyphId, devIconDim);
Simon Hunta4242de2015-02-24 17:11:55 -0800278
Simon Huntf44d7262016-06-14 14:46:56 -0700279 labelWidth = label ? computeLabelWidth(node) : 0;
280
281 rect.attr(iconBox(devIconDim, labelWidth));
Simon Hunte9062fc2016-12-22 11:40:06 -0800282 crect.attr(iconBox(devColorDim, 0));
Simon Huntf44d7262016-06-14 14:46:56 -0700283 glyph.attr(iconBox(devIconDim, 0));
284
Simon Hunta5487ad2016-06-16 13:10:41 -0700285 node.attr('transform', sus.translate(-halfDevIcon, -halfDevIcon));
Simon Hunta4242de2015-02-24 17:11:55 -0800286 }
287
288 function hostEnter(d) {
289 var node = d3.select(this),
Simon Hunte9062fc2016-12-22 11:40:06 -0800290 glyphId = mapHostTypeToGlyph(d.type),
Simon Hunta5487ad2016-06-16 13:10:41 -0700291 textDy = hostRadius + 10;
Simon Hunta4242de2015-02-24 17:11:55 -0800292
293 d.el = node;
294 sus.visible(node, api.showHosts());
295
Simon Hunte9062fc2016-12-22 11:40:06 -0800296 is.addHostIcon(node, hostRadius, glyphId);
Simon Hunta4242de2015-02-24 17:11:55 -0800297
298 node.append('text')
299 .text(hostLabel)
300 .attr('dy', textDy)
301 .attr('text-anchor', 'middle');
302 }
303
304 function hostExit(d) {
305 var node = d.el;
306 node.select('use')
307 .style('opacity', 0.5)
308 .transition()
309 .duration(800)
310 .style('opacity', 0);
311
312 node.select('text')
313 .style('opacity', 0.5)
314 .transition()
315 .duration(800)
316 .style('opacity', 0);
317
318 node.select('circle')
319 .style('stroke-fill', '#555')
320 .style('fill', '#888')
321 .style('opacity', 0.5)
322 .transition()
323 .duration(1500)
324 .attr('r', 0);
325 }
326
327 function deviceExit(d) {
328 var node = d.el;
329 node.select('use')
330 .style('opacity', 0.5)
331 .transition()
332 .duration(800)
333 .style('opacity', 0);
334
335 node.selectAll('rect')
336 .style('stroke-fill', '#555')
337 .style('fill', '#888')
338 .style('opacity', 0.5);
339 }
340
341
342 // ==========================
343 // updateLinks - subfunctions
344
Simon Hunta4242de2015-02-24 17:11:55 -0800345 function linkEntering(d) {
Steven Burrowsec1f45c2016-08-08 16:14:41 +0100346
Simon Hunta4242de2015-02-24 17:11:55 -0800347 var link = d3.select(this);
348 d.el = link;
349 api.restyleLinkElement(d);
350 if (d.type() === 'hostLink') {
351 sus.visible(link, api.showHosts());
352 }
353 }
354
355 var linkLabelOffset = '0.3em';
356
357 function applyLinkLabels() {
358 var entering;
359
360 api.updateLinkLabelModel();
361
362 // for elements already existing, we need to update the text
363 // and adjust the rectangle size to fit
364 api.linkLabel().each(function (d) {
365 var el = d3.select(this),
366 rect = el.select('rect'),
367 text = el.select('text');
368 text.text(d.label);
369 rect.attr(rectAroundText(el));
370 });
371
372 entering = api.linkLabel().enter().append('g')
373 .classed('linkLabel', true)
374 .attr('id', function (d) { return d.id; });
375
376 entering.each(function (d) {
377 var el = d3.select(this),
378 rect,
Bri Prebilic Cole038aedd2015-07-13 15:25:16 -0700379 text;
Simon Hunta4242de2015-02-24 17:11:55 -0800380
381 if (d.ldata.type() === 'hostLink') {
382 el.classed('hostLinkLabel', true);
383 sus.visible(el, api.showHosts());
384 }
385
386 d.el = el;
387 rect = el.append('rect');
388 text = el.append('text').text(d.label);
389 rect.attr(rectAroundText(el));
390 text.attr('dy', linkLabelOffset);
391
Carmelo Casconed01eda62016-08-02 10:19:15 -0700392 el.attr('transform', transformLabel(d.ldata.position, d.key));
Simon Hunta4242de2015-02-24 17:11:55 -0800393 });
394
395 // Remove any labels that are no longer required.
396 api.linkLabel().exit().remove();
397 }
398
399 function rectAroundText(el) {
400 var text = el.select('text'),
401 box = text.node().getBBox();
402
403 // translate the bbox so that it is centered on [x,y]
404 box.x = -box.width / 2;
405 box.y = -box.height / 2;
406
407 // add padding
408 box.x -= 1;
409 box.width += 2;
410 return box;
411 }
412
Carmelo Casconed01eda62016-08-02 10:19:15 -0700413 function generateLabelFunction() {
Simon Hunte093e782017-03-31 10:19:08 -0700414 var labels = [],
415 xGap = 15,
416 yGap = 17;
Carmelo Casconed01eda62016-08-02 10:19:15 -0700417
Simon Hunte093e782017-03-31 10:19:08 -0700418 return function (newId, newX, newY) {
Carmelo Casconed01eda62016-08-02 10:19:15 -0700419 var idx = -1;
420
Simon Hunte093e782017-03-31 10:19:08 -0700421 labels.forEach(function (lab, i) {
422 var minX, maxX, minY, maxY;
423
424 if (lab.id === newId) {
Carmelo Casconed01eda62016-08-02 10:19:15 -0700425 idx = i;
426 return;
427 }
Simon Hunte093e782017-03-31 10:19:08 -0700428 minX = lab.x - xGap;
429 maxX = lab.x + xGap;
430 minY = lab.y - yGap;
431 maxY = lab.y + yGap;
Carmelo Casconed01eda62016-08-02 10:19:15 -0700432
433 if (newX > minX && newX < maxX && newY > minY && newY < maxY) {
434 // labels are overlapped
435 newX = newX - xGap;
436 newY = newY - yGap;
437 }
438 });
439
440 if (idx === -1) {
441 labels.push({id: newId, x: newX, y: newY});
Simon Hunte093e782017-03-31 10:19:08 -0700442 } else {
Carmelo Casconed01eda62016-08-02 10:19:15 -0700443 labels[idx] = {id: newId, x: newX, y: newY};
444 }
445
446 return {x: newX, y: newY};
447 }
448 }
449
Simon Hunte093e782017-03-31 10:19:08 -0700450 var getLabelPos = generateLabelFunction();
Carmelo Casconed01eda62016-08-02 10:19:15 -0700451
452 function transformLabel(p, id) {
Simon Hunta4242de2015-02-24 17:11:55 -0800453 var dx = p.x2 - p.x1,
454 dy = p.y2 - p.y1,
455 xMid = dx/2 + p.x1,
456 yMid = dy/2 + p.y1;
Carmelo Casconed01eda62016-08-02 10:19:15 -0700457
458 if (id) {
Simon Hunte093e782017-03-31 10:19:08 -0700459 var pos = getLabelPos(id, xMid, yMid);
Carmelo Casconed01eda62016-08-02 10:19:15 -0700460 return sus.translate(pos.x, pos.y);
461 }
462
Simon Hunta4242de2015-02-24 17:11:55 -0800463 return sus.translate(xMid, yMid);
464 }
465
Simon Hunt1a5301e2015-02-25 15:31:25 -0800466 function applyPortLabels(data, portLabelG) {
467 var entering = portLabelG.selectAll('.portLabel')
468 .data(data).enter().append('g')
469 .classed('portLabel', true)
470 .attr('id', function (d) { return d.id; });
471
472 entering.each(function (d) {
473 var el = d3.select(this),
474 rect = el.append('rect'),
475 text = el.append('text').text(d.num);
476
477 rect.attr(rectAroundText(el));
478 text.attr('dy', linkLabelOffset);
Simon Hunt969b3c92015-02-25 18:11:31 -0800479 el.attr('transform', sus.translate(d.x, d.y));
Simon Hunt1a5301e2015-02-25 15:31:25 -0800480 });
481 }
482
Bri Prebilic Cole80401762015-07-16 11:36:18 -0700483 function labelPoint(linkPos) {
484 var lengthUpLine = 1 / 3,
485 dx = linkPos.x2 - linkPos.x1,
486 dy = linkPos.y2 - linkPos.y1,
487 movedX = dx * lengthUpLine,
488 movedY = dy * lengthUpLine;
489
490 return {
491 x: movedX,
492 y: movedY
493 };
494 }
495
496 function calcGroupPos(linkPos) {
497 var moved = labelPoint(linkPos);
498 return sus.translate(linkPos.x1 + moved.x, linkPos.y1 + moved.y);
499 }
500
501 // calculates where on the link that the hash line for 5+ label appears
502 function hashAttrs(linkPos) {
503 var hashLength = 25,
504 halfLength = hashLength / 2,
505 dx = linkPos.x2 - linkPos.x1,
506 dy = linkPos.y2 - linkPos.y1,
507 length = Math.sqrt((dx * dx) + (dy * dy)),
508 moveAmtX = (dx / length) * halfLength,
509 moveAmtY = (dy / length) * halfLength,
510 mid = labelPoint(linkPos),
511 angle = Math.atan(dy / dx) + 45;
512
513 return {
514 x1: mid.x - moveAmtX,
515 y1: mid.y - moveAmtY,
516 x2: mid.x + moveAmtX,
517 y2: mid.y + moveAmtY,
518 stroke: api.linkConfig()[ts.theme()].baseColor,
519 transform: 'rotate(' + angle + ',' + mid.x + ',' + mid.y + ')'
520 };
521 }
522
523 function textLabelPos(linkPos) {
524 var point = labelPoint(linkPos),
525 dist = 20;
526 return {
527 x: point.x + dist,
528 y: point.y + dist
529 };
530 }
531
532 function applyNumLinkLabels(data, lblsG) {
533 var labels = lblsG.selectAll('g.numLinkLabel')
534 .data(data, function (d) { return 'pair-' + d.id; }),
535 entering;
536
537 // update existing labels
538 labels.each(function (d) {
539 var el = d3.select(this);
540
541 el.attr({
542 transform: function (d) { return calcGroupPos(d.linkCoords); }
543 });
544 el.select('line')
545 .attr(hashAttrs(d.linkCoords));
546 el.select('text')
547 .attr(textLabelPos(d.linkCoords))
548 .text(d.num);
549 });
550
551 // add new labels
552 entering = labels
553 .enter()
554 .append('g')
555 .attr({
556 transform: function (d) { return calcGroupPos(d.linkCoords); },
557 id: function (d) { return 'pair-' + d.id; }
558 })
559 .classed('numLinkLabel', true);
560
561 entering.each(function (d) {
562 var el = d3.select(this);
563
564 el.append('line')
565 .classed('numLinkHash', true)
566 .attr(hashAttrs(d.linkCoords));
567 el.append('text')
568 .classed('numLinkText', true)
569 .attr(textLabelPos(d.linkCoords))
570 .text(d.num);
571 });
572
573 // remove old labels
574 labels.exit().remove();
575 }
576
Simon Hunta4242de2015-02-24 17:11:55 -0800577 // ==========================
578 // Module definition
579
580 angular.module('ovTopo')
581 .factory('TopoD3Service',
582 ['$log', 'FnService', 'SvgUtilService', 'IconService', 'ThemeService',
Thomas Vachuska0af26912016-03-21 21:37:30 -0700583 'PrefsService', 'TopoToolbarService',
Simon Hunta4242de2015-02-24 17:11:55 -0800584
Thomas Vachuska0af26912016-03-21 21:37:30 -0700585 function (_$log_, _fs_, _sus_, _is_, _ts_, _ps_, _ttbs_) {
Simon Hunta4242de2015-02-24 17:11:55 -0800586 $log = _$log_;
587 fs = _fs_;
588 sus = _sus_;
589 is = _is_;
590 ts = _ts_;
Thomas Vachuska0af26912016-03-21 21:37:30 -0700591 ps = _ps_;
592 ttbs = _ttbs_;
Simon Hunta4242de2015-02-24 17:11:55 -0800593
Simon Hunta4242de2015-02-24 17:11:55 -0800594 function initD3(_api_) {
595 api = _api_;
596 }
597
598 function destroyD3() { }
599
600 return {
601 initD3: initD3,
602 destroyD3: destroyD3,
603
604 incDevLabIndex: incDevLabIndex,
Thomas Vachuska0af26912016-03-21 21:37:30 -0700605 setDevLabIndex: setDevLabIndex,
Simon Hunta4242de2015-02-24 17:11:55 -0800606 hostLabel: hostLabel,
607 deviceLabel: deviceLabel,
608 trimLabel: trimLabel,
609
Simon Hunt5674db92015-10-22 16:12:48 -0700610 updateDeviceLabel: updateDeviceRendering,
Simon Hunta4242de2015-02-24 17:11:55 -0800611 updateHostLabel: updateHostLabel,
612 updateDeviceColors: updateDeviceColors,
613
614 deviceExisting: deviceExisting,
615 hostExisting: hostExisting,
616 deviceEnter: deviceEnter,
617 hostEnter: hostEnter,
618 hostExit: hostExit,
619 deviceExit: deviceExit,
620
Simon Hunta4242de2015-02-24 17:11:55 -0800621 linkEntering: linkEntering,
622 applyLinkLabels: applyLinkLabels,
Simon Hunt1a5301e2015-02-25 15:31:25 -0800623 transformLabel: transformLabel,
Bri Prebilic Cole80401762015-07-16 11:36:18 -0700624 applyPortLabels: applyPortLabels,
625 applyNumLinkLabels: applyNumLinkLabels
Simon Hunta4242de2015-02-24 17:11:55 -0800626 };
627 }]);
628}());