Skip to content

Commit

Permalink
#1218 Comment link IDs should be persisted when getPipelineFlow is ca…
Browse files Browse the repository at this point in the history
…lled (#1220)
  • Loading branch information
tomlyn authored Oct 25, 2022
1 parent 53be8ff commit cfeb752
Show file tree
Hide file tree
Showing 34 changed files with 197 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1237,8 +1237,10 @@ describe("Create Supernode Action", () => {
expect(isEqual(JSON.stringify(test1ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;

canvasController.contextMenuActionHandler("undo");
// console.log("Act = " + JSON.stringify(objectModel.getPipelineFlow(), null, 2));
expect(isEqual(JSON.stringify(test1ExpectedUndoFlow), JSON.stringify(objectModel.getPipelineFlow()))).to.be.true;
const actualUndo = objectModel.getPipelineFlow();
removeGeneratedLinkIds(actualUndo, supernodeCanvas);
// console.log("Act = " + JSON.stringify(actualUndo, null, 2));
expect(isEqual(JSON.stringify(test1ExpectedUndoFlow), JSON.stringify(actualUndo))).to.be.true;

canvasController.contextMenuActionHandler("redo");
expect(isEqual(JSON.stringify(test1ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;
Expand Down Expand Up @@ -1282,8 +1284,11 @@ describe("Create Supernode Action", () => {
expect(isEqual(JSON.stringify(test2ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;

canvasController.contextMenuActionHandler("undo");
// console.log("Act = " + JSON.stringify(objectModel.getPipelineFlow(), null, 2));
expect(isEqual(JSON.stringify(test2ExpectedUndoFlow), JSON.stringify(objectModel.getPipelineFlow()))).to.be.true;
const actualUndo = objectModel.getPipelineFlow();
removeGeneratedLinkIds(actualUndo, supernodeCanvas);
// console.log("Act = " + JSON.stringify(actualUndo, null, 2));
expect(isEqual(JSON.stringify(test2ExpectedUndoFlow), JSON.stringify(actualUndo))).to.be.true;


canvasController.contextMenuActionHandler("redo");
expect(isEqual(JSON.stringify(test2ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;
Expand Down Expand Up @@ -1324,8 +1329,10 @@ describe("Create Supernode Action", () => {
expect(isEqual(JSON.stringify(test3ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;

canvasController.contextMenuActionHandler("undo");
// console.log("Act = " + JSON.stringify(objectModel.getPipelineFlow(), null, 2));
expect(isEqual(JSON.stringify(test3ExpectedUndoFlow), JSON.stringify(objectModel.getPipelineFlow()))).to.be.true;
const actualUndo = objectModel.getPipelineFlow();
removeGeneratedLinkIds(actualUndo, supernodeCanvas);
// console.log("Act = " + JSON.stringify(actualUndo, null, 2));
expect(isEqual(JSON.stringify(test3ExpectedUndoFlow), JSON.stringify(actualUndo))).to.be.true;

canvasController.contextMenuActionHandler("redo");
expect(isEqual(JSON.stringify(test3ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;
Expand Down Expand Up @@ -1360,7 +1367,11 @@ describe("Create Supernode Action", () => {
expect(isEqual(JSON.stringify(test4ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;

canvasController.contextMenuActionHandler("undo");
expect(isEqual(JSON.stringify(test4ExpectedUndoFlow), JSON.stringify(objectModel.getPipelineFlow()))).to.be.true;
const actualUndo = objectModel.getPipelineFlow();
removeGeneratedLinkIds(actualUndo, supernodeCanvas);
// console.log("Act = " + JSON.stringify(actualUndo, null, 2));
expect(isEqual(JSON.stringify(test4ExpectedUndoFlow), JSON.stringify(actualUndo))).to.be.true;


canvasController.contextMenuActionHandler("redo");
expect(isEqual(JSON.stringify(test4ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;
Expand Down Expand Up @@ -1396,7 +1407,11 @@ describe("Create Supernode Action", () => {
expect(isEqual(JSON.stringify(test5ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;

canvasController.contextMenuActionHandler("undo");
expect(isEqual(JSON.stringify(test5ExpectedUndoFlow), JSON.stringify(objectModel.getPipelineFlow()))).to.be.true;
const actualUndo = objectModel.getPipelineFlow();
removeGeneratedLinkIds(actualUndo, supernodeCanvas);
// console.log("Act = " + JSON.stringify(actualUndo, null, 2));
expect(isEqual(JSON.stringify(test5ExpectedUndoFlow), JSON.stringify(actualUndo))).to.be.true;


canvasController.contextMenuActionHandler("redo");
expect(isEqual(JSON.stringify(test5ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;
Expand Down Expand Up @@ -1440,7 +1455,10 @@ describe("Create Supernode Action", () => {
expect(isEqual(JSON.stringify(test6ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;

canvasController.contextMenuActionHandler("undo");
expect(isEqual(JSON.stringify(test6ExpectedUndoFlow), JSON.stringify(objectModel.getPipelineFlow()))).to.be.true;
const actualUndo = objectModel.getPipelineFlow();
removeGeneratedLinkIds(actualUndo, supernodeCanvas);
// console.log("Act = " + JSON.stringify(actualUndo, null, 2));
expect(isEqual(JSON.stringify(test6ExpectedUndoFlow), JSON.stringify(actualUndo))).to.be.true;

canvasController.contextMenuActionHandler("redo");
expect(isEqual(JSON.stringify(test6ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;
Expand Down Expand Up @@ -1481,7 +1499,11 @@ describe("Create Supernode Action", () => {
expect(isEqual(JSON.stringify(test7ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;

canvasController.contextMenuActionHandler("undo");
expect(isEqual(JSON.stringify(test7ExpectedUndoFlow), JSON.stringify(objectModel.getPipelineFlow()))).to.be.true;
const actualUndo = objectModel.getPipelineFlow();
removeGeneratedLinkIds(actualUndo, supernodeCanvas);
// console.log("Act = " + JSON.stringify(actualUndo, null, 2));
expect(isEqual(JSON.stringify(test7ExpectedUndoFlow), JSON.stringify(actualUndo))).to.be.true;


canvasController.contextMenuActionHandler("redo");
expect(isEqual(JSON.stringify(test7ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;
Expand Down Expand Up @@ -1523,8 +1545,11 @@ describe("Create Supernode Action", () => {
expect(isEqual(JSON.stringify(test8ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;

canvasController.contextMenuActionHandler("undo");
// console.log("Act = " + JSON.stringify(objectModel.getPipelineFlow(), null, 2));
expect(isEqual(JSON.stringify(test8ExpectedUndoFlow), JSON.stringify(objectModel.getPipelineFlow()))).to.be.true;
const actualUndo = objectModel.getPipelineFlow();
removeGeneratedLinkIds(actualUndo, supernodeCanvas);
// console.log("Act = " + JSON.stringify(actualUndo, null, 2));
expect(isEqual(JSON.stringify(test8ExpectedUndoFlow), JSON.stringify(actualUndo))).to.be.true;


canvasController.contextMenuActionHandler("redo");
expect(isEqual(JSON.stringify(test8ExpectedFlow), JSON.stringify(pipelineFlow))).to.be.true;
Expand Down Expand Up @@ -2061,7 +2086,7 @@ function removeGeneratedLinkIds(firstPipelineFlow, secondPipelineFlow) {
pipeline.app_data.ui_data.comments.forEach((comment) => {
if (comment.associated_id_refs) {
comment.associated_id_refs.forEach((link) => {
if (findCommentLinkInSecondPipelineFlow(link.id, secondPipelineFlow)) {
if (!findCommentLinkInSecondPipelineFlow(link.id, secondPipelineFlow)) {
delete link.id;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,18 +398,22 @@
"content": "The 4 different node types",
"associated_id_refs": [
{
"id": "3b54f984-ab32-4da0-8a5a-41e3dba5dde3",
"node_ref": "id8I6RH2V91XW",
"class_name": "canvas-comment-link"
},
{
"id": "eaa87bbf-0a30-47df-bda1-da154c566dfb",
"node_ref": "idGWRVT47XDV",
"class_name": "canvas-comment-link"
},
{
"id": "307b36cc-4058-41b5-9840-7ed01740023c",
"node_ref": "nodeIDSuperNodePE",
"class_name": "canvas-comment-link"
},
{
"id": "bbf2f832-b096-471d-a6a1-9072619f1747",
"node_ref": "id125TTEEIK7V",
"class_name": "canvas-comment-link"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -823,14 +823,17 @@
"content": "Connected to 4 nodes\n",
"associated_id_refs": [
{
"id": "3b54f984-ab32-4da0-8a5a-41e3dba5dde3",
"node_ref": "id8I6RH2V91XW",
"class_name": "canvas-comment-link"
},
{
"id": "bbf2f832-b096-471d-a6a1-9072619f1747",
"node_ref": "id125TTEEIK7V",
"class_name": "canvas-comment-link"
},
{
"id": "307b36cc-4058-41b5-9840-7ed01740023c",
"node_ref": "nodeIDMultiPlotPE",
"class_name": "d3-comment-link"
}
Expand Down Expand Up @@ -1514,6 +1517,7 @@
"content": "This is connected to the select node",
"associated_id_refs": [
{
"id": "aaee5567d-aaaa-bbbb-ccccc-d5d6d7d8d7",
"node_ref": "6f704d84-85be-4520-9d76-57fe2295b310",
"class_name": "d3-comment-link"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -874,18 +874,22 @@
"content": "Connected to 4 nodes\n",
"associated_id_refs": [
{
"id": "3b54f984-ab32-4da0-8a5a-41e3dba5dde3",
"node_ref": "id8I6RH2V91XW",
"class_name": "canvas-comment-link"
},
{
"id": "bbf2f832-b096-471d-a6a1-9072619f1747",
"node_ref": "id125TTEEIK7V",
"class_name": "canvas-comment-link"
},
{
"id": "307b36cc-4058-41b5-9840-7ed01740023c",
"node_ref": "nodeIDMultiPlotPE",
"class_name": "d3-comment-link"
},
{
"id": "eaa87bbf-0a30-47df-bda1-da154c566dfb",
"node_ref": "idGWRVT47XDV",
"class_name": "canvas-comment-link"
}
Expand All @@ -901,6 +905,7 @@
"content": "This is connected to the select node",
"associated_id_refs": [
{
"id": "aaee5567d-aaaa-bbbb-ccccc-d5d6d7d8d7",
"node_ref": "6f704d84-85be-4520-9d76-57fe2295b310",
"class_name": "d3-comment-link"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,14 +816,17 @@
"content": "Connected to 4 nodes\n",
"associated_id_refs": [
{
"id": "3b54f984-ab32-4da0-8a5a-41e3dba5dde3",
"node_ref": "id8I6RH2V91XW",
"class_name": "canvas-comment-link"
},
{
"id": "bbf2f832-b096-471d-a6a1-9072619f1747",
"node_ref": "id125TTEEIK7V",
"class_name": "canvas-comment-link"
},
{
"id": "307b36cc-4058-41b5-9840-7ed01740023c",
"node_ref": "nodeIDMultiPlotPE",
"class_name": "d3-comment-link"
}
Expand Down Expand Up @@ -1517,6 +1520,7 @@
"content": "This is connected to the select node",
"associated_id_refs": [
{
"id": "aaee5567d-aaaa-bbbb-ccccc-d5d6d7d8d7",
"node_ref": "6f704d84-85be-4520-9d76-57fe2295b310",
"class_name": "d3-comment-link"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -864,18 +864,22 @@
"content": "Connected to 4 nodes\n",
"associated_id_refs": [
{
"id": "3b54f984-ab32-4da0-8a5a-41e3dba5dde3",
"node_ref": "id8I6RH2V91XW",
"class_name": "canvas-comment-link"
},
{
"id": "bbf2f832-b096-471d-a6a1-9072619f1747",
"node_ref": "id125TTEEIK7V",
"class_name": "canvas-comment-link"
},
{
"id": "307b36cc-4058-41b5-9840-7ed01740023c",
"node_ref": "nodeIDMultiPlotPE",
"class_name": "d3-comment-link"
},
{
"id": "eaa87bbf-0a30-47df-bda1-da154c566dfb",
"node_ref": "idGWRVT47XDV",
"class_name": "canvas-comment-link"
}
Expand All @@ -901,6 +905,7 @@
"content": "This is connected to the select node",
"associated_id_refs": [
{
"id": "aaee5567d-aaaa-bbbb-ccccc-d5d6d7d8d7",
"node_ref": "6f704d84-85be-4520-9d76-57fe2295b310",
"class_name": "d3-comment-link"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@
"content": "This is connected to the select node",
"associated_id_refs": [
{
"id": "aaee5567d-aaaa-bbbb-ccccc-d5d6d7d8d7",
"node_ref": "6f704d84-85be-4520-9d76-57fe2295b310",
"class_name": "d3-comment-link"
}
Expand Down Expand Up @@ -1521,10 +1522,12 @@
"content": "Connected to 4 nodes\n",
"associated_id_refs": [
{
"id": "eaa87bbf-0a30-47df-bda1-da154c566dfb",
"node_ref": "idGWRVT47XDV",
"class_name": "canvas-comment-link"
},
{
"id": "307b36cc-4058-41b5-9840-7ed01740023c",
"node_ref": "nodeIDMultiPlotPE",
"class_name": "d3-comment-link"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@
"content": "This is connected to the select node",
"associated_id_refs": [
{
"id": "aaee5567d-aaaa-bbbb-ccccc-d5d6d7d8d7",
"node_ref": "6f704d84-85be-4520-9d76-57fe2295b310",
"class_name": "d3-comment-link"
}
Expand All @@ -889,18 +890,22 @@
"content": "Connected to 4 nodes\n",
"associated_id_refs": [
{
"id": "eaa87bbf-0a30-47df-bda1-da154c566dfb",
"node_ref": "idGWRVT47XDV",
"class_name": "canvas-comment-link"
},
{
"id": "307b36cc-4058-41b5-9840-7ed01740023c",
"node_ref": "nodeIDMultiPlotPE",
"class_name": "d3-comment-link"
},
{
"id": "3b54f984-ab32-4da0-8a5a-41e3dba5dde3",
"node_ref": "id8I6RH2V91XW",
"class_name": "canvas-comment-link"
},
{
"id": "bbf2f832-b096-471d-a6a1-9072619f1747",
"node_ref": "id125TTEEIK7V",
"class_name": "canvas-comment-link"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,14 +820,17 @@
"content": "Connected to 4 nodes\n",
"associated_id_refs": [
{
"id": "3b54f984-ab32-4da0-8a5a-41e3dba5dde3",
"node_ref": "id8I6RH2V91XW",
"class_name": "canvas-comment-link"
},
{
"id": "eaa87bbf-0a30-47df-bda1-da154c566dfb",
"node_ref": "idGWRVT47XDV",
"class_name": "canvas-comment-link"
},
{
"id": "307b36cc-4058-41b5-9840-7ed01740023c",
"node_ref": "nodeIDMultiPlotPE",
"class_name": "d3-comment-link"
}
Expand All @@ -843,6 +846,7 @@
"content": "This is connected to the select node",
"associated_id_refs": [
{
"id": "aaee5567d-aaaa-bbbb-ccccc-d5d6d7d8d7",
"node_ref": "6f704d84-85be-4520-9d76-57fe2295b310",
"class_name": "d3-comment-link"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -874,18 +874,22 @@
"content": "Connected to 4 nodes\n",
"associated_id_refs": [
{
"id": "3b54f984-ab32-4da0-8a5a-41e3dba5dde3",
"node_ref": "id8I6RH2V91XW",
"class_name": "canvas-comment-link"
},
{
"id": "eaa87bbf-0a30-47df-bda1-da154c566dfb",
"node_ref": "idGWRVT47XDV",
"class_name": "canvas-comment-link"
},
{
"id": "307b36cc-4058-41b5-9840-7ed01740023c",
"node_ref": "nodeIDMultiPlotPE",
"class_name": "d3-comment-link"
},
{
"id": "bbf2f832-b096-471d-a6a1-9072619f1747",
"node_ref": "id125TTEEIK7V",
"class_name": "canvas-comment-link"
}
Expand All @@ -901,6 +905,7 @@
"content": "This is connected to the select node",
"associated_id_refs": [
{
"id": "aaee5567d-aaaa-bbbb-ccccc-d5d6d7d8d7",
"node_ref": "6f704d84-85be-4520-9d76-57fe2295b310",
"class_name": "d3-comment-link"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,10 +743,12 @@
"content": "Connected to 4 nodes\n",
"associated_id_refs": [
{
"id": "3b54f984-ab32-4da0-8a5a-41e3dba5dde3",
"node_ref": "id8I6RH2V91XW",
"class_name": "canvas-comment-link"
},
{
"id": "eaa87bbf-0a30-47df-bda1-da154c566dfb",
"node_ref": "idGWRVT47XDV",
"class_name": "canvas-comment-link"
}
Expand All @@ -762,6 +764,7 @@
"content": "This is connected to the select node",
"associated_id_refs": [
{
"id": "aaee5567d-aaaa-bbbb-ccccc-d5d6d7d8d7",
"node_ref": "6f704d84-85be-4520-9d76-57fe2295b310",
"class_name": "d3-comment-link"
}
Expand Down
Loading

0 comments on commit cfeb752

Please sign in to comment.