This is an automated email from the ASF dual-hosted git repository. hanahmily pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-skywalking-ui.git
The following commit(s) were added to refs/heads/master by this push: new 3693495 Fix #174 Convert single user node to multiple ones. 3693495 is described below commit 36934958c859fc397b18673a5a85c23ffbd874f9 Author: gaohongtao <hanahm...@gmail.com> AuthorDate: Fri Jun 1 14:48:02 2018 +0800 Fix #174 Convert single user node to multiple ones. --- src/components/Topology/AppTopology.js | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/components/Topology/AppTopology.js b/src/components/Topology/AppTopology.js index 93e22aa..148fb68 100644 --- a/src/components/Topology/AppTopology.js +++ b/src/components/Topology/AppTopology.js @@ -33,9 +33,10 @@ export default class AppTopology extends Base { const maxCPM = Math.max(...cpmArray); const { nodeSize: { min, max } } = conf; const scale = maxCPM > minCPM ? (max - min) / (maxCPM - minCPM) : 0; + const eleWithNewUsers = this.supplyUserNode(elements.edges); return { - ...elements, - nodes: nodes.map((_) => { + edges: eleWithNewUsers.edges, + nodes: nodes.filter(_ => !_.data || _.data.id !== '1').map((_) => { return { ..._, data: { @@ -43,6 +44,33 @@ export default class AppTopology extends Base { size: (_.data && _.data.cpm && scale > 0) ? (scale * (_.data.cpm - minCPM)) + min : min, }, }; + }).concat(eleWithNewUsers.nodes), + }; + } + supplyUserNode = (edges) => { + let i = 0; + const nodes = []; + return { + nodes, + edges: edges.map((_) => { + if (_.data.source !== '1') { + return _; + } + i += 1; + const newId = `USER-${i}`; + nodes.push({ + data: { + id: newId, + name: 'User', + type: 'USER', + }, + }); + return { + data: { + ..._.data, + source: newId, + }, + }; }), }; } -- To stop receiving notification emails like this one, please contact hanahm...@apache.org.