diff --git a/config.default.js b/config.default.js index 6b42aff..e34d567 100644 --- a/config.default.js +++ b/config.default.js @@ -152,6 +152,7 @@ module.exports = function () { }, 'forceGraph': { 'nodeColor': '#fff', + 'nodeOfflineColor': '#D43E2A', 'highlightColor': 'rgba(255, 255, 255, 0.2)', 'labelColor': '#fff', 'tqFrom': '#770038', diff --git a/lib/forcegraph.js b/lib/forcegraph.js index 4ea963d..5f1d4ea 100644 --- a/lib/forcegraph.js +++ b/lib/forcegraph.js @@ -198,7 +198,7 @@ define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease', }); self.setData = function setData(data) { - intNodes = data.nodes.online.map(function (d) { + intNodes = data.nodes.all.map(function (d) { var e = dictNodes[d.node_id]; if (!e) { e = {}; diff --git a/lib/forcegraph/draw.js b/lib/forcegraph/draw.js index 5847b0f..edda42d 100644 --- a/lib/forcegraph/draw.js +++ b/lib/forcegraph/draw.js @@ -11,7 +11,7 @@ define(['helper'], function (helper) { var LINE_RADIUS = 12; function drawDetailNode(d) { - if (transform.k > 1) { + if (transform.k > 1 && d.o.is_online) { helper.positionClients(ctx, d, Math.PI, d.o, 15); ctx.beginPath(); var name = d.o.node_id; @@ -54,8 +54,15 @@ define(['helper'], function (helper) { drawHighlightNode(d); ctx.moveTo(d.x + 3, d.y); - ctx.arc(d.x, d.y, 8, 0, 2 * Math.PI); - ctx.fillStyle = config.forceGraph.nodeColor; + + if (d.o.is_online) { + ctx.arc(d.x, d.y, 8, 0, 2 * Math.PI); + ctx.fillStyle = config.forceGraph.nodeColor; + } else { + ctx.arc(d.x, d.y, 6, 0, 2 * Math.PI); + ctx.fillStyle = config.forceGraph.nodeOfflineColor; + } + ctx.fill(); drawDetailNode(d);