Skip to content

Commit

Permalink
fix(Pipe): Use path as ID
Browse files Browse the repository at this point in the history
Currently, the Kamelet name is being used as ID for the canvas node,
causing to have duplicated IDs when a Kamelet is added twice or more
times in a Pipe.

The fix is to use the `path` instead.

fix: #1873
  • Loading branch information
lordrip committed Jan 8, 2025
1 parent 91ec9a6 commit 44e3e72
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@ describe('Pipe', () => {
expect(vizNode.data.path).toEqual(PipeVisualEntity.ROOT_PATH);
});

it('should use the path as the node id', () => {
const vizNode = pipeVisualEntity.toVizNode();
const sourceNode = vizNode.getChildren()![0];
const stepNode = sourceNode.getNextNode()!;
const sinkNode = stepNode.getNextNode()!;

expect(sourceNode.id).toEqual('source');
expect(stepNode.id).toEqual('steps.0');
expect(sinkNode.id).toEqual('sink');
});

it('should use the uri as the node label', () => {
const vizNode = pipeVisualEntity.toVizNode();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export class PipeVisualEntity implements BaseVisualCamelEntity {
icon,
};

return createVisualizationNode(step?.ref?.name ?? path, data);
return createVisualizationNode(path, data);
}

private getVizNodesFromSteps(steps: PipeStep[] = []): IVisualizationNode[] {
Expand Down

0 comments on commit 44e3e72

Please sign in to comment.