[TASK] Show offline nodes in forcegraph

This commit is contained in:
Xaver Maierhofer 2018-01-19 21:44:34 +01:00
parent bd670c85fd
commit 66127de355
No known key found for this signature in database
GPG Key ID: 7FDCE23FD2EC9FE8
3 changed files with 12 additions and 4 deletions

View File

@ -152,6 +152,7 @@ module.exports = function () {
},
'forceGraph': {
'nodeColor': '#fff',
'nodeOfflineColor': '#D43E2A',
'highlightColor': 'rgba(255, 255, 255, 0.2)',
'labelColor': '#fff',
'tqFrom': '#770038',

View File

@ -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 = {};

View File

@ -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);