[AETHER-1212] Added means to configure host links to appear as 'wireless'
Setting the host "uiType" to 'cellphone' will make the links "wireless"
and appear as dashed lines.
Additionally, a new annotation "connectionType" was added for hosts,
which when set to "wireless" will make links change appearance for any
type of hosts.
Change-Id: Iad87eb5c180b0a9175108c1179d9d28ae906e924
(cherry picked from commit f06f5d676c01f33834324c4d8a796c7338d53795)
diff --git a/web/gui/src/main/webapp/app/view/topo/topoForce.js b/web/gui/src/main/webapp/app/view/topo/topoForce.js
index dacbda9..158a066 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoForce.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoForce.js
@@ -217,7 +217,9 @@
};
model.links.push(linkData);
- var lnk = tms.createHostLink(model.id, cp.device, cp.port);
+ // Make cell-phone devices default to wireless; others have to be annotated explicitly
+ var cType = model.type === 'cellPhone' ? "wireless" : model.connectionType
+ var lnk = tms.createHostLink(model.id, cp.device, cp.port, cType);
if (lnk) {
network.links.push(lnk);
lu[linkData.key] = lnk;
@@ -363,6 +365,7 @@
var th = ts.theme(),
el = ldata.el,
type = ldata.type(),
+ connectionType = ldata.connectionType(),
lw = ldata.linkWidth(),
online = ldata.online(),
modeCls = ldata.expected() ? 'inactive' : 'not-permitted',
@@ -382,10 +385,19 @@
if (type) {
el.classed(type, true);
}
- el.transition()
- .duration(delay)
- .attr('stroke-width', linkScale(lw))
- .attr('stroke', linkConfig[th].baseColor);
+
+ if (connectionType === 'wireless') {
+ el.transition()
+ .duration(delay)
+ .attr('stroke-width', linkScale(lw))
+ .attr('stroke', linkConfig[th].baseColor)
+ .attr('stroke-dasharray', '3 6');
+ } else {
+ el.transition()
+ .duration(delay)
+ .attr('stroke-width', linkScale(lw))
+ .attr('stroke', linkConfig[th].baseColor);
+ }
}
}