Skip to content

Commit

Permalink
#462 Improve test harness code that creates externally dragged objects (
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlyn authored Jan 26, 2021
1 parent 9c28bf3 commit 1f51f73
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions canvas_modules/harness/src/client/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -1160,18 +1160,35 @@ class App extends React.Component {
} else if (data.editType === "createTestHarnessNode") {
const nodeTemplate = canvasController.getPaletteNode(data.op);
if (nodeTemplate) {
data.editType = "createNode";
data.nodeTemplate = canvasController.convertNodeTemplate(nodeTemplate);
canvasController.editActionHandler(data);
const convertedTemplate = canvasController.convertNodeTemplate(nodeTemplate);
const action = {
editType: "createNode",
nodeTemplate: convertedTemplate,
pipelineId: data.pipelineId,
offsetX: data.offsetX,
offsetY: data.offsetY
};

canvasController.editActionHandler(action);
} else {
window.alert("A palette node could not be found for the dropped object. Load the 'modelerPalette.json' file and try again.");
}

} else if (data.editType === "createFromExternalObject") {
const nodeTemplate = canvasController.getPaletteNode("variablefile");
if (nodeTemplate) {
data.editType = "createNode";
data.nodeTemplate = canvasController.convertNodeTemplate(nodeTemplate);
data.nodeTemplate.label = data.dataTransfer.files[0].name;
canvasController.editActionHandler(data);
const convertedTemplate = canvasController.convertNodeTemplate(nodeTemplate);
convertedTemplate.label = data.dataTransfer.files[0].name;
const action = {
editType: "createNode",
nodeTemplate: convertedTemplate,
pipelineId: data.pipelineId,
offsetX: data.offsetX,
offsetY: data.offsetY
};
canvasController.editActionHandler(action);
} else {
window.alert("A palette node could not be found for the dropped object. Load the 'modelerPalette.json' file and try again.");
}

} else if (data.editType === "editNode") {
Expand Down

0 comments on commit 1f51f73

Please sign in to comment.