[TASK] Decrease condition to detect vpn links

This commit is contained in:
Martin Geno 2017-03-19 00:21:58 +01:00 committed by Xaver Maierhofer
parent 159cbd4068
commit 4b2c5e9157
4 changed files with 7 additions and 15 deletions

View File

@ -86,13 +86,13 @@ define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'utils/math', 'forcegr
forceLink = d3Force.forceLink()
.distance(function (d) {
if (d.o.type === 'fastd' || d.o.type === 'L2TP') {
if (d.o.vpn) {
return 0;
}
return 75;
})
.strength(function (d) {
if (d.o.type === 'fastd' || d.o.type === 'L2TP') {
if (d.o.vpn) {
return 0.02;
}
return Math.max(0.5, 1 / d.o.tq);

View File

@ -11,8 +11,6 @@ define(['helper'], function (helper) {
var nodeColor = '#fff';
var clientColor = '#e6324b';
var cableColor = '#50b0f0';
var highlightColor = 'rgba(255, 255, 255, 0.2)';
var labelColor = '#fff';
@ -88,8 +86,8 @@ define(['helper'], function (helper) {
to = drawHighlightLink(d, to);
ctx.lineTo(to[0], to[1]);
ctx.strokeStyle = d.o.type === 'Kabel' ? cableColor : d.color;
if (d.o.type === 'fastd' || d.o.type === 'L2TP') {
ctx.strokeStyle = d.color;
if (d.o.vpn) {
ctx.globalAlpha = 0.2;
ctx.lineWidth = 1.5;
} else {

View File

@ -96,16 +96,10 @@ define(['polyglot', 'moment', 'router', 'leaflet', 'gui', 'helper', 'language'],
d.target.node.neighbours.push({ id: d.source.id, link: d, incoming: true });
ids = [d.source.id.replace(/:/g, ''), d.target.node.nodeinfo.node_id];
} else {
if (d.target.node.flags.gateway === true || d.source.node.flags.gateway === true) {
d.type = 'fastd';
} else {
d.type = 'N/A';
}
ids = [d.source.node.nodeinfo.node_id, d.target.node.nodeinfo.node_id];
d.source.node.neighbours.push({ node: d.target.node, link: d, incoming: false });
d.target.node.neighbours.push({ node: d.source.node, link: d, incoming: true });
if (d.type !== 'fastd' && d.type !== 'L2TP') {
if (d.vpn) {
d.source.node.meshlinks = d.source.node.meshlinks ? d.source.node.meshlinks + 1 : 1;
}
}

View File

@ -87,12 +87,12 @@ define(['map/clientlayer', 'map/labellayer', 'leaflet', 'moment', 'map/locationm
function addLinksToMap(dict, linkScale, graph, router) {
graph = graph.filter(function (d) {
return 'distance' in d && d.type !== 'VPN';
return 'distance' in d && !d.vpn;
});
return graph.map(function (d) {
var opts = {
color: d.type === 'Kabel' ? '#50B0F0' : linkScale(1 / d.tq),
color: linkScale(1 / d.tq),
weight: 4,
opacity: 0.5,
dashArray: 'none'