Skip to content

Commit fb814d1

Browse files
committed
fix(kamelet): update template.from references to template.route.from after route structure change
- Update camel-component-filter.service.ts path checks from 'template.from' to 'template.route.from' to match new KameletVisualEntity.ROOT_PATH - Update abstract-camel-visual-entity.ts canDragNode check for the same path - Update camel-component-filter.service.test.ts unit test path accordingly - Update e2e test branchingStepAddition.cy.ts edge path references - Update e2e test stepCopy.cy.ts expected Kamelet copy structure to use spec.template.route.from instead of spec.template.from Relates to KaotoIO#3841
1 parent 9e510ac commit fb814d1

7 files changed

Lines changed: 37 additions & 33 deletions

File tree

packages/ui-tests/cypress/e2e/designer/basicNodeActions/stepCopy.cy.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,17 @@ describe('Tests for Design page', { browser: '!firefox' }, () => {
107107
types: { out: { mediaType: 'application/json' } },
108108
dependencies: ['camel:timer', 'camel:http', 'camel:kamelet'],
109109
template: {
110-
from: {
111-
id: 'from-1870',
112-
uri: 'timer:user',
113-
parameters: { period: '{{period}}' },
114-
steps: [
115-
{ setBody: { id: 'setBody-3387', expression: { simple: {} } } },
116-
{ marshal: { id: 'marshal-1414' } },
117-
{ to: { uri: 'kamelet:sink', parameters: {} } },
118-
],
110+
route: {
111+
from: {
112+
id: 'from-1870',
113+
uri: 'timer:user',
114+
parameters: { period: '{{period}}' },
115+
steps: [
116+
{ setBody: { id: 'setBody-3387', expression: { simple: {} } } },
117+
{ marshal: { id: 'marshal-1414' } },
118+
{ to: { uri: 'kamelet:sink', parameters: {} } },
119+
],
120+
},
119121
},
120122
},
121123
},

packages/ui-tests/cypress/e2e/designer/branchingFlows/branchingStepAddition.cy.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ describe('Test for Branching actions from the canvas', () => {
6363
cy.checkNodeExist('activemq', 1);
6464
cy.checkEdgeExists(
6565
'eip-action',
66-
'template.from.steps.1.choice.when.0.steps.1.setHeader',
67-
'template.from.steps.1.choice.when.0.steps.2.to',
66+
'template.route.from.steps.1.choice.when.0.steps.1.setHeader',
67+
'template.route.from.steps.1.choice.when.0.steps.2.to',
6868
);
6969
});
7070

@@ -79,8 +79,8 @@ describe('Test for Branching actions from the canvas', () => {
7979
cy.checkNodeExist('activemq', 1);
8080
cy.checkEdgeExists(
8181
'eip-action',
82-
'template.from.steps.1.choice.when.0.steps.0.to',
83-
'template.from.steps.1.choice.when.0.steps.1.to',
82+
'template.route.from.steps.1.choice.when.0.steps.0.to',
83+
'template.route.from.steps.1.choice.when.0.steps.1.to',
8484
);
8585
});
8686

@@ -93,6 +93,6 @@ describe('Test for Branching actions from the canvas', () => {
9393
cy.chooseFromCatalog('component', 'activemq');
9494

9595
cy.checkNodeExist('activemq', 1);
96-
cy.checkEdgeExists('eip-action', 'template.from.steps.2.to', 'template.from.steps.3.filter');
96+
cy.checkEdgeExists('eip-action', 'template.route.from.steps.2.to', 'template.route.from.steps.3.filter');
9797
});
9898
});

packages/ui-tests/cypress/fixtures/flows/kamelet/basic.yaml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@ spec:
2424
- camel:http
2525
- camel:kamelet
2626
template:
27-
from:
28-
id: from-1870
29-
uri: timer:user
30-
parameters:
31-
period: "{{period}}"
32-
steps:
33-
- setBody:
34-
id: setBody-3387
35-
expression:
36-
simple: {}
37-
- marshal:
38-
id: marshal-1414
39-
- to:
40-
uri: kamelet:sink
41-
parameters: {}
27+
route:
28+
from:
29+
id: from-1870
30+
uri: timer:user
31+
parameters:
32+
period: '{{period}}'
33+
steps:
34+
- setBody:
35+
id: setBody-3387
36+
expression:
37+
simple: {}
38+
- marshal:
39+
id: marshal-1414
40+
- to:
41+
uri: kamelet:sink
42+
parameters: {}

packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export abstract class AbstractCamelVisualEntity<T extends object> implements Bas
236236
canDragNode(path?: string) {
237237
if (!isDefined(path)) return false;
238238

239-
return path !== 'route' && path !== 'route.from' && path !== 'template.from';
239+
return path !== 'route' && path !== 'route.from' && path !== 'template.route.from';
240240
}
241241

242242
canDropOnNode(path?: string) {

packages/ui/src/models/visualization/flows/kamelet-visual-entity.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import catalogLibrary from '@kaoto/camel-catalog/index.json';
22
import { CatalogLibrary } from '@kaoto/camel-catalog/types';
3+
import { cloneDeep } from 'lodash';
34

45
import { DynamicCatalogRegistry } from '../../../dynamic-catalog/dynamic-catalog-registry';
56
import { mockRandomValues } from '../../../stubs';

packages/ui/src/models/visualization/flows/support/camel-component-filter.service.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ describe('CamelComponentFilterService', () => {
338338
it('should not provide ProducerOnly components', () => {
339339
const filterFn = CamelComponentFilterService.getKameletCompatibleComponents(AddStepMode.ReplaceStep, {
340340
name: 'from',
341-
path: 'template.from',
341+
path: 'template.route.from',
342342
processorName: 'from' as keyof ProcessorDefinition,
343343
label: 'timer',
344344
isPlaceholder: false,

packages/ui/src/models/visualization/flows/support/camel-component-filter.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class CamelComponentFilterService {
6363
const camelComponentFilter = this.getCamelCompatibleComponents(mode, visualEntityData, definition);
6464

6565
/** For the `from` step we want to add kamelet:source and leverage the existing getCamelCompatibleComponents method */
66-
if (mode === AddStepMode.ReplaceStep && visualEntityData.path === 'template.from') {
66+
if (mode === AddStepMode.ReplaceStep && visualEntityData.path === 'template.route.from') {
6767
return (item: ITile) => {
6868
return (item.type === CatalogKind.Kamelet && item.name === 'source') || camelComponentFilter(item);
6969
};
@@ -82,7 +82,7 @@ export class CamelComponentFilterService {
8282
private static replaceFilter(mode: AddStepMode, visualEntityData: IVisualizationNodeData): TileFilter | undefined {
8383
if (
8484
mode === AddStepMode.ReplaceStep &&
85-
(visualEntityData.path === 'route.from' || visualEntityData.path === 'template.from')
85+
(visualEntityData.path === 'route.from' || visualEntityData.path === 'template.route.from')
8686
) {
8787
/**
8888
* For the `from` step we want to show only components which are not `producerOnly`,

0 commit comments

Comments
 (0)