Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
Signed-off-by: srikant <[email protected]>
  • Loading branch information
srikant-ch5 committed Feb 14, 2025
2 parents 43810cc + 58c0ac5 commit 74c42f1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export default class CreateNodeOnLinkAction extends Action {
this.apiPipeline.addNode(this.newNode);
// The new node must be added to the canvas before trying to create the
// links because the link creation code requires linked nodes to exist.
this.firstLink = this.apiPipeline.createNodeLink(this.firstLinkSrcInfo, this.firstLinkTrgInfo, { type: "nodeLink" });
this.secondLink = this.apiPipeline.createNodeLink(this.secondLinkSrcInfo, this.secondLinkTrgInfo, { type: "nodeLink" });
this.firstLink = this.apiPipeline.createNodeLink(this.firstLinkSrcInfo, this.firstLinkTrgInfo);
this.secondLink = this.apiPipeline.createNodeLink(this.secondLinkSrcInfo, this.secondLinkTrgInfo);
this.apiPipeline.addLinks([this.firstLink, this.secondLink]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ export default class CreateSuperNodeAction extends Action {
this.newLinks = [];
this.supernodeLinkDefs.forEach((linkDef) => {
this.newLinks.push(
this.apiPipeline.createNodeLink(linkDef.srcInfo, linkDef.trgInfo, { type: NODE_LINK })
this.apiPipeline.createNodeLink(linkDef.srcInfo, linkDef.trgInfo)
);
});
this.apiPipeline.addLinks(this.newLinks);
Expand All @@ -563,7 +563,7 @@ export default class CreateSuperNodeAction extends Action {
this.subflowNewLinks = [];
this.bindingNodeLinkDefs.forEach((linkDef) => {
this.subflowNewLinks.push(
this.subAPIPipeline.createNodeLink(linkDef.srcInfo, linkDef.trgInfo, { type: NODE_LINK })
this.subAPIPipeline.createNodeLink(linkDef.srcInfo, linkDef.trgInfo)
);
});
this.subAPIPipeline.addLinks(this.subflowNewLinks);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export default class InsertNodeIntoLinkAction extends Action {
this.apiPipeline.deleteLink({ id: this.data.link.id });
this.apiPipeline.moveObjects({ nodes: [this.node.id], offsetX: this.data.offsetX, offsetY: this.data.offsetY });

this.firstLink = this.apiPipeline.createNodeLink(this.firstLinkSrcInfo, this.firstLinkTrgInfo, { type: "nodeLink" });
this.secondLink = this.apiPipeline.createNodeLink(this.secondLinkSrcInfo, this.secondLinkTrgInfo, { type: "nodeLink" });
this.firstLink = this.apiPipeline.createNodeLink(this.firstLinkSrcInfo, this.firstLinkTrgInfo);
this.secondLink = this.apiPipeline.createNodeLink(this.secondLinkSrcInfo, this.secondLinkTrgInfo);
this.apiPipeline.addLinks([this.firstLink, this.secondLink]);
}

Expand Down
10 changes: 5 additions & 5 deletions canvas_modules/common-canvas/src/object-model/api-pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ export default class APIPipeline {

// Creates a node link from the srcInfo and trgInfo and other link 'data'
// passed in.
createNodeLink(srcInfo, trgInfo, data) {
createNodeLink(srcInfo, trgInfo, data = { type: NODE_LINK }) {
const srcNode = this.getNode(srcInfo.id);
const trgNode = this.getNode(trgInfo.id);
const links = this.getLinks();
Expand Down Expand Up @@ -1261,10 +1261,10 @@ export default class APIPipeline {
// at the target end. The input data object may contain some or all of the
// link properties because they may be populatd by the host application
// in the beforeEditActionHandler.
createNodeLinkDetached(data) {
createNodeLinkDetached(data = {}) {
const link = {};
link.id = data.id ? data.id : this.objectModel.getUniqueId(CREATE_NODE_LINK, { "sourceNode": this.getNode(data.srcNodeId) });
link.type = data.type;
link.type = NODE_LINK;
link.srcNodeId = data.srcNodeId;
link.srcNodePortId = data.srcNodePortId;
link.trgPos = { x_pos: data.trgPos.x, y_pos: data.trgPos.y };
Expand All @@ -1284,14 +1284,14 @@ export default class APIPipeline {
return link;
}

createCommentLinks(data) {
createCommentLinks(data = {}) {
const linkCommentList = [];
data.nodes.forEach((srcNodeId) => {
data.targetNodes.forEach((trgNodeId) => {
if (CanvasUtils.isCommentLinkConnectionAllowed(srcNodeId, trgNodeId, this.getLinks())) {
const info = {};
info.id = this.objectModel.getUniqueId(CREATE_COMMENT_LINK, { "comment": this.getComment(srcNodeId), "targetNode": this.getNode(trgNodeId) });
info.type = data.type;
info.type = COMMENT_LINK;
info.srcNodeId = srcNodeId;
info.trgNodeId = trgNodeId;
linkCommentList.push(info);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ export default class PromptCanvas extends React.Component {
this.canvasController.addNode(newNode);

const linksToAdd = this.canvasController.createNodeLinks({
type: "nodeLink",
nodes: [{ id: srcNodeId, portId: srcPortId }],
targetNodes: [{ id: newNode.id }]
});
Expand Down Expand Up @@ -179,7 +178,6 @@ export default class PromptCanvas extends React.Component {
this.canvasController.addNode(promptNode);
const linksToAdd = this.canvasController.createNodeLinks({
id: this.genPromptLinkId(srcNodeId, srcPortId),
type: "nodeLink",
nodes: [{ id: srcNodeId, portId: srcPortId }],
targetNodes: [{ id: promptNode.id }]
});
Expand Down

0 comments on commit 74c42f1

Please sign in to comment.