@elyra/canvas 12.10.0 → 12.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/dist/canvas-constants-7f93e705.js +2 -0
  2. package/dist/canvas-constants-7f93e705.js.map +1 -0
  3. package/dist/canvas-constants-ac5daafb.js +2 -0
  4. package/dist/canvas-constants-ac5daafb.js.map +1 -0
  5. package/dist/canvas-controller-183ff6a7.js +2 -0
  6. package/dist/canvas-controller-183ff6a7.js.map +1 -0
  7. package/dist/canvas-controller-d70a731e.js +2 -0
  8. package/dist/canvas-controller-d70a731e.js.map +1 -0
  9. package/dist/canvas-logger-815781bb.js +2 -0
  10. package/dist/canvas-logger-815781bb.js.map +1 -0
  11. package/dist/canvas-logger-a0f1beaa.js +2 -0
  12. package/dist/canvas-logger-a0f1beaa.js.map +1 -0
  13. package/dist/common-canvas-3e832a84.js +2 -0
  14. package/dist/common-canvas-3e832a84.js.map +1 -0
  15. package/dist/common-canvas-c50cb3f3.js +2 -0
  16. package/dist/common-canvas-c50cb3f3.js.map +1 -0
  17. package/dist/common-canvas.es.js +1 -1
  18. package/dist/common-canvas.es.js.map +1 -1
  19. package/dist/common-canvas.js +1 -1
  20. package/dist/common-canvas.js.map +1 -1
  21. package/dist/common-properties-4f471b2b.js +2 -0
  22. package/dist/common-properties-4f471b2b.js.map +1 -0
  23. package/dist/common-properties-9161cd27.js +2 -0
  24. package/dist/common-properties-9161cd27.js.map +1 -0
  25. package/dist/datarecord-metadata-v3-schema-bda88f2e.js +2 -0
  26. package/dist/datarecord-metadata-v3-schema-bda88f2e.js.map +1 -0
  27. package/dist/datarecord-metadata-v3-schema-d7ad05cd.js +2 -0
  28. package/dist/datarecord-metadata-v3-schema-d7ad05cd.js.map +1 -0
  29. package/dist/en-2ed89528.js +2 -0
  30. package/dist/en-2ed89528.js.map +1 -0
  31. package/dist/en-e93855cc.js +2 -0
  32. package/dist/en-e93855cc.js.map +1 -0
  33. package/dist/extends-39f57612.js +7 -0
  34. package/dist/extends-39f57612.js.map +1 -0
  35. package/dist/extends-51d9ddcc.js +7 -0
  36. package/dist/extends-51d9ddcc.js.map +1 -0
  37. package/dist/flexible-table-154a3359.js +2 -0
  38. package/dist/flexible-table-154a3359.js.map +1 -0
  39. package/dist/flexible-table-5e4a1e6d.js +2 -0
  40. package/dist/flexible-table-5e4a1e6d.js.map +1 -0
  41. package/dist/icon-811ffddd.js +2 -0
  42. package/dist/icon-811ffddd.js.map +1 -0
  43. package/dist/icon-d6909a68.js +2 -0
  44. package/dist/icon-d6909a68.js.map +1 -0
  45. package/dist/index-4fd90a14.js +2 -0
  46. package/dist/index-4fd90a14.js.map +1 -0
  47. package/dist/index-6d138021.js +2 -0
  48. package/dist/index-6d138021.js.map +1 -0
  49. package/dist/isArrayLikeObject-31e5e646.js +2 -0
  50. package/dist/isArrayLikeObject-31e5e646.js.map +1 -0
  51. package/dist/isArrayLikeObject-7c33c7fd.js +2 -0
  52. package/dist/isArrayLikeObject-7c33c7fd.js.map +1 -0
  53. package/dist/lib/canvas-controller.es.js +2 -0
  54. package/dist/lib/canvas-controller.es.js.map +1 -0
  55. package/dist/lib/canvas-controller.js +2 -0
  56. package/dist/lib/canvas-controller.js.map +1 -0
  57. package/dist/lib/canvas.es.js +1 -1
  58. package/dist/lib/canvas.js +1 -1
  59. package/dist/lib/context-menu.es.js +1 -1
  60. package/dist/lib/context-menu.es.js.map +1 -1
  61. package/dist/lib/context-menu.js +1 -1
  62. package/dist/lib/context-menu.js.map +1 -1
  63. package/dist/lib/properties/field-picker.es.js +1 -1
  64. package/dist/lib/properties/field-picker.js +1 -1
  65. package/dist/lib/properties/flexible-table.es.js +1 -1
  66. package/dist/lib/properties/flexible-table.js +1 -1
  67. package/dist/lib/properties.es.js +1 -1
  68. package/dist/lib/properties.js +1 -1
  69. package/dist/lib/tooltip.es.js +1 -1
  70. package/dist/lib/tooltip.es.js.map +1 -1
  71. package/dist/lib/tooltip.js +1 -1
  72. package/dist/lib/tooltip.js.map +1 -1
  73. package/dist/styles/common-canvas.min.css +1 -1
  74. package/dist/styles/common-canvas.min.css.map +1 -1
  75. package/dist/toolbar-335252dd.js +2 -0
  76. package/dist/toolbar-335252dd.js.map +1 -0
  77. package/dist/toolbar-85e6c77b.js +2 -0
  78. package/dist/toolbar-85e6c77b.js.map +1 -0
  79. package/locales/command-actions/locales/en.json +7 -1
  80. package/locales/command-actions/locales/eo.json +7 -1
  81. package/locales/command-actions/locales/index.js +3 -1
  82. package/locales/command-actions/locales/ko.json +9 -0
  83. package/locales/common-canvas/locales/en.json +1 -0
  84. package/locales/common-canvas/locales/eo.json +1 -0
  85. package/locales/common-canvas/locales/index.js +3 -1
  86. package/locales/common-canvas/locales/ko.json +32 -0
  87. package/locales/common-properties/locales/index.js +3 -1
  88. package/locales/common-properties/locales/ko.json +93 -0
  89. package/locales/palette/locales/index.js +3 -1
  90. package/locales/palette/locales/ko.json +10 -0
  91. package/locales/toolbar/locales/index.js +3 -1
  92. package/locales/toolbar/locales/ko.json +8 -0
  93. package/package.json +7 -3
  94. package/rollup.config.js +10 -7
  95. package/src/color-picker/color-picker-panel.jsx +61 -0
  96. package/src/color-picker/color-picker.jsx +37 -0
  97. package/src/color-picker/color-picker.scss +46 -0
  98. package/src/command-actions/colorSelectedObjectsAction.js +72 -0
  99. package/src/command-actions/deleteObjectsAction.js +16 -11
  100. package/src/command-actions/pasteAction.js +50 -21
  101. package/src/common-canvas/canvas-controller.js +32 -5
  102. package/src/common-canvas/cc-bottom-panel.jsx +34 -37
  103. package/src/common-canvas/cc-contents.jsx +114 -12
  104. package/src/common-canvas/cc-toolbar.jsx +3 -2
  105. package/src/common-canvas/common-canvas-utils.js +39 -78
  106. package/src/common-canvas/common-canvas.scss +28 -14
  107. package/src/common-canvas/constants/canvas-constants.js +17 -16
  108. package/src/common-canvas/label-util.js +1 -1
  109. package/src/common-canvas/svg-canvas-d3.js +20 -107
  110. package/src/common-canvas/svg-canvas-d3.scss +67 -6
  111. package/src/common-canvas/svg-canvas-pipeline.js +201 -0
  112. package/src/common-canvas/svg-canvas-renderer.js +155 -164
  113. package/src/common-canvas/svg-canvas-utils-links.js +3 -3
  114. package/src/common-canvas/svg-canvas-utils-nodes.js +22 -34
  115. package/src/common-properties/actions.js +4 -0
  116. package/src/common-properties/components/field-picker/field-picker.jsx +33 -36
  117. package/src/common-properties/components/field-picker/field-picker.scss +20 -23
  118. package/src/common-properties/components/flexible-table/flexible-table.jsx +46 -31
  119. package/src/common-properties/components/flexible-table/flexible-table.scss +14 -17
  120. package/src/common-properties/components/properties-buttons/properties-buttons.jsx +28 -21
  121. package/src/common-properties/components/table-buttons/table-buttons.jsx +3 -1
  122. package/src/common-properties/components/table-buttons/table-buttons.scss +8 -8
  123. package/src/common-properties/components/title-editor/title-editor.jsx +31 -4
  124. package/src/common-properties/components/title-editor/title-editor.scss +30 -5
  125. package/src/common-properties/components/virtualized-table/virtualized-table.jsx +120 -29
  126. package/src/common-properties/components/virtualized-table/virtualized-table.scss +72 -8
  127. package/src/common-properties/constants/constants.js +5 -1
  128. package/src/common-properties/constants/form-constants.js +1 -0
  129. package/src/common-properties/controls/abstract-table.jsx +12 -11
  130. package/src/common-properties/controls/abstract-table.scss +6 -2
  131. package/src/common-properties/controls/dropdown/dropdown.scss +4 -0
  132. package/src/common-properties/controls/expression/expression-builder/expression-select-field-function.jsx +2 -2
  133. package/src/common-properties/controls/passwordfield/passwordfield.jsx +2 -2
  134. package/src/common-properties/controls/readonlytable/readonlytable.jsx +4 -2
  135. package/src/common-properties/controls/selectcolumns/selectcolumns.scss +0 -19
  136. package/src/common-properties/controls/someofselect/someofselect.scss +2 -2
  137. package/src/common-properties/form/ControlInfo.js +8 -0
  138. package/src/common-properties/form/EditorForm.js +4 -0
  139. package/src/common-properties/form/ParameterInfo.js +4 -0
  140. package/src/common-properties/panels/sub-panel/cell.jsx +18 -23
  141. package/src/common-properties/panels/sub-panel/sub-panel.scss +5 -22
  142. package/src/common-properties/properties-controller.js +18 -0
  143. package/src/common-properties/properties-main/properties-main.jsx +15 -9
  144. package/src/common-properties/properties-main/properties-main.scss +9 -2
  145. package/src/common-properties/properties-store.js +27 -1
  146. package/src/common-properties/reducers/properties-settings.js +17 -1
  147. package/src/context-menu/common-context-menu.jsx +74 -29
  148. package/src/context-menu/context-menu-wrapper.jsx +2 -2
  149. package/src/icons/icon.jsx +5 -46
  150. package/src/index.scss +1 -0
  151. package/src/object-model/api-pipeline.js +25 -42
  152. package/src/object-model/object-model.js +27 -3
  153. package/src/object-model/redux/canvas-store.js +68 -0
  154. package/src/object-model/redux/reducers/canvasinfo.js +36 -0
  155. package/src/object-model/redux/reducers/comments.js +58 -10
  156. package/src/object-model/redux/reducers/externalpipelineflows.js +1 -0
  157. package/src/object-model/redux/reducers/links.js +9 -7
  158. package/src/object-model/redux/reducers/selectioninfo.js +2 -1
  159. package/src/palette/palette-content-list-item.jsx +8 -1
  160. package/src/palette/palette-dialog-content-grid-node.jsx +8 -1
  161. package/src/palette/palette-flyout-utils.js +3 -3
  162. package/src/toolbar/toolbar-action-item.jsx +77 -14
  163. package/src/toolbar/toolbar-overflow-item.jsx +2 -3
  164. package/src/tooltip/tooltip.jsx +4 -1
  165. package/stats.html +1 -1
  166. package/dist/canvas-controller-5c90a709.js +0 -2
  167. package/dist/canvas-controller-5c90a709.js.map +0 -1
  168. package/dist/canvas-controller-a851a663.js +0 -2
  169. package/dist/canvas-controller-a851a663.js.map +0 -1
  170. package/dist/common-properties-3758e3b2.js +0 -2
  171. package/dist/common-properties-3758e3b2.js.map +0 -1
  172. package/dist/common-properties-6334cca1.js +0 -2
  173. package/dist/common-properties-6334cca1.js.map +0 -1
  174. package/dist/datarecord-metadata-v3-schema-3a2957c3.js +0 -2
  175. package/dist/datarecord-metadata-v3-schema-3a2957c3.js.map +0 -1
  176. package/dist/datarecord-metadata-v3-schema-82f2b977.js +0 -2
  177. package/dist/datarecord-metadata-v3-schema-82f2b977.js.map +0 -1
  178. package/dist/en-9e368daa.js +0 -2
  179. package/dist/en-9e368daa.js.map +0 -1
  180. package/dist/en-a3710fcf.js +0 -2
  181. package/dist/en-a3710fcf.js.map +0 -1
  182. package/dist/extends-41535aa9.js +0 -7
  183. package/dist/extends-41535aa9.js.map +0 -1
  184. package/dist/extends-76e6b8d2.js +0 -8
  185. package/dist/extends-76e6b8d2.js.map +0 -1
  186. package/dist/flexible-table-2bbb9e48.js +0 -2
  187. package/dist/flexible-table-2bbb9e48.js.map +0 -1
  188. package/dist/flexible-table-756ff86a.js +0 -2
  189. package/dist/flexible-table-756ff86a.js.map +0 -1
  190. package/dist/index-1eff5860.js +0 -2
  191. package/dist/index-1eff5860.js.map +0 -1
  192. package/dist/index-7fba99b9.js +0 -2
  193. package/dist/index-7fba99b9.js.map +0 -1
  194. package/dist/isEmpty-3550e76f.js +0 -2
  195. package/dist/isEmpty-3550e76f.js.map +0 -1
  196. package/dist/isEmpty-c6f783dd.js +0 -2
  197. package/dist/isEmpty-c6f783dd.js.map +0 -1
@@ -17,6 +17,7 @@
17
17
  /* eslint no-invalid-this: "off" */
18
18
  /* eslint brace-style: "off" */
19
19
  /* eslint no-lonely-if: "off" */
20
+ /* eslint max-depth: "off" */
20
21
 
21
22
  // Import just the D3 modules that are needed and combine them as the 'd3' object.
22
23
  import * as d3Drag from "d3-drag";
@@ -26,7 +27,7 @@ import * as d3Fetch from "d3-fetch";
26
27
  import * as d3Zoom from "./d3-zoom-extension/src";
27
28
  const d3 = Object.assign({}, d3Drag, d3Ease, d3Selection, d3Fetch, d3Zoom);
28
29
 
29
- import { cloneDeep, escape as escapeText, get, isEmpty, set,
30
+ import { cloneDeep, escape as escapeText, get, set,
30
31
  unescape as unescapeText } from "lodash";
31
32
  import { ASSOC_RIGHT_SIDE_CURVE, ASSOCIATION_LINK, NODE_LINK, COMMENT_LINK,
32
33
  ASSOC_VAR_CURVE_LEFT, ASSOC_VAR_CURVE_RIGHT, ASSOC_VAR_DOUBLE_BACK_RIGHT,
@@ -50,6 +51,7 @@ import SvgCanvasNodes from "./svg-canvas-utils-nodes.js";
50
51
  import SvgCanvasComments from "./svg-canvas-utils-comments.js";
51
52
  import SvgCanvasLinks from "./svg-canvas-utils-links.js";
52
53
  import SvgCanvasDecs from "./svg-canvas-utils-decs.js";
54
+ import SVGCanvasPipeline from "./svg-canvas-pipeline";
53
55
 
54
56
  const showLinksTime = false;
55
57
 
@@ -82,8 +84,7 @@ export default class SVGCanvasRenderer {
82
84
  this.config = config;
83
85
  this.canvasController = canvasController;
84
86
  this.objectModel = this.canvasController.getObjectModel();
85
- this.activePipeline = this.getActivePipeline(pipelineId); // Must come after line setting this.canvasInfo
86
- this.activePipeline = CanvasUtils.preProcessPipeline(this.activePipeline);
87
+ this.activePipeline = new SVGCanvasPipeline(pipelineId, canvasInfo);
87
88
 
88
89
  // An array of renderers for the supernodes on the canvas.
89
90
  this.superRenderers = [];
@@ -267,15 +268,6 @@ export default class SVGCanvasRenderer {
267
268
  this.logger.logEndTimer("constructor" + pipelineId.substring(0, 5));
268
269
  }
269
270
 
270
- isCanvasEmptyOrBindingsOnly() {
271
- return (isEmpty(this.activePipeline.nodes) || this.containsOnlyBindingNodes(this.activePipeline)) &&
272
- isEmpty(this.activePipeline.comments);
273
- }
274
-
275
- containsOnlyBindingNodes(pipeline) {
276
- return !pipeline.nodes.find((node) => !CanvasUtils.isSuperBindingNode(node));
277
- }
278
-
279
271
  // Returns the data object for the parent supernode that references the
280
272
  // active pipeline (managed by this renderer). We get the supernode by
281
273
  // looking through the overall canvas info objects.
@@ -289,17 +281,13 @@ export default class SVGCanvasRenderer {
289
281
  if (!node) {
290
282
  node =
291
283
  pipeline.nodes.find((n) =>
292
- this.nodeUtils.isSupernode(n) && n.id === this.supernodeInfo.id);
284
+ CanvasUtils.isSupernode(n) && n.id === this.supernodeInfo.id);
293
285
  }
294
286
  }
295
287
  });
296
288
  return node;
297
289
  }
298
290
 
299
- getSupernodes(pipeline) {
300
- return pipeline.nodes.filter((node) => this.nodeUtils.isSupernode(node));
301
- }
302
-
303
291
  getZoomTransform() {
304
292
  return this.zoomTransform;
305
293
  }
@@ -312,19 +300,10 @@ export default class SVGCanvasRenderer {
312
300
  this.zoomStartPoint = { x: 0, y: 0, k: 0 };
313
301
  }
314
302
 
315
- getActivePipeline(pipelineId) {
316
- const pipeline = this.canvasInfo.pipelines.find((p) => p.id === pipelineId);
317
- if (pipeline) {
318
- return pipeline;
319
- }
320
- return { id: pipelineId, nodes: [], comments: [], links: [] };
321
- }
322
-
323
303
  setCanvasInfoRenderer(canvasInfo) {
324
304
  this.logger.logStartTimer("setCanvasInfoRenderer" + this.pipelineId.substring(0, 5));
325
305
  this.canvasInfo = canvasInfo;
326
- this.activePipeline = this.getActivePipeline(this.pipelineId);
327
- this.activePipeline = CanvasUtils.preProcessPipeline(this.activePipeline);
306
+ this.activePipeline = new SVGCanvasPipeline(this.pipelineId, canvasInfo);
328
307
  this.canvasLayout = this.objectModel.getCanvasLayout(); // Refresh the canvas layout info in case it changed.
329
308
 
330
309
  // Set the display state incase we changed from in-place to full-page
@@ -361,7 +340,7 @@ export default class SVGCanvasRenderer {
361
340
  // undo action.
362
341
  cleanUpSuperRenderers() {
363
342
  const newSuperRenderers = [];
364
- const supernodes = this.getSupernodes(this.activePipeline);
343
+ const supernodes = this.activePipeline.getSupernodes();
365
344
 
366
345
  supernodes.forEach((supernode) => {
367
346
  const ren = this.getRendererForSupernode(supernode);
@@ -530,7 +509,7 @@ export default class SVGCanvasRenderer {
530
509
  // dimensions accordingly.
531
510
  let topAreaHeight;
532
511
  let svgHt;
533
- if (this.nodeUtils.isExpanded(supernodeDatum)) {
512
+ if (CanvasUtils.isExpanded(supernodeDatum)) {
534
513
  topAreaHeight = this.canvasLayout.supernodeTopAreaHeight;
535
514
  svgHt = supernodeDatum.height - (this.canvasLayout.supernodeTopAreaHeight + this.canvasLayout.supernodeSVGAreaPadding);
536
515
  } else {
@@ -881,9 +860,9 @@ export default class SVGCanvasRenderer {
881
860
  fObjectDiv.attr("width", labelDisplayLength);
882
861
  }
883
862
 
884
- // Calculate the zoom amount if the browser itself is zoomed.
885
- // At the time of writing this value is not returned correctly by Safari.
886
- const browserZoom = window.devicePixelRatio / 2;
863
+ // Get the amount the actual browser page is 'zoomed'. This is differet
864
+ // to the zoom amount for the canvas objects.
865
+ const browserZoom = this.getBrowserZoom();
887
866
 
888
867
  // Calculate the center of the node area for positioning the mouse pointer
889
868
  // on the image when it is being dragged.
@@ -897,6 +876,29 @@ export default class SVGCanvasRenderer {
897
876
  };
898
877
  }
899
878
 
879
+ // Returns the amount the actual browser page is 'zoomed'. This is differet
880
+ // to the zoom amount for the canvas objects. Unfortunately, this value is not
881
+ // returned the same for each type of browser so we have to calculate it based
882
+ // on the type of browser.
883
+ getBrowserZoom() {
884
+ let browserZoom = window.devicePixelRatio;
885
+
886
+ // Make sure we search for browser idntifiers in this order because with
887
+ // the Chrome browser userAgent contains the words "Chrome and "Safari"!
888
+ // However, with the Safari browser, userAgent only contains the word "Safari".
889
+ if (navigator.userAgent.includes("Chrome")) {
890
+ browserZoom = window.devicePixelRatio; // This works for Chrome
891
+
892
+ } else if (navigator.userAgent.includes("Safari")) {
893
+ browserZoom = (window.outerWidth - 8) / window.innerWidth; // This works for Safari
894
+
895
+ } else if (navigator.userAgent.includes("Firefox")) {
896
+ browserZoom = window.devicePixelRatio / 2; // This works for Firefox
897
+ }
898
+
899
+ return browserZoom;
900
+ }
901
+
900
902
  // Returns an object containing the dimensions of the ghost node that hovers
901
903
  // over canvas when a node is being dragged from the palette. The ghost node
902
904
  // is based on the default node width and height so any change to these values
@@ -909,10 +911,22 @@ export default class SVGCanvasRenderer {
909
911
  };
910
912
  }
911
913
 
914
+ nodeTemplateDragStart(nodeTemplate) {
915
+ if (this.isNodeTemplateInsertableIntoLink(nodeTemplate)) {
916
+ this.setDataLinkSelectionAreaWider(true);
917
+ }
918
+ }
919
+
920
+ nodeTemplateDragEnd(nodeTemplate) {
921
+ if (this.isNodeTemplateInsertableIntoLink(nodeTemplate)) {
922
+ this.setDataLinkSelectionAreaWider(false);
923
+ }
924
+ }
925
+
912
926
  // Highlights any data link, that an 'insertable' nodeTemplate from the
913
927
  // palette, is dragged over. The x and y passed in are in page coordinates
914
928
  // based on the top left corner of the page.
915
- nodeTemplateDraggedOver(nodeTemplate, x, y) {
929
+ nodeTemplateDragOver(nodeTemplate, x, y) {
916
930
  if (this.isNodeTemplateInsertableIntoLink(nodeTemplate)) {
917
931
  const link = this.getLinkAtMousePos(x, y);
918
932
  // Set highlighting when there is no link because this will turn
@@ -1214,35 +1228,14 @@ export default class SVGCanvasRenderer {
1214
1228
  return false;
1215
1229
  }
1216
1230
 
1217
- getLink(linkId) {
1218
- const link = this.activePipeline.links.find((l) => l.id === linkId);
1219
- return (typeof link === "undefined") ? null : link;
1220
- }
1221
-
1222
1231
  // Returns truthy if the object passed in is a node (and not a comment).
1223
1232
  // Comments don't have a type property.
1224
1233
  isNode(obj) {
1225
1234
  return obj.type;
1226
1235
  }
1227
1236
 
1228
- getNode(nodeId) {
1229
- const node = this.activePipeline.nodes.find((nd) => nd.id === nodeId);
1230
- return (typeof node === "undefined") ? null : node;
1231
- }
1232
-
1233
- getNodes(nodeIds) {
1234
- const nodes = [];
1235
- nodeIds.forEach((nId) => {
1236
- const n = this.getNode(nId);
1237
- if (n) {
1238
- nodes.push(n);
1239
- }
1240
- });
1241
- return nodes;
1242
- }
1243
-
1244
1237
  getNodePort(nodeId, portId, type) {
1245
- const node = this.activePipeline.nodes.find((nd) => nd.id === nodeId);
1238
+ const node = this.activePipeline.getNode(nodeId);
1246
1239
  if (node) {
1247
1240
  let ports;
1248
1241
  if (type === "input") {
@@ -1256,19 +1249,6 @@ export default class SVGCanvasRenderer {
1256
1249
  return null;
1257
1250
  }
1258
1251
 
1259
- getComment(commentId) {
1260
- const comment = this.activePipeline.comments.find((com) => com.id === commentId);
1261
- return (typeof comment === "undefined") ? null : comment;
1262
- }
1263
-
1264
- getNodeOrComment(id) {
1265
- let obj = this.getNode(id);
1266
- if (obj === null) {
1267
- obj = this.getComment(id);
1268
- }
1269
- return obj;
1270
- }
1271
-
1272
1252
  // Sets the maximum zoom extent if we are the renderer of the top level flow
1273
1253
  // or calls the same method on our parent renderer if we are a sub-flow. This
1274
1254
  // means the factors will multiply as they percolate up to the top flow.
@@ -1375,7 +1355,7 @@ export default class SVGCanvasRenderer {
1375
1355
  // to the SVG area. We only attach the zoom behaviour to the top most SVG
1376
1356
  // area i.e. when we are displaying either the primary pipeline full page
1377
1357
  // or a sub-pipeline full page.
1378
- if (!this.isCanvasEmptyOrBindingsOnly() &&
1358
+ if (!this.activePipeline.isEmptyOrBindingsOnly() &&
1379
1359
  this.dispUtils.isDisplayingFullPage()) {
1380
1360
  this.canvasSVG
1381
1361
  .call(this.zoom);
@@ -1454,7 +1434,7 @@ export default class SVGCanvasRenderer {
1454
1434
  getCanvasCursor() {
1455
1435
  if (this.dispUtils.isDisplayingFullPage()) {
1456
1436
  if (this.config.enableInteractionType === INTERACTION_TRACKPAD ||
1457
- this.isCanvasEmptyOrBindingsOnly()) {
1437
+ this.activePipeline.isEmptyOrBindingsOnly()) {
1458
1438
  return "default";
1459
1439
  }
1460
1440
  return "grab";
@@ -1707,7 +1687,7 @@ export default class SVGCanvasRenderer {
1707
1687
 
1708
1688
  getZoomToReveal(nodeIDs, xPos, yPos) {
1709
1689
  const transformedSVGRect = this.getTransformedViewportDimensions();
1710
- const nodes = this.getNodes(nodeIDs);
1690
+ const nodes = this.activePipeline.getNodes(nodeIDs);
1711
1691
  const canvasDimensions = CanvasUtils.getCanvasDimensions(nodes, [], [], 0);
1712
1692
  const canv = this.convertCanvasDimensionsAdjustedForScaleWithPadding(canvasDimensions, 1, 10);
1713
1693
  const xPosInt = parseInt(xPos, 10);
@@ -2011,9 +1991,8 @@ export default class SVGCanvasRenderer {
2011
1991
  // a sub-flow that map to a port in the containing supernode. The dimensions
2012
1992
  // are scaled by k and padded by pad (if provided).
2013
1993
  getCanvasDimensionsAdjustedForScale(k, pad) {
2014
- const canvasDimensions = CanvasUtils.getCanvasDimensions(
2015
- this.activePipeline.nodes, this.activePipeline.comments,
2016
- this.activePipeline.links, this.canvasLayout.commentHighlightGap);
1994
+ const gap = this.canvasLayout.commentHighlightGap;
1995
+ const canvasDimensions = this.activePipeline.getCanvasDimensions(gap);
2017
1996
  return this.convertCanvasDimensionsAdjustedForScaleWithPadding(canvasDimensions, k, pad);
2018
1997
  }
2019
1998
 
@@ -2108,11 +2087,11 @@ export default class SVGCanvasRenderer {
2108
2087
 
2109
2088
  // Note: Comment and Node resizing is started by the comment/supernode highlight rectangle.
2110
2089
  if (this.commentSizing) {
2111
- this.resizeObj = this.getComment(d.id);
2090
+ this.resizeObj = this.activePipeline.getComment(d.id);
2112
2091
  this.initializeResizeVariables(this.resizeObj);
2113
2092
 
2114
2093
  } else if (this.nodeSizing) {
2115
- this.resizeObj = this.getNode(d.id);
2094
+ this.resizeObj = this.activePipeline.getNode(d.id);
2116
2095
  this.initializeResizeVariables(this.resizeObj);
2117
2096
 
2118
2097
  } else {
@@ -2131,6 +2110,7 @@ export default class SVGCanvasRenderer {
2131
2110
  // that, when it is dragged over a link line, the highlightd line can be seen OK.
2132
2111
  if (this.isExistingNodeInsertableIntoLink()) {
2133
2112
  this.setNodeTranslucentState(this.dragObjects[0].id, true);
2113
+ this.setDataLinkSelectionAreaWider(true);
2134
2114
  }
2135
2115
 
2136
2116
  // If we are dragging an 'attachable' node, set it to be translucent so
@@ -2276,16 +2256,18 @@ export default class SVGCanvasRenderer {
2276
2256
  dragFinalOffset = { x: this.dragRunningX, y: this.dragRunningY };
2277
2257
  }
2278
2258
 
2279
- if (this.isExistingNodeInsertableIntoLink() &&
2280
- this.dragOverLink) {
2281
- this.canvasController.editActionHandler({
2282
- editType: "insertNodeIntoLink",
2283
- editSource: "canvas",
2284
- node: this.dragObjects[0],
2285
- link: this.dragOverLink,
2286
- offsetX: dragFinalOffset.x,
2287
- offsetY: dragFinalOffset.y,
2288
- pipelineId: this.activePipeline.id });
2259
+ if (this.isExistingNodeInsertableIntoLink()) {
2260
+ this.setDataLinkSelectionAreaWider(false);
2261
+ if (this.dragOverLink) {
2262
+ this.canvasController.editActionHandler({
2263
+ editType: "insertNodeIntoLink",
2264
+ editSource: "canvas",
2265
+ node: this.dragObjects[0],
2266
+ link: this.dragOverLink,
2267
+ offsetX: dragFinalOffset.x,
2268
+ offsetY: dragFinalOffset.y,
2269
+ pipelineId: this.activePipeline.id });
2270
+ }
2289
2271
  } else if (this.isExistingNodeAttachableToDetachedLinks() &&
2290
2272
  this.dragOverDetachedLinks.length > 0) {
2291
2273
  this.canvasController.editActionHandler({
@@ -2326,7 +2308,7 @@ export default class SVGCanvasRenderer {
2326
2308
  this.draggingLinkHandle = true;
2327
2309
 
2328
2310
  const handleSelection = d3.select(d3Event.sourceEvent.currentTarget);
2329
- const link = this.getLink(d.id);
2311
+ const link = this.activePipeline.getLink(d.id);
2330
2312
  const oldLink = cloneDeep(link);
2331
2313
 
2332
2314
  const linkGrpSelector = this.getLinkGroupSelectionById(d.id);
@@ -2349,14 +2331,14 @@ export default class SVGCanvasRenderer {
2349
2331
  if (this.draggingLinkData.endBeingDragged === "end") {
2350
2332
  const links = this.activePipeline.links.filter((lnk) => lnk.id !== link.id);
2351
2333
  this.setUnavailableTargetNodesHighlighting(
2352
- this.getNode(this.draggingLinkData.link.srcNodeId),
2334
+ this.activePipeline.getNode(this.draggingLinkData.link.srcNodeId),
2353
2335
  this.draggingLinkData.link.srcNodePortId,
2354
2336
  links
2355
2337
  );
2356
2338
  } else if (this.draggingLinkData.endBeingDragged === "start") {
2357
2339
  const links = this.activePipeline.links.filter((lnk) => lnk.id !== link.id);
2358
2340
  this.setUnavailableSourceNodesHighlighting(
2359
- this.getNode(this.draggingLinkData.oldLink.trgNodeId),
2341
+ this.activePipeline.getNode(this.draggingLinkData.oldLink.trgNodeId),
2360
2342
  this.draggingLinkData.link.trgNodePortId,
2361
2343
  links
2362
2344
  );
@@ -2449,7 +2431,7 @@ export default class SVGCanvasRenderer {
2449
2431
  const nodeGroupSel = this.getAllNodeGroupsSelection();
2450
2432
 
2451
2433
  nodeGroupSel
2452
- .datum((d) => this.getNode(d.id))
2434
+ .datum((d) => this.activePipeline.getNode(d.id))
2453
2435
  .attr("transform", (d) => `translate(${d.x_pos}, ${d.y_pos})`);
2454
2436
 
2455
2437
  if (this.dispUtils.isDisplayingSubFlow()) {
@@ -2493,6 +2475,8 @@ export default class SVGCanvasRenderer {
2493
2475
  }
2494
2476
 
2495
2477
  createNodes(enter) {
2478
+ this.logger.logStartTimer("createNodes");
2479
+
2496
2480
  const newNodeGroups = enter
2497
2481
  .append("g")
2498
2482
  .attr("data-id", (d) => this.getId("node_grp", d.id))
@@ -2504,7 +2488,7 @@ export default class SVGCanvasRenderer {
2504
2488
  }
2505
2489
 
2506
2490
  // Node Sizing Area.
2507
- newNodeGroups.filter((d) => this.nodeUtils.isSupernode(d))
2491
+ newNodeGroups.filter((d) => CanvasUtils.isSupernode(d))
2508
2492
  .append("path")
2509
2493
  .attr("class", "d3-node-sizing")
2510
2494
  .call(this.attachNodeSizingListeners.bind(this));
@@ -2538,31 +2522,46 @@ export default class SVGCanvasRenderer {
2538
2522
  .append("xhtml:span") // Provide a namespace when span is inside foreignObject
2539
2523
  .call(this.attachNodeLabelSpanListeners.bind(this));
2540
2524
 
2525
+ this.logger.logEndTimer("createNodes");
2526
+
2541
2527
  return newNodeGroups;
2542
2528
  }
2543
2529
 
2544
2530
  updateNodes(joinedNodeGrps) {
2531
+ this.logger.logStartTimer("updateNodes");
2532
+
2533
+ this.logger.logStartTimer("d3-node-sizing");
2534
+
2545
2535
  // Node Sizing Area
2546
2536
  joinedNodeGrps.selectChildren(".d3-node-sizing")
2547
- .datum((d) => this.getNode(d.id))
2537
+ .datum((d) => this.activePipeline.getNode(d.id))
2548
2538
  .attr("d", (d) => this.getNodeShapePathSizing(d));
2549
2539
 
2540
+ this.logger.logEndTimer("d3-node-sizing");
2541
+ this.logger.logStartTimer("d3-node-selection-highlight");
2542
+
2550
2543
  // Node Selection Highlighting Outline.
2551
2544
  joinedNodeGrps.selectChildren(".d3-node-selection-highlight")
2552
- .datum((d) => this.getNode(d.id))
2545
+ .datum((d) => this.activePipeline.getNode(d.id))
2553
2546
  .attr("d", (d) => this.getNodeSelectionOutline(d))
2554
2547
  .attr("data-selected", (d) => (this.objectModel.isSelected(d.id, this.activePipeline.id) ? "yes" : "no"))
2555
2548
  .attr("style", (d) => this.getNodeSelectionOutlineStyle(d, "default"));
2556
2549
 
2550
+ this.logger.logEndTimer("d3-node-selection-highlight");
2551
+ this.logger.logStartTimer("d3-node-body-outline");
2552
+
2557
2553
  // Node Body
2558
2554
  joinedNodeGrps.selectChildren(".d3-node-body-outline")
2559
- .datum((d) => this.getNode(d.id))
2555
+ .datum((d) => this.activePipeline.getNode(d.id))
2560
2556
  .attr("d", (d) => this.getNodeShapePath(d))
2561
2557
  .attr("style", (d) => this.getNodeBodyStyle(d, "default"));
2562
2558
 
2559
+ this.logger.logEndTimer("d3-node-body-outline");
2560
+ this.logger.logStartTimer("d3-node-image");
2561
+
2563
2562
  // Node Image
2564
2563
  joinedNodeGrps.selectChildren(".d3-node-image")
2565
- .datum((d) => this.getNode(d.id))
2564
+ .datum((d) => this.activePipeline.getNode(d.id))
2566
2565
  .each((d, i, nodeGrps) => this.setNodeImageContent(nodeGrps[i], d))
2567
2566
  .attr("x", (d) => this.nodeUtils.getNodeImagePosX(d))
2568
2567
  .attr("y", (d) => this.nodeUtils.getNodeImagePosY(d))
@@ -2570,9 +2569,12 @@ export default class SVGCanvasRenderer {
2570
2569
  .attr("height", (d) => this.nodeUtils.getNodeImageHeight(d))
2571
2570
  .attr("style", (d) => this.getNodeImageStyle(d, "default"));
2572
2571
 
2572
+ this.logger.logEndTimer("d3-node-image");
2573
+ this.logger.logStartTimer("d3-foreign-object");
2574
+
2573
2575
  // Node Label
2574
2576
  joinedNodeGrps.selectChildren(".d3-foreign-object")
2575
- .datum((d) => this.getNode(d.id))
2577
+ .datum((d) => this.activePipeline.getNode(d.id))
2576
2578
  .attr("x", (d) => this.nodeUtils.getNodeLabelPosX(d))
2577
2579
  .attr("y", (d) => this.nodeUtils.getNodeLabelPosY(d))
2578
2580
  .attr("width", (d) => this.nodeUtils.getNodeLabelWidth(d))
@@ -2584,14 +2586,22 @@ export default class SVGCanvasRenderer {
2584
2586
  .select("span")
2585
2587
  .html((d) => escapeText(d.label));
2586
2588
 
2589
+ this.logger.logEndTimer("d3-foreign-object");
2590
+ this.logger.logStartTimer("d3-node-ellipsis-group");
2591
+
2587
2592
  // Node Ellipsis Icon - if one exists
2588
2593
  joinedNodeGrps.selectChildren(".d3-node-ellipsis-group")
2589
2594
  .attr("transform", (d) => this.nodeUtils.getNodeEllipsisTranslate(d));
2590
2595
 
2596
+ this.logger.logEndTimer("d3-node-ellipsis-group");
2597
+ this.logger.logStartTimer("d3-node-super-expand-icon-group");
2598
+
2591
2599
  // Node (Supernode) Expansion Icon - if one exists
2592
2600
  joinedNodeGrps.selectChildren(".d3-node-super-expand-icon-group")
2593
2601
  .attr("transform", (d) => this.nodeUtils.getNodeExpansionIconTranslate(d));
2594
2602
 
2603
+ this.logger.logEndTimer("d3-node-super-expand-icon-group");
2604
+ this.logger.logStartTimer("each");
2595
2605
  // Ports display; Supernode sub-flow display; Error marker display; and
2596
2606
  // Decoration display.
2597
2607
  joinedNodeGrps.each((d, index, grps) => {
@@ -2599,7 +2609,7 @@ export default class SVGCanvasRenderer {
2599
2609
 
2600
2610
  this.displayPorts(nodeGrp, d);
2601
2611
 
2602
- if (this.nodeUtils.isSupernode(d)) {
2612
+ if (CanvasUtils.isSupernode(d)) {
2603
2613
  this.displaySupernodeContents(d, d3.select(grps[index]));
2604
2614
  }
2605
2615
 
@@ -2612,6 +2622,8 @@ export default class SVGCanvasRenderer {
2612
2622
  this.displayDecorations(d, DEC_NODE, nodeGrp, decorations);
2613
2623
  }
2614
2624
  });
2625
+ this.logger.logEndTimer("each");
2626
+ this.logger.logEndTimer("updateNodes");
2615
2627
  }
2616
2628
 
2617
2629
  // Handles the display of a supernode sub-flow contents or hides the contents
@@ -2619,7 +2631,7 @@ export default class SVGCanvasRenderer {
2619
2631
  displaySupernodeContents(d, supernodeD3Object) {
2620
2632
  let ren = this.getRendererForSupernode(d);
2621
2633
 
2622
- if (this.nodeUtils.isExpanded(d)) {
2634
+ if (CanvasUtils.isExpanded(d)) {
2623
2635
  if (!ren) {
2624
2636
  ren = this.createSupernodeRenderer(d, supernodeD3Object); // Create will call displayCanvas
2625
2637
  this.superRenderers.push(ren);
@@ -2848,7 +2860,7 @@ export default class SVGCanvasRenderer {
2848
2860
  attachNodeSizingListeners(nodeGrps) {
2849
2861
  nodeGrps
2850
2862
  .on("mousedown", (d3Event, d) => {
2851
- if (this.nodeUtils.isExpandedSupernode(d)) {
2863
+ if (CanvasUtils.isExpandedSupernode(d)) {
2852
2864
  this.nodeSizing = true;
2853
2865
  // Note - node resizing and finalization of size is handled by drag functions.
2854
2866
  this.addTempCursorOverlay(this.nodeSizingCursor);
@@ -2862,7 +2874,7 @@ export default class SVGCanvasRenderer {
2862
2874
  // the node outline.
2863
2875
  .on("mousemove mouseenter", (d3Event, d) => {
2864
2876
  if (this.config.enableEditingActions && // Only set cursor when we are able to edit nodes
2865
- this.nodeUtils.isExpandedSupernode(d) &&
2877
+ CanvasUtils.isExpandedSupernode(d) &&
2866
2878
  !this.isRegionSelectOrSizingInProgress()) { // Don't switch sizing direction if we are already sizing
2867
2879
  let cursorType = "pointer";
2868
2880
  if (!this.isPointerCloseToBodyEdge(d3Event, d)) {
@@ -2879,7 +2891,7 @@ export default class SVGCanvasRenderer {
2879
2891
  nodeLabels
2880
2892
  .on("mouseenter", (d3Event, d) => {
2881
2893
  const labelSel = d3.select(d3Event.currentTarget);
2882
- if (this.config.enableDisplayFullLabelOnHover && !this.nodeUtils.isExpandedSupernode(d)) {
2894
+ if (this.config.enableDisplayFullLabelOnHover && !CanvasUtils.isExpandedSupernode(d)) {
2883
2895
  const spanSel = labelSel.selectAll("span");
2884
2896
  labelSel
2885
2897
  .attr("x", this.nodeUtils.getNodeLabelHoverPosX(d))
@@ -2890,7 +2902,7 @@ export default class SVGCanvasRenderer {
2890
2902
  })
2891
2903
  .on("mouseleave", (d3Event, d) => {
2892
2904
  const labelSel = d3.select(d3Event.currentTarget);
2893
- if (this.config.enableDisplayFullLabelOnHover && !this.nodeUtils.isExpandedSupernode(d)) {
2905
+ if (this.config.enableDisplayFullLabelOnHover && !CanvasUtils.isExpandedSupernode(d)) {
2894
2906
  labelSel
2895
2907
  .attr("x", this.nodeUtils.getNodeLabelPosX(d))
2896
2908
  .attr("width", this.nodeUtils.getNodeLabelWidth(d))
@@ -2929,7 +2941,7 @@ export default class SVGCanvasRenderer {
2929
2941
  // Make sure this is just a left mouse button click - we don't want context menu click starting a line being drawn
2930
2942
  if (d3Event.button === 0) {
2931
2943
  CanvasUtils.stopPropagationAndPreventDefault(d3Event); // Stops the node drag behavior when clicking on the handle/circle
2932
- const srcNode = this.getNode(node.id);
2944
+ const srcNode = this.activePipeline.getNode(node.id);
2933
2945
  this.drawingNewLinkData = {
2934
2946
  srcObjId: node.id,
2935
2947
  srcPortId: port.id,
@@ -2987,7 +2999,7 @@ export default class SVGCanvasRenderer {
2987
2999
  // Make sure this is just a left mouse button click - we don't want context menu click starting a line being drawn
2988
3000
  if (d3Event.button === 0) {
2989
3001
  CanvasUtils.stopPropagationAndPreventDefault(d3Event); // Stops the node drag behavior when clicking on the handle/circle
2990
- const srcNode = this.getNode(node.id);
3002
+ const srcNode = this.activePipeline.getNode(node.id);
2991
3003
  if (!CanvasUtils.isSrcCardinalityAtMax(port.id, srcNode, this.activePipeline.links)) {
2992
3004
  this.drawingNewLinkData = {
2993
3005
  srcObjId: node.id,
@@ -3203,7 +3215,7 @@ export default class SVGCanvasRenderer {
3203
3215
  // to be a timing issue since the same problem is not evident with the
3204
3216
  // similar code for the node group object.
3205
3217
  // TODO - Issue 2465 - Find out why this problem occurs.
3206
- const objectTypeName = this.getObjectTypeName(d);
3218
+ const objectTypeName = this.activePipeline.getObjectTypeName(d);
3207
3219
  if (objectTypeName === "node" || objectTypeName === "link") {
3208
3220
  this.canvasController.clickActionHandler({
3209
3221
  clickType: d3EventType === "contextmenu" || this.ellipsisClicked ? "SINGLE_CLICK_CONTEXTMENU" : "SINGLE_CLICK",
@@ -3215,16 +3227,6 @@ export default class SVGCanvasRenderer {
3215
3227
  }
3216
3228
  }
3217
3229
 
3218
- // Returns the name of the type of object d.
3219
- getObjectTypeName(d) {
3220
- if (this.getComment(d.id)) {
3221
- return "comment";
3222
- } else if (this.getNode(d.id)) {
3223
- return "node";
3224
- }
3225
- return "link";
3226
- }
3227
-
3228
3230
  // Displays a set of decorations on either a node or link object.
3229
3231
  // d - This is a node or link object.
3230
3232
  // objType - A string set to either DEC_NODE or DEC_LINK.
@@ -3459,11 +3461,11 @@ export default class SVGCanvasRenderer {
3459
3461
  if (!d.image) {
3460
3462
  return null;
3461
3463
  } else if (d.image === USE_DEFAULT_ICON) {
3462
- if (this.nodeUtils.isSupernode(d)) {
3464
+ if (CanvasUtils.isSupernode(d)) {
3463
3465
  return SUPERNODE_ICON;
3464
3466
  }
3465
3467
  } else if (d.image === USE_DEFAULT_EXT_ICON) {
3466
- if (this.nodeUtils.isSupernode(d)) {
3468
+ if (CanvasUtils.isSupernode(d)) {
3467
3469
  return SUPERNODE_EXT_ICON;
3468
3470
  }
3469
3471
  }
@@ -3538,14 +3540,14 @@ export default class SVGCanvasRenderer {
3538
3540
 
3539
3541
  doesExpandedSupernodeHaveStyledNodes(d) {
3540
3542
  let expandedSupernodeHaveStyledNodes = false;
3541
- if (this.nodeUtils.isExpandedSupernode(d) && d.subflow_ref && d.subflow_ref.pipeline_id_ref) {
3542
- const subflow = this.getActivePipeline(d.subflow_ref.pipeline_id_ref);
3543
+ if (CanvasUtils.isExpandedSupernode(d) && d.subflow_ref && d.subflow_ref.pipeline_id_ref) {
3544
+ const subflow = new SVGCanvasPipeline(d.subflow_ref.pipeline_id_ref, this.canvasInfo);
3543
3545
  const nodeGrp = subflow.nodes;
3544
3546
  nodeGrp.forEach((node) => {
3545
3547
  if (node.style || node.style_temp) {
3546
3548
  expandedSupernodeHaveStyledNodes = true;
3547
3549
  return;
3548
- } else if (!expandedSupernodeHaveStyledNodes && this.nodeUtils.isExpandedSupernode(node)) {
3550
+ } else if (!expandedSupernodeHaveStyledNodes && CanvasUtils.isExpandedSupernode(node)) {
3549
3551
  expandedSupernodeHaveStyledNodes = this.doesExpandedSupernodeHaveStyledNodes(node);
3550
3552
  }
3551
3553
  });
@@ -3643,7 +3645,7 @@ export default class SVGCanvasRenderer {
3643
3645
 
3644
3646
 
3645
3647
  // Add Supernode expansion icon and background for expanded supernodes
3646
- if (this.nodeUtils.isExpandedSupernode(d)) {
3648
+ if (CanvasUtils.isExpandedSupernode(d)) {
3647
3649
  const expGrp = nodeGrp
3648
3650
  .append("g")
3649
3651
  .attr("transform", (nd) => this.nodeUtils.getNodeExpansionIconTranslate(nd))
@@ -3951,7 +3953,7 @@ export default class SVGCanvasRenderer {
3951
3953
 
3952
3954
  drawNewCommentLinkForPorts(transPos) {
3953
3955
  const that = this;
3954
- const srcComment = this.getComment(this.drawingNewLinkData.srcObjId);
3956
+ const srcComment = this.activePipeline.getComment(this.drawingNewLinkData.srcObjId);
3955
3957
  const startPos = this.linkUtils.getNewStraightCommentLinkStartPos(srcComment, transPos);
3956
3958
  const linkType = COMMENT_LINK;
3957
3959
 
@@ -4044,7 +4046,7 @@ export default class SVGCanvasRenderer {
4044
4046
  if (trgNode !== null) {
4045
4047
  const type = this.drawingNewLinkData.action;
4046
4048
  if (type === NODE_LINK) {
4047
- const srcNode = this.getNode(this.drawingNewLinkData.srcObjId);
4049
+ const srcNode = this.activePipeline.getNode(this.drawingNewLinkData.srcObjId);
4048
4050
  const srcPortId = this.drawingNewLinkData.srcPortId;
4049
4051
  const trgPortId = this.getInputNodePortId(d3Event, trgNode);
4050
4052
 
@@ -4077,7 +4079,7 @@ export default class SVGCanvasRenderer {
4077
4079
  }
4078
4080
 
4079
4081
  } else if (type === ASSOCIATION_LINK) {
4080
- const srcNode = this.getNode(this.drawingNewLinkData.srcObjId);
4082
+ const srcNode = this.activePipeline.getNode(this.drawingNewLinkData.srcObjId);
4081
4083
 
4082
4084
  if (CanvasUtils.isAssocConnectionAllowed(srcNode, trgNode, this.activePipeline.links)) {
4083
4085
  this.canvasController.editActionHandler({
@@ -4256,7 +4258,7 @@ export default class SVGCanvasRenderer {
4256
4258
  newLink: newLink,
4257
4259
  pipelineId: this.pipelineId });
4258
4260
  } else {
4259
- this.restoreLink(this.draggingLinkData.oldLink);
4261
+ this.activePipeline.replaceLink(this.draggingLinkData.oldLink);
4260
4262
  this.displayLinks();
4261
4263
  }
4262
4264
 
@@ -4326,17 +4328,11 @@ export default class SVGCanvasRenderer {
4326
4328
  return null;
4327
4329
  }
4328
4330
 
4329
- // Restores the link in the links array with the one passd in.
4330
- restoreLink(oldLink) {
4331
- const index = this.activePipeline.links.findIndex((l) => l.id === oldLink.id);
4332
- this.activePipeline.links.splice(index, 1, oldLink);
4333
- }
4334
-
4335
4331
  // Returns true if the update command for a dragged link can be executed.
4336
4332
  // It might be prevented from executing if either the course
4337
4333
  canExecuteUpdateLinkCommand(newLink, oldLink) {
4338
- const srcNode = this.getNode(newLink.srcNodeId);
4339
- const trgNode = this.getNode(newLink.trgNodeId);
4334
+ const srcNode = this.activePipeline.getNode(newLink.srcNodeId);
4335
+ const trgNode = this.activePipeline.getNode(newLink.trgNodeId);
4340
4336
  const linkSrcChanged = this.hasLinkSrcChanged(newLink, oldLink);
4341
4337
  const linkTrgChanged = this.hasLinkTrgChanged(newLink, oldLink);
4342
4338
  const links = this.activePipeline.links;
@@ -4418,20 +4414,11 @@ export default class SVGCanvasRenderer {
4418
4414
  // Returns a link, if one can be found, at the position indicated by x and y
4419
4415
  // coordinates.
4420
4416
  getLinkAtMousePos(x, y) {
4421
- const element = this.getLinkElementAtMousePos(x, y);
4417
+ const element = this.getElementWithClassAtPosition(x, y, "d3-data-link");
4422
4418
  const link = this.getNodeLinkForElement(element);
4423
4419
  return link;
4424
4420
  }
4425
4421
 
4426
- // Returns a link DOM element, if one can be found, at the
4427
- // position indicated by x and y coordinates.
4428
- getLinkElementAtMousePos(x, y) {
4429
- this.setDataLinkSelectionAreaWider(true);
4430
- const element = this.getElementWithClassAtPosition(x, y, "d3-data-link");
4431
- this.setDataLinkSelectionAreaWider(false);
4432
- return element;
4433
- }
4434
-
4435
4422
  // Returns the node link object from the canvasInfo corresponding to the
4436
4423
  // element passed in provided it is a 'path' DOM object. Returns null if
4437
4424
  // a link cannot be found.
@@ -4439,7 +4426,7 @@ export default class SVGCanvasRenderer {
4439
4426
  if (element) {
4440
4427
  const datum = d3.select(element).datum();
4441
4428
  if (datum) {
4442
- var foundLink = this.getLink(datum.id, this.pipelineId);
4429
+ var foundLink = this.activePipeline.getLink(datum.id);
4443
4430
  if (foundLink && foundLink.type === NODE_LINK) {
4444
4431
  return foundLink;
4445
4432
  }
@@ -4448,6 +4435,10 @@ export default class SVGCanvasRenderer {
4448
4435
  return null;
4449
4436
  }
4450
4437
 
4438
+ // Switches the link selection area to be wider (when state is true) and
4439
+ // regular size (when state is false). The wider width assists detection
4440
+ // of a node being dragged over the link - for when the 'insert node into link'
4441
+ // feature is active.
4451
4442
  setDataLinkSelectionAreaWider(state) {
4452
4443
  this.canvasSVG.selectAll(".d3-data-link-selection-area").classed("d3-extra-width", state);
4453
4444
  }
@@ -4563,7 +4554,7 @@ export default class SVGCanvasRenderer {
4563
4554
  if (element && element.nodeName === "g") {
4564
4555
  const datum = d3.select(element).datum();
4565
4556
  if (datum) {
4566
- return this.getNode(datum.id);
4557
+ return this.activePipeline.getNode(datum.id);
4567
4558
  }
4568
4559
  }
4569
4560
  return null;
@@ -4679,7 +4670,7 @@ export default class SVGCanvasRenderer {
4679
4670
 
4680
4671
  // Returns a path string that will draw the selection outline shape of the node.
4681
4672
  getNodeSelectionOutline(data) {
4682
- if (data.layout.selectionPath && !this.nodeUtils.isExpanded(data)) {
4673
+ if (data.layout.selectionPath && !CanvasUtils.isExpanded(data)) {
4683
4674
  return data.layout.selectionPath;
4684
4675
 
4685
4676
  } else if (data.layout.nodeShape === "port-arcs") {
@@ -4691,7 +4682,7 @@ export default class SVGCanvasRenderer {
4691
4682
 
4692
4683
  // Returns a path string that will draw the body shape of the node.
4693
4684
  getNodeShapePath(data) {
4694
- if (data.layout.bodyPath && !this.nodeUtils.isExpanded(data)) {
4685
+ if (data.layout.bodyPath && !CanvasUtils.isExpanded(data)) {
4695
4686
  return data.layout.bodyPath;
4696
4687
 
4697
4688
  } else if (data.layout.nodeShape === "port-arcs") {
@@ -4893,7 +4884,7 @@ export default class SVGCanvasRenderer {
4893
4884
  } else {
4894
4885
  let xPosition = 0;
4895
4886
 
4896
- if (this.nodeUtils.isExpandedSupernode(data)) {
4887
+ if (CanvasUtils.isExpandedSupernode(data)) {
4897
4888
  const widthSvgArea = data.width - (2 * this.canvasLayout.supernodeSVGAreaPadding);
4898
4889
  const remainingSpace = widthSvgArea - portsWidth;
4899
4890
  xPosition = (2 * this.canvasLayout.supernodeSVGAreaPadding) + (remainingSpace / 2);
@@ -4947,7 +4938,7 @@ export default class SVGCanvasRenderer {
4947
4938
  setPortPositionsLeftRightAllPorts(data, ports, portsHeight, xPos, yPos) {
4948
4939
  let yPosition = 0;
4949
4940
 
4950
- if (this.nodeUtils.isExpandedSupernode(data)) {
4941
+ if (CanvasUtils.isExpandedSupernode(data)) {
4951
4942
  const heightSvgArea = data.height - this.canvasLayout.supernodeTopAreaHeight - this.canvasLayout.supernodeSVGAreaPadding;
4952
4943
  const remainingSpace = heightSvgArea - portsHeight;
4953
4944
  yPosition = this.canvasLayout.supernodeTopAreaHeight + this.canvasLayout.supernodeSVGAreaPadding + (remainingSpace / 2);
@@ -4979,7 +4970,7 @@ export default class SVGCanvasRenderer {
4979
4970
  // regular nodes or expanded supernodes.
4980
4971
  setPortPositionsLeftRightSinglePort(data, ports, xPos, yPos) {
4981
4972
  let yPosition = 0;
4982
- if (this.nodeUtils.isExpandedSupernode(data)) {
4973
+ if (CanvasUtils.isExpandedSupernode(data)) {
4983
4974
  const heightSvgArea = data.height - this.canvasLayout.supernodeTopAreaHeight - this.canvasLayout.supernodeSVGAreaPadding;
4984
4975
  yPosition = this.canvasLayout.supernodeTopAreaHeight + (heightSvgArea / 2);
4985
4976
 
@@ -5012,7 +5003,7 @@ export default class SVGCanvasRenderer {
5012
5003
  displayMovedComments() {
5013
5004
  this.getAllCommentGroupsSelection()
5014
5005
  .attr("transform", (c) => `translate(${c.x_pos}, ${c.y_pos})`)
5015
- .datum((d) => this.getComment(d.id));
5006
+ .datum((d) => this.activePipeline.getComment(d.id));
5016
5007
  }
5017
5008
 
5018
5009
  displayCommentsSelectionStatus() {
@@ -5088,7 +5079,7 @@ export default class SVGCanvasRenderer {
5088
5079
 
5089
5080
  // Comment Sizing Area
5090
5081
  joinedCommentGrps.selectChildren(".d3-comment-sizing")
5091
- .datum((c) => this.getComment(c.id))
5082
+ .datum((c) => this.activePipeline.getComment(c.id))
5092
5083
  .attr("x", -this.canvasLayout.commentSizingArea)
5093
5084
  .attr("y", -this.canvasLayout.commentSizingArea)
5094
5085
  .attr("height", (c) => c.height + (2 * this.canvasLayout.commentSizingArea))
@@ -5097,7 +5088,7 @@ export default class SVGCanvasRenderer {
5097
5088
 
5098
5089
  // Comment Selection Highlighting Outline
5099
5090
  joinedCommentGrps.selectChildren(".d3-comment-selection-highlight")
5100
- .datum((c) => this.getComment(c.id))
5091
+ .datum((c) => this.activePipeline.getComment(c.id))
5101
5092
  .attr("x", -this.canvasLayout.commentHighlightGap)
5102
5093
  .attr("y", -this.canvasLayout.commentHighlightGap)
5103
5094
  .attr("height", (c) => c.height + (2 * this.canvasLayout.commentHighlightGap))
@@ -5107,7 +5098,7 @@ export default class SVGCanvasRenderer {
5107
5098
 
5108
5099
  // Comment Body
5109
5100
  joinedCommentGrps.selectChildren(".d3-comment-rect")
5110
- .datum((c) => this.getComment(c.id))
5101
+ .datum((c) => this.activePipeline.getComment(c.id))
5111
5102
  .attr("height", (c) => c.height)
5112
5103
  .attr("width", (c) => c.width)
5113
5104
  .attr("class", "d3-comment-rect")
@@ -5115,7 +5106,7 @@ export default class SVGCanvasRenderer {
5115
5106
 
5116
5107
  // Comment Text
5117
5108
  joinedCommentGrps.selectChildren(".d3-foreign-object")
5118
- .datum((c) => this.getComment(c.id))
5109
+ .datum((c) => this.activePipeline.getComment(c.id))
5119
5110
  .attr("width", (c) => c.width)
5120
5111
  .attr("height", (c) => c.height)
5121
5112
  .select("div")
@@ -5299,14 +5290,14 @@ export default class SVGCanvasRenderer {
5299
5290
  if (this.textAreaHeight < scrollHeight) {
5300
5291
  this.textAreaHeight = scrollHeight;
5301
5292
  foreignObject.style("height", this.textAreaHeight + "px");
5302
- this.getComment(data.id).height = this.textAreaHeight;
5293
+ this.activePipeline.getComment(data.id).height = this.textAreaHeight;
5303
5294
  this.displayComments();
5304
5295
  this.displayLinks();
5305
5296
  }
5306
5297
  }
5307
5298
 
5308
5299
  saveCommentChanges(id, newText, newHeight) {
5309
- const comment = this.getComment(id);
5300
+ const comment = this.activePipeline.getComment(id);
5310
5301
  const data = {
5311
5302
  editType: "editComment",
5312
5303
  editSource: "canvas",
@@ -5669,7 +5660,7 @@ export default class SVGCanvasRenderer {
5669
5660
  if (this.config.enableMoveNodesOnSupernodeResize) {
5670
5661
  const objectsInfo = CanvasUtils.moveSurroundingObjects(
5671
5662
  oldSupernode,
5672
- this.activePipeline.nodes.concat(this.activePipeline.comments),
5663
+ this.activePipeline.getNodesAndComments(),
5673
5664
  this.nodeSizingDirection,
5674
5665
  this.resizeObj.width,
5675
5666
  this.resizeObj.height,
@@ -5954,13 +5945,13 @@ export default class SVGCanvasRenderer {
5954
5945
  // Update link selection area
5955
5946
  joinedLinkGrps
5956
5947
  .selectAll(".d3-link-selection-area")
5957
- .datum((d) => this.getLink(d.id))
5948
+ .datum((d) => this.activePipeline.getLink(d.id))
5958
5949
  .attr("d", (d) => d.pathInfo.path);
5959
5950
 
5960
5951
  // Update link line
5961
5952
  joinedLinkGrps
5962
5953
  .selectAll(".d3-link-line")
5963
- .datum((d) => this.getLink(d.id))
5954
+ .datum((d) => this.activePipeline.getLink(d.id))
5964
5955
  .attr("d", (d) => d.pathInfo.path)
5965
5956
  .attr("class", "d3-link-line")
5966
5957
  .attr("style", (d) => CanvasUtils.getObjectStyle(d, "line", "default"));
@@ -5971,7 +5962,7 @@ export default class SVGCanvasRenderer {
5971
5962
  (d.type === COMMENT_LINK && this.canvasLayout.commentLinkArrowHead) ||
5972
5963
  (d.type === NODE_LINK && this.canvasLayout.linkType === LINK_TYPE_STRAIGHT))
5973
5964
  .selectAll(".d3-link-line-arrow-head")
5974
- .datum((d) => this.getLink(d.id))
5965
+ .datum((d) => this.activePipeline.getLink(d.id))
5975
5966
  .attr("d", (d) => this.getArrowHead(d))
5976
5967
  .attr("transform", (d) => this.getArrowHeadTransform(d))
5977
5968
  .attr("class", "d3-link-line-arrow-head")
@@ -6095,7 +6086,7 @@ export default class SVGCanvasRenderer {
6095
6086
  updateHandles(handlesGrp, lineArray) {
6096
6087
  handlesGrp
6097
6088
  .selectAll(".d3-link-handle-start")
6098
- .datum((d) => this.getLink(d.id))
6089
+ .datum((d) => this.activePipeline.getLink(d.id))
6099
6090
  .each((datum, index, linkHandles) => {
6100
6091
  const obj = d3.select(linkHandles[index]);
6101
6092
  if (this.canvasLayout.linkStartHandleObject === "image") {
@@ -6116,7 +6107,7 @@ export default class SVGCanvasRenderer {
6116
6107
 
6117
6108
  handlesGrp
6118
6109
  .selectAll(".d3-link-handle-end")
6119
- .datum((d) => this.getLink(d.id))
6110
+ .datum((d) => this.activePipeline.getLink(d.id))
6120
6111
  .each((datum, index, linkHandles) => {
6121
6112
  const obj = d3.select(linkHandles[index]);
6122
6113
  if (this.canvasLayout.linkEndHandleObject === "image") {
@@ -6225,7 +6216,7 @@ export default class SVGCanvasRenderer {
6225
6216
  customClass = " " + d.class_name;
6226
6217
  }
6227
6218
 
6228
- const supernodeClass = this.nodeUtils.isSupernode(d) && this.nodeUtils.isExpanded(d)
6219
+ const supernodeClass = CanvasUtils.isExpandedSupernode(d)
6229
6220
  ? " d3-node-supernode-expanded"
6230
6221
  : "";
6231
6222