algairim commented on a change in pull request #255:
URL: https://github.com/apache/brooklyn-ui/pull/255#discussion_r674647316
##########
File path: ui-modules/blueprint-composer/app/components/util/d3-blueprint.js
##########
@@ -771,50 +774,37 @@ export function D3Blueprint(container, options) {
return node;
}
+ /**
+ * Draws new relationships as arcs and labels. Updates existing ones.
+ */
function drawRelationships() {
+
showRelationships();
- let relationData = _relationGroup.selectAll('.relation')
- .data(_d3DataHolder.visible.relationships, (d)=>(d.source._id +
'_related_to_' + d.target._id));
+ const getPathId = (d) => (d.source._id + '-' + d.target._id);
+ const getRelationId = (d) => (getPathId(d) + '-' + d.pathSelector);
+
+ // ====== RELATIONSHIP ARCS ===========
- let relationDataEntered = relationData.enter();
+ let arcsData =
Object.values(_d3DataHolder.visible.relationships.reduce((accumulator, d) => {
+ accumulator[getRelationId(d)] = {
+ source: d.source,
+ target: d.target,
+ pathSelector: d.pathSelector
+ };
+ return accumulator;
+ }, {}));
- // Draw the relationship path
- relationDataEntered.insert('path')
+ let relationArcs = _relationArcs.selectAll('.relation').data(arcsData,
(d) => getRelationId(d));
+
+ relationArcs.enter().insert('path')
Review comment:
@jathanasiou, this is not angular, this is D3, not sure if it applies.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]