Skip to content

Commit

Permalink
Network map styling improvements (Koenkk#1653)
Browse files Browse the repository at this point in the history
* Weight and style lines based on routes

* Refactor to make End Device case more obvious
  • Loading branch information
clockbrain authored and Koenkk committed Jun 23, 2019
1 parent 3c398df commit 38a1aec
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/extension/networkMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ class NetworkMap {
* due to not responded to the lqi scan. In that case we do not add an edge for this device.
*/
topology.filter((e) => (e.ieeeAddr === device.ieeeAddr) || (e.nwkAddr === device.nwkAddr)).forEach((e) => {
const lineStyle = (e.lqi==0) ? `style="dashed", ` : ``;
const lineStyle = (device.type=='EndDevice') ? 'style="dashed", '
: (!e.routes.length) ? 'style="dotted", ' : '';
const lineWeight = (!e.routes.length) ? 'weight=0, ' : '';
const textRoutes = e.routes.map((r) => `0x${r.toString(16)}`);
const lineLabels = e.lqi + '\\n[' + textRoutes.join(']\\n[') + ']';
text += ` "${e.parent}" -> "${device.ieeeAddr}" [`+lineStyle+`label="${lineLabels}"]\n`;
const lineLabels = `label="${e.lqi}\\n[${textRoutes.join(']\\n[')}]"`;
text += ` "${e.parent}" -> "${device.ieeeAddr}" [${lineStyle}${lineWeight}${lineLabels}]\n`;
});
});

Expand Down

0 comments on commit 38a1aec

Please sign in to comment.