From 2e6d8e6ffc78b3762082df51982c2bfbeea69266 Mon Sep 17 00:00:00 2001 From: "Ricardo M." Date: Wed, 16 Oct 2024 11:37:54 +0000 Subject: [PATCH] fix(Entities): Connect `from` with `route` object Currently, the `from` object is disconnected from the `route` object, and in order to make the `VisualizationNodes` IDs static, we need to connect the entire tree. --- .../Canvas/Form/CanvasForm.test.tsx | 4 +- packages/ui/src/hooks/entities.test.tsx | 4 +- .../__snapshots__/camel-resource.test.ts.snap | 39 ++- .../kamelet-resource.test.ts.snap | 39 ++- .../src/models/camel/camel-resource.test.ts | 2 +- .../ui/src/models/camel/kamelet-resource.ts | 2 +- .../visualization/base-visual-entity.ts | 3 + .../abstract-camel-visual-entity.test.ts | 4 +- .../flows/abstract-camel-visual-entity.ts | 61 ++-- .../camel-error-handler-visual-entity.ts | 7 +- .../camel-intercept-from-visual-entity.ts | 4 + ...ntercept-send-to-endpoint-visual-entity.ts | 4 + .../flows/camel-intercept-visual-entity.ts | 4 + .../camel-on-completion-visual-entity.ts | 4 + .../flows/camel-on-exception-visual-entity.ts | 4 + .../camel-rest-configuration-visual-entity.ts | 9 +- ...camel-route-configuration-visual-entity.ts | 55 ++-- .../flows/camel-route-visual-entity.test.ts | 88 +++--- .../flows/camel-route-visual-entity.ts | 41 +-- .../flows/kamelet-visual-entity.test.ts | 13 +- .../flows/kamelet-visual-entity.ts | 52 ++-- .../visualization/flows/pipe-visual-entity.ts | 22 +- .../__snapshots__/nodes-edges.test.ts.snap | 276 +++++++++--------- 23 files changed, 401 insertions(+), 340 deletions(-) diff --git a/packages/ui/src/components/Visualization/Canvas/Form/CanvasForm.test.tsx b/packages/ui/src/components/Visualization/Canvas/Form/CanvasForm.test.tsx index a610fcc23..e7c1e79cb 100644 --- a/packages/ui/src/components/Visualization/Canvas/Form/CanvasForm.test.tsx +++ b/packages/ui/src/components/Visualization/Canvas/Form/CanvasForm.test.tsx @@ -174,7 +174,7 @@ describe('CanvasForm', () => { fireEvent.click(closeSideBarButton); }); - expect(camelRouteVisualEntity.route.description).toBeUndefined(); + expect(camelRouteVisualEntity.entityDef.route.description).toBeUndefined(); }); it("should serialize empty strings(with space characters) `' '` as `undefined`", async () => { @@ -209,7 +209,7 @@ describe('CanvasForm', () => { fireEvent.click(closeSideBarButton); }); - expect(camelRouteVisualEntity.route.description).toBeUndefined(); + expect(camelRouteVisualEntity.entityDef.route.description).toBeUndefined(); }); it('should allow consumers to update the Camel Route ID', async () => { diff --git a/packages/ui/src/hooks/entities.test.tsx b/packages/ui/src/hooks/entities.test.tsx index beefc4156..249767606 100644 --- a/packages/ui/src/hooks/entities.test.tsx +++ b/packages/ui/src/hooks/entities.test.tsx @@ -3,7 +3,7 @@ import { CamelResource, SourceSchemaType } from '../models/camel'; import { CamelRouteVisualEntity } from '../models/visualization/flows'; import { camelRouteJson, camelRouteYaml } from '../stubs/camel-route'; import { camelRouteYaml_1_1_original, camelRouteYaml_1_1_updated } from '../stubs/camel-route-yaml-1.1'; -import { EventNotifier, setValue } from '../utils'; +import { EventNotifier } from '../utils'; import { useEntities } from './entities'; describe('useEntities', () => { @@ -52,7 +52,7 @@ describe('useEntities', () => { }); act(() => { - setValue(result.current.visualEntities[0], 'route.from.parameters.bindingMode', 'off'); + result.current.visualEntities[0].updateModel('route.from.parameters.bindingMode', 'off'); result.current.updateSourceCodeFromEntities(); }); diff --git a/packages/ui/src/models/camel/__snapshots__/camel-resource.test.ts.snap b/packages/ui/src/models/camel/__snapshots__/camel-resource.test.ts.snap index 5967de7b6..27a2e2020 100644 --- a/packages/ui/src/models/camel/__snapshots__/camel-resource.test.ts.snap +++ b/packages/ui/src/models/camel/__snapshots__/camel-resource.test.ts.snap @@ -3,29 +3,26 @@ exports[`createCamelResource should create an empty KameletResource if no args is specified 1`] = ` [ { - "route": { - "from": { - "id": "from-1234", - "parameters": { - "period": "{{period}}", - "timerName": "user", - }, - "steps": [ - { - "to": { - "parameters": { - "httpUri": "random-data-api.com/api/v2/users", - }, - "uri": "https", + "from": { + "id": "from-1234", + "parameters": { + "period": "{{period}}", + "timerName": "user", + }, + "steps": [ + { + "to": { + "parameters": { + "httpUri": "random-data-api.com/api/v2/users", }, + "uri": "https", }, - { - "to": "kamelet:sink", - }, - ], - "uri": "timer", - }, - "id": "kamelet-1234", + }, + { + "to": "kamelet:sink", + }, + ], + "uri": "timer", }, }, ] diff --git a/packages/ui/src/models/camel/__snapshots__/kamelet-resource.test.ts.snap b/packages/ui/src/models/camel/__snapshots__/kamelet-resource.test.ts.snap index 042dc572d..aece15195 100644 --- a/packages/ui/src/models/camel/__snapshots__/kamelet-resource.test.ts.snap +++ b/packages/ui/src/models/camel/__snapshots__/kamelet-resource.test.ts.snap @@ -176,29 +176,26 @@ exports[`KameletResource should create a new KameletResource with a kamelet 1`] exports[`KameletResource should get the visual entities (Camel Route Visual Entity) 1`] = ` [ { - "route": { - "from": { - "id": "from-1234", - "parameters": { - "period": "{{period}}", - "timerName": "user", - }, - "steps": [ - { - "to": { - "parameters": { - "httpUri": "random-data-api.com/api/v2/users", - }, - "uri": "https", + "from": { + "id": "from-1234", + "parameters": { + "period": "{{period}}", + "timerName": "user", + }, + "steps": [ + { + "to": { + "parameters": { + "httpUri": "random-data-api.com/api/v2/users", }, + "uri": "https", }, - { - "to": "kamelet:sink", - }, - ], - "uri": "timer", - }, - "id": "kamelet-1234", + }, + { + "to": "kamelet:sink", + }, + ], + "uri": "timer", }, }, ] diff --git a/packages/ui/src/models/camel/camel-resource.test.ts b/packages/ui/src/models/camel/camel-resource.test.ts index fc9619273..99af20671 100644 --- a/packages/ui/src/models/camel/camel-resource.test.ts +++ b/packages/ui/src/models/camel/camel-resource.test.ts @@ -59,7 +59,7 @@ describe('createCamelResource', () => { expect(resource.getType()).toEqual(SourceSchemaType.Route); expect(resource.getVisualEntities().length).toEqual(1); const vis = resource.getVisualEntities()[0] as CamelRouteVisualEntity; - expect(vis.route.from?.uri).toBeDefined(); + expect(vis.entityDef.route.from?.uri).toBeDefined(); }); // TODO diff --git a/packages/ui/src/models/camel/kamelet-resource.ts b/packages/ui/src/models/camel/kamelet-resource.ts index abe9a06a4..a5735a7aa 100644 --- a/packages/ui/src/models/camel/kamelet-resource.ts +++ b/packages/ui/src/models/camel/kamelet-resource.ts @@ -62,7 +62,7 @@ export class KameletResource extends CamelKResource implements RouteTemplateBean * the CamelRouteVisualEntity. */ set(this.resource, 'metadata.name', this.flow.getId()); - set(this.resource, 'spec.template.from', this.flow.route.from); + set(this.resource, 'spec.template.from', this.flow.entityDef.template.from); set(this.resource, 'spec.template.beans', this.beans?.parent.beans); return this.resource as IKameletDefinition; } diff --git a/packages/ui/src/models/visualization/base-visual-entity.ts b/packages/ui/src/models/visualization/base-visual-entity.ts index c51c8d9e5..9076b4258 100644 --- a/packages/ui/src/models/visualization/base-visual-entity.ts +++ b/packages/ui/src/models/visualization/base-visual-entity.ts @@ -14,6 +14,9 @@ export interface BaseVisualCamelEntity extends BaseCamelEntity { id: string; type: EntityType; + /** Return the root path of the entity */ + getRootPath: () => string; + getId: () => string; setId: (id: string) => void; diff --git a/packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.test.ts b/packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.test.ts index 045543726..e93f25ae9 100644 --- a/packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.test.ts +++ b/packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.test.ts @@ -134,9 +134,9 @@ describe('AbstractCamelVisualEntity', () => { describe('updateModel', () => { it('should update the model with the new value', () => { const newUri = 'timer'; - abstractVisualEntity.updateModel('from', { uri: newUri }); + abstractVisualEntity.updateModel('route.from', { uri: newUri }); - expect(abstractVisualEntity.route.from.uri).toEqual(newUri); + expect(abstractVisualEntity.entityDef.route.from.uri).toEqual(newUri); }); it('should delegate the serialization to the `CamelComponentSchemaService`', () => { diff --git a/packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.ts b/packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.ts index 6071d48a5..dced5e01b 100644 --- a/packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.ts +++ b/packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.ts @@ -1,6 +1,6 @@ import { ProcessorDefinition } from '@kaoto/camel-catalog/types'; import { SchemaService } from '../../../components/Form/schema.service'; -import { ROOT_PATH, getArrayProperty, getValue, setValue } from '../../../utils'; +import { getArrayProperty, getValue, setValue } from '../../../utils'; import { NodeIconResolver, NodeIconType } from '../../../utils/node-icon-resolver'; import { DefinedComponent } from '../../camel-catalog-index'; import { EntityType } from '../../camel/entities'; @@ -21,10 +21,11 @@ import { CamelProcessorStepsProperties, CamelRouteVisualEntityData } from './sup import { ModelValidationService } from './support/validators/model-validation.service'; export abstract class AbstractCamelVisualEntity implements BaseVisualCamelEntity { - constructor(public route: T) {} + constructor(public entityDef: T) {} abstract id: string; abstract type: EntityType; + abstract getRootPath(): string; abstract setId(id: string): void; abstract toJSON(): unknown; protected abstract getRootUri(): string | undefined; @@ -35,8 +36,8 @@ export abstract class AbstractCamelVisualEntity implements Bas getNodeLabel(path?: string, labelType?: NodeLabelType): string { if (!path) return ''; + const componentModel = getValue(this.entityDef, path); - const componentModel = getValue(this.route, path); const label = CamelComponentSchemaService.getNodeLabel( CamelComponentSchemaService.getCamelComponentLookup(path, componentModel), componentModel, @@ -48,7 +49,7 @@ export abstract class AbstractCamelVisualEntity implements Bas getTooltipContent(path?: string): string { if (!path) return ''; - const componentModel = getValue(this.route, path); + const componentModel = getValue(this.entityDef, path); const content = CamelComponentSchemaService.getTooltipContent( CamelComponentSchemaService.getCamelComponentLookup(path, componentModel), @@ -60,7 +61,7 @@ export abstract class AbstractCamelVisualEntity implements Bas getComponentSchema(path?: string): VisualComponentSchema | undefined { if (!path) return undefined; - const componentModel = getValue(this.route, path); + const componentModel = getValue(this.entityDef, path); const visualComponentSchema = CamelComponentSchemaService.getVisualComponentSchema(path, componentModel); /** Overriding parameters with an empty object When the parameters property is mistakenly set to null */ @@ -79,21 +80,21 @@ export abstract class AbstractCamelVisualEntity implements Bas if (!path) return; const updatedValue = CamelComponentSchemaService.getMultiValueSerializedDefinition(path, value); - setValue(this.route, path, updatedValue); + setValue(this.entityDef, path, updatedValue); } /** * Add a step to the route * * path examples: - * from - * from.steps.0.setHeader - * from.steps.1.choice.when.0 - * from.steps.1.choice.when.0.steps.0.setHeader - * from.steps.1.choice.otherwise - * from.steps.1.choice.otherwise.steps.0.setHeader - * from.steps.2.doTry.doCatch.0 - * from.steps.2.doTry.doCatch.0.steps.0.setHeader + * route.from + * route.from.steps.0.setHeader + * route.from.steps.1.choice.when.0 + * route.from.steps.1.choice.when.0.steps.0.setHeader + * route.from.steps.1.choice.otherwise + * route.from.steps.1.choice.otherwise.steps.0.setHeader + * route.from.steps.2.doTry.doCatch.0 + * route.from.steps.2.doTry.doCatch.0.steps.0.setHeader */ addStep(options: { definedComponent: DefinedComponent; @@ -120,7 +121,7 @@ export abstract class AbstractCamelVisualEntity implements Bas * If the last segment is a string and the penultimate is a number, it means the target is member of an array * therefore we need to look for the array and insert the element at the given index + 1 * - * f.i. from.steps.0.setHeader + * f.i. route.from.steps.0.setHeader * penultimate: 0 * last: setHeader */ @@ -131,7 +132,7 @@ export abstract class AbstractCamelVisualEntity implements Bas /** If we're in Replace mode, we need to delete the existing step */ const deleteCount = options.mode === AddStepMode.ReplaceStep ? 1 : 0; - const stepsArray: ProcessorDefinition[] = getValue(this.route, pathArray.slice(0, -2), []); + const stepsArray: ProcessorDefinition[] = getValue(this.entityDef, pathArray.slice(0, -2), []); stepsArray.splice(desiredStartIndex, deleteCount, defaultValue); return; @@ -148,10 +149,10 @@ export abstract class AbstractCamelVisualEntity implements Bas * If the last segment is a number, it means the target object is a member of an array * therefore we need to look for the array and remove the element at the given index * - * f.i. from.steps.1.choice.when.0 + * f.i. route.from.steps.1.choice.when.0 * last: 0 */ - let array = getValue(this.route, pathArray.slice(0, -1), []); + let array = getValue(this.entityDef, pathArray.slice(0, -1), []); if (Number.isInteger(Number(last)) && Array.isArray(array)) { array.splice(Number(last), 1); @@ -162,11 +163,11 @@ export abstract class AbstractCamelVisualEntity implements Bas * If the last segment is a word and the penultimate is a number, it means the target is an object * potentially a Processor, that belongs to an array, therefore we remove it entirely * - * f.i. from.steps.1.choice + * f.i. route.from.steps.1.choice * last: choice - * penultimate: 1 + * penultimate: 1` */ - array = getValue(this.route, pathArray.slice(0, -2), []); + array = getValue(this.entityDef, pathArray.slice(0, -2), []); if (!Number.isInteger(Number(last)) && Number.isInteger(Number(penultimate)) && Array.isArray(array)) { array.splice(Number(penultimate), 1); @@ -177,11 +178,11 @@ export abstract class AbstractCamelVisualEntity implements Bas * If both the last and penultimate segment are words, it means the target is a property of an object * therefore we delete it * - * f.i. from.steps.1.choice.otherwise + * f.i. route.from.steps.1.choice.otherwise * last: otherwise * penultimate: choice */ - const object = getValue(this.route, pathArray.slice(0, -1), {}); + const object = getValue(this.entityDef, pathArray.slice(0, -1), {}); if (!Number.isInteger(Number(last)) && !Number.isInteger(Number(penultimate)) && typeof object === 'object') { delete object[last]; } @@ -195,7 +196,7 @@ export abstract class AbstractCamelVisualEntity implements Bas const canHaveSpecialChildren = Object.keys(stepsProperties).length > 1; const canReplaceStep = CamelComponentSchemaService.canReplaceStep(processorName); const canRemoveStep = !CamelComponentSchemaService.DISABLED_REMOVE_STEPS.includes(processorName); - const canRemoveFlow = data.path === ROOT_PATH; + const canRemoveFlow = data.path === this.getRootPath(); const canBeDisabled = CamelComponentSchemaService.canBeDisabled(processorName); return { @@ -218,8 +219,8 @@ export abstract class AbstractCamelVisualEntity implements Bas } toVizNode(): IVisualizationNode { - const routeGroupNode = createVisualizationNode('route', { - path: ROOT_PATH, + const routeGroupNode = createVisualizationNode(this.getRootPath(), { + path: this.getRootPath(), entity: this, isGroup: true, icon: NodeIconResolver.getIcon(this.type, NodeIconType.VisualEntity), @@ -227,12 +228,12 @@ export abstract class AbstractCamelVisualEntity implements Bas }); const fromNode = NodeMapperService.getVizNode( - 'from', + `${this.getRootPath()}.from`, { processorName: 'from' as keyof ProcessorDefinition, componentName: CamelComponentSchemaService.getComponentNameFromUri(this.getRootUri()!), }, - this.route, + this.entityDef, ); if (!this.getRootUri()) { @@ -270,9 +271,9 @@ export abstract class AbstractCamelVisualEntity implements Bas if (property === undefined) return; if (property.type === 'single-clause') { - setValue(this.route, `${options.data.path}.${property.name}`, defaultValue); + setValue(this.entityDef, `${options.data.path}.${property.name}`, defaultValue); } else { - const arrayPath = getArrayProperty(this.route, `${options.data.path}.${property.name}`); + const arrayPath = getArrayProperty(this.entityDef, `${options.data.path}.${property.name}`); arrayPath.unshift(defaultValue); } } diff --git a/packages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.ts b/packages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.ts index 86a7f1c1a..e3dc3bf05 100644 --- a/packages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.ts +++ b/packages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.ts @@ -16,6 +16,7 @@ import { NodeMapperService } from './nodes/node-mapper.service'; export class CamelErrorHandlerVisualEntity implements BaseVisualCamelEntity { id: string; readonly type = EntityType.ErrorHandler; + static readonly ROOT_PATH = 'errorHandler'; constructor(public errorHandlerDef: { errorHandler: ErrorHandlerDeserializer } = { errorHandler: {} }) { const id = getCamelRandomId('errorHandler'); @@ -34,6 +35,10 @@ export class CamelErrorHandlerVisualEntity implements BaseVisualCamelEntity { ); } + getRootPath(): string { + return CamelErrorHandlerVisualEntity.ROOT_PATH; + } + getId(): string { return this.id; } @@ -125,7 +130,7 @@ export class CamelErrorHandlerVisualEntity implements BaseVisualCamelEntity { toVizNode(): IVisualizationNode { const errorHandlerGroupNode = NodeMapperService.getVizNode( - 'errorHandler', + this.getRootPath(), { processorName: 'errorHandler' as keyof ProcessorDefinition }, this.errorHandlerDef, ); diff --git a/packages/ui/src/models/visualization/flows/camel-intercept-from-visual-entity.ts b/packages/ui/src/models/visualization/flows/camel-intercept-from-visual-entity.ts index 79e538504..fa0f5104c 100644 --- a/packages/ui/src/models/visualization/flows/camel-intercept-from-visual-entity.ts +++ b/packages/ui/src/models/visualization/flows/camel-intercept-from-visual-entity.ts @@ -56,6 +56,10 @@ export class CamelInterceptFromVisualEntity ); } + getRootPath(): string { + return CamelInterceptFromVisualEntity.ROOT_PATH; + } + getId(): string { return this.id; } diff --git a/packages/ui/src/models/visualization/flows/camel-intercept-send-to-endpoint-visual-entity.ts b/packages/ui/src/models/visualization/flows/camel-intercept-send-to-endpoint-visual-entity.ts index 50749e6f7..314a6bdc0 100644 --- a/packages/ui/src/models/visualization/flows/camel-intercept-send-to-endpoint-visual-entity.ts +++ b/packages/ui/src/models/visualization/flows/camel-intercept-send-to-endpoint-visual-entity.ts @@ -68,6 +68,10 @@ export class CamelInterceptSendToEndpointVisualEntity ); } + getRootPath(): string { + return CamelInterceptSendToEndpointVisualEntity.ROOT_PATH; + } + getId(): string { return this.id; } diff --git a/packages/ui/src/models/visualization/flows/camel-intercept-visual-entity.ts b/packages/ui/src/models/visualization/flows/camel-intercept-visual-entity.ts index b55b228ba..6816c540a 100644 --- a/packages/ui/src/models/visualization/flows/camel-intercept-visual-entity.ts +++ b/packages/ui/src/models/visualization/flows/camel-intercept-visual-entity.ts @@ -39,6 +39,10 @@ export class CamelInterceptVisualEntity return objectKeys.length === 1 && this.ROOT_PATH in interceptDef! && typeof interceptDef.intercept === 'object'; } + getRootPath(): string { + return CamelInterceptVisualEntity.ROOT_PATH; + } + getId(): string { return this.id; } diff --git a/packages/ui/src/models/visualization/flows/camel-on-completion-visual-entity.ts b/packages/ui/src/models/visualization/flows/camel-on-completion-visual-entity.ts index da490c664..0668f1c83 100644 --- a/packages/ui/src/models/visualization/flows/camel-on-completion-visual-entity.ts +++ b/packages/ui/src/models/visualization/flows/camel-on-completion-visual-entity.ts @@ -41,6 +41,10 @@ export class CamelOnCompletionVisualEntity ); } + getRootPath(): string { + return CamelOnCompletionVisualEntity.ROOT_PATH; + } + getId(): string { return this.id; } diff --git a/packages/ui/src/models/visualization/flows/camel-on-exception-visual-entity.ts b/packages/ui/src/models/visualization/flows/camel-on-exception-visual-entity.ts index b3a6ac452..72489fdb6 100644 --- a/packages/ui/src/models/visualization/flows/camel-on-exception-visual-entity.ts +++ b/packages/ui/src/models/visualization/flows/camel-on-exception-visual-entity.ts @@ -41,6 +41,10 @@ export class CamelOnExceptionVisualEntity ); } + getRootPath(): string { + return CamelOnExceptionVisualEntity.ROOT_PATH; + } + getId(): string { return this.id; } diff --git a/packages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.ts b/packages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.ts index c722a409f..c484791d8 100644 --- a/packages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.ts +++ b/packages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.ts @@ -19,6 +19,7 @@ import { NodeMapperService } from './nodes/node-mapper.service'; export class CamelRestConfigurationVisualEntity implements BaseVisualCamelEntity { id: string; readonly type = EntityType.RestConfiguration; + static readonly ROOT_PATH = 'restConfiguration'; private schemaValidator: ValidateFunction | undefined; constructor(public restConfigurationDef: { restConfiguration: RestConfiguration } = { restConfiguration: {} }) { @@ -39,11 +40,15 @@ export class CamelRestConfigurationVisualEntity implements BaseVisualCamelEntity return ( objectKeys.length === 1 && - 'restConfiguration' in restConfigurationDef! && + this.ROOT_PATH in restConfigurationDef! && typeof restConfigurationDef.restConfiguration === 'object' ); } + getRootPath(): string { + return CamelRestConfigurationVisualEntity.ROOT_PATH; + } + getId(): string { return this.id; } @@ -119,7 +124,7 @@ export class CamelRestConfigurationVisualEntity implements BaseVisualCamelEntity toVizNode(): IVisualizationNode { const restConfigurationGroupNode = NodeMapperService.getVizNode( - 'restConfiguration', + this.getRootPath(), { processorName: 'restConfiguration' as keyof ProcessorDefinition }, this.restConfigurationDef, ); diff --git a/packages/ui/src/models/visualization/flows/camel-route-configuration-visual-entity.ts b/packages/ui/src/models/visualization/flows/camel-route-configuration-visual-entity.ts index 9400f7633..bc5603d12 100644 --- a/packages/ui/src/models/visualization/flows/camel-route-configuration-visual-entity.ts +++ b/packages/ui/src/models/visualization/flows/camel-route-configuration-visual-entity.ts @@ -41,8 +41,7 @@ export class CamelRouteConfigurationVisualEntity public routeConfigurationDef: { routeConfiguration: RouteConfigurationDefinition } = { routeConfiguration: {} }, ) { super(routeConfigurationDef); - const id = - routeConfigurationDef.routeConfiguration.id ?? getCamelRandomId(CamelRouteConfigurationVisualEntity.ROOT_PATH); + const id = routeConfigurationDef.routeConfiguration.id ?? getCamelRandomId(this.getRootPath()); this.id = id; this.routeConfigurationDef.routeConfiguration.id = id; } @@ -67,6 +66,10 @@ export class CamelRouteConfigurationVisualEntity ); } + getRootPath(): string { + return CamelRouteConfigurationVisualEntity.ROOT_PATH; + } + getId(): string { return this.id; } @@ -76,7 +79,7 @@ export class CamelRouteConfigurationVisualEntity } getTooltipContent(path?: string): string { - if (path === CamelRouteConfigurationVisualEntity.ROOT_PATH) { + if (path === this.getRootPath()) { return 'routeConfiguration'; } @@ -84,7 +87,7 @@ export class CamelRouteConfigurationVisualEntity } getComponentSchema(path?: string | undefined): VisualComponentSchema | undefined { - if (path === CamelRouteConfigurationVisualEntity.ROOT_PATH) { + if (path === this.getRootPath()) { const schema = CamelCatalogService.getComponent(CatalogKind.Entity, 'routeConfiguration'); return { schema: schema?.propertiesSchema || {}, @@ -110,7 +113,7 @@ export class CamelRouteConfigurationVisualEntity } getNodeInteraction(data: IVisualizationNodeData): NodeInteraction { - if (data.path === CamelRouteConfigurationVisualEntity.ROOT_PATH) { + if (data.path === this.getRootPath()) { return { canHavePreviousStep: false, canHaveNextStep: false, @@ -141,34 +144,32 @@ export class CamelRouteConfigurationVisualEntity toVizNode(): IVisualizationNode { const routeConfigurationGroupNode = createVisualizationNode(this.id, { - path: CamelRouteConfigurationVisualEntity.ROOT_PATH, + path: this.getRootPath(), entity: this, isGroup: true, icon: NodeIconResolver.getIcon(this.type, NodeIconType.VisualEntity), - processorName: CamelRouteConfigurationVisualEntity.ROOT_PATH, + processorName: this.getRootPath(), }); routeConfigurationGroupNode.setTitle('Route Configuration'); - CamelComponentSchemaService.getProcessorStepsProperties( - CamelRouteConfigurationVisualEntity.ROOT_PATH as keyof ProcessorDefinition, - ).forEach((stepsProperty) => { - const childEntities = getValue(this.routeConfigurationDef.routeConfiguration, stepsProperty.name, []); - if (!Array.isArray(childEntities)) return; - - childEntities.forEach((childEntity, index) => { - const childNode = NodeMapperService.getVizNode( - `${CamelRouteConfigurationVisualEntity.ROOT_PATH}.${stepsProperty.name}.${index}.${ - Object.keys(childEntity)[0] - }`, - { - processorName: stepsProperty.name as keyof ProcessorDefinition, - }, - this.routeConfigurationDef, - ); - - routeConfigurationGroupNode.addChild(childNode); - }); - }); + CamelComponentSchemaService.getProcessorStepsProperties(this.getRootPath() as keyof ProcessorDefinition).forEach( + (stepsProperty) => { + const childEntities = getValue(this.routeConfigurationDef.routeConfiguration, stepsProperty.name, []); + if (!Array.isArray(childEntities)) return; + + childEntities.forEach((childEntity, index) => { + const childNode = NodeMapperService.getVizNode( + `${this.getRootPath()}.${stepsProperty.name}.${index}.${Object.keys(childEntity)[0]}`, + { + processorName: stepsProperty.name as keyof ProcessorDefinition, + }, + this.routeConfigurationDef, + ); + + routeConfigurationGroupNode.addChild(childNode); + }); + }, + ); return routeConfigurationGroupNode; } diff --git a/packages/ui/src/models/visualization/flows/camel-route-visual-entity.test.ts b/packages/ui/src/models/visualization/flows/camel-route-visual-entity.test.ts index 5248bcea4..e95901fe8 100644 --- a/packages/ui/src/models/visualization/flows/camel-route-visual-entity.test.ts +++ b/packages/ui/src/models/visualization/flows/camel-route-visual-entity.test.ts @@ -90,7 +90,7 @@ describe('Camel Route', () => { const getNodeLabelSpy = jest.spyOn(CamelComponentSchemaService, 'getNodeLabel'); jest.spyOn(CamelComponentSchemaService, 'getCamelComponentLookup').mockReturnValueOnce(lookupValue); - const label = camelEntity.getNodeLabel('from', NodeLabelType.Id); + const label = camelEntity.getNodeLabel('route.from', NodeLabelType.Id); expect(getNodeLabelSpy).toHaveBeenCalledWith(lookupValue, camelRouteJson.route.from, NodeLabelType.Id); expect(label).toEqual('timer'); @@ -118,9 +118,9 @@ describe('Camel Route', () => { definition: {}, }); - camelEntity.getComponentSchema('from.uri'); + camelEntity.getComponentSchema('route.from.uri'); - expect(spy).toHaveBeenCalledWith('from.uri', 'timer'); + expect(spy).toHaveBeenCalledWith('route.from.uri', 'timer'); }); }); @@ -142,57 +142,57 @@ describe('Camel Route', () => { it('should update the model', () => { const uri = 'amqp:queue:my-queue'; - camelEntity.updateModel('from.uri', uri); + camelEntity.updateModel('route.from.uri', uri); - expect(camelEntity.route.from?.uri).toEqual(uri); + expect(camelEntity.entityDef.route.from?.uri).toEqual(uri); }); }); describe('removeStep', () => { it('should not remove any step if no path is provided', () => { - const originalObject = cloneDeep(camelRouteJson.route); + const originalObject = cloneDeep(camelRouteJson); camelEntity.removeStep(undefined); - expect(originalObject).toEqual(camelEntity.route); + expect(originalObject).toEqual(camelEntity.entityDef); }); - it('should set the `from.uri` property to an empty string if the path is `from`', () => { - camelEntity.removeStep('from'); + it('should set the `route.from.uri` property to an empty string if the path is `from`', () => { + camelEntity.removeStep('route.from'); - expect(camelEntity.route.from?.uri).toEqual(''); + expect(camelEntity.entityDef.route.from?.uri).toEqual(''); }); it('should remove the step if the path is a number', () => { /** Remove `set-header` step */ - camelEntity.removeStep('from.steps.0'); + camelEntity.removeStep('route.from.steps.0'); - expect(camelEntity.route.from?.steps).toHaveLength(2); - expect(camelEntity.route.from?.steps[0].choice).toBeDefined(); + expect(camelEntity.entityDef.route.from?.steps).toHaveLength(2); + expect(camelEntity.entityDef.route.from?.steps[0].choice).toBeDefined(); }); it('should remove the step if the path is a word and the penultimate segment is a number', () => { /** Remove `choice` step */ - camelEntity.removeStep('from.steps.1.choice'); + camelEntity.removeStep('route.from.steps.1.choice'); - expect(camelEntity.route.from?.steps).toHaveLength(2); - expect(camelEntity.route.from?.steps[1].to).toBeDefined(); + expect(camelEntity.entityDef.route.from?.steps).toHaveLength(2); + expect(camelEntity.entityDef.route.from?.steps[1].to).toBeDefined(); }); it('should remove the step if the path is a word and the penultimate segment is a word', () => { /** Remove `to` step */ - camelEntity.removeStep('from.steps.1.choice.otherwise'); + camelEntity.removeStep('route.from.steps.1.choice.otherwise'); - expect(camelEntity.route.from?.steps).toHaveLength(3); - expect(camelEntity.route.from?.steps[1].choice?.otherwise).toBeUndefined(); + expect(camelEntity.entityDef.route.from?.steps).toHaveLength(3); + expect(camelEntity.entityDef.route.from?.steps[1].choice?.otherwise).toBeUndefined(); }); it('should remove a nested step', () => { /** Remove second `to: amqp` step form the choice.otherwise step */ - camelEntity.removeStep('from.steps.1.choice.otherwise.steps.1.to'); + camelEntity.removeStep('route.from.steps.1.choice.otherwise.steps.1.to'); - expect(camelEntity.route.from?.steps).toHaveLength(3); - expect(camelEntity.route.from?.steps[1].choice?.otherwise?.steps).toHaveLength(2); + expect(camelEntity.entityDef.route.from?.steps).toHaveLength(3); + expect(camelEntity.entityDef.route.from?.steps[1].choice?.otherwise?.steps).toHaveLength(2); }); }); @@ -201,15 +201,15 @@ describe('Camel Route', () => { const vizNode = camelEntity.toVizNode(); expect(vizNode).toBeDefined(); - expect(vizNode.data.path).toEqual(ROOT_PATH); + expect(vizNode.data.path).toEqual(CamelRouteVisualEntity.ROOT_PATH); }); - it('should return the group first child and set the initial path to `from`', () => { + it('should return the group first child and set the initial path to `route.from`', () => { const vizNode = camelEntity.toVizNode(); const fromNode = vizNode.getChildren()?.[0]; expect(fromNode).toBeDefined(); - expect(fromNode?.data.path).toEqual('from'); + expect(fromNode?.data.path).toEqual('route.from'); }); it('should use the route ID as the group label', () => { @@ -219,14 +219,14 @@ describe('Camel Route', () => { }); it('should use the route description as the group label if available', () => { - camelEntity.route.description = 'This is a route description'; + camelEntity.entityDef.route.description = 'This is a route description'; const vizNode = camelEntity.toVizNode(); expect(vizNode.getNodeLabel()).toEqual('This is a route description'); }); it('should use the default group label if the id is not available', () => { - camelEntity.route.id = undefined; + camelEntity.entityDef.route.id = undefined; const vizNode = camelEntity.toVizNode(); expect(vizNode.getNodeLabel()).toEqual('route'); @@ -264,7 +264,7 @@ describe('Camel Route', () => { */ /** group node */ - expect(vizNode.data.path).toEqual('#'); + expect(vizNode.data.path).toEqual(CamelRouteVisualEntity.ROOT_PATH); expect(vizNode.data.isGroup).toBeTruthy(); expect(vizNode.getNodeLabel()).toEqual('route-1234'); /** Since this is the root node, there's no previous step */ @@ -273,11 +273,11 @@ describe('Camel Route', () => { /** from nod eand choice group */ expect(vizNode.getChildren()).toHaveLength(2); - expect(vizNode.getChildren()?.[0].data.path).toEqual('from'); - expect(vizNode.getChildren()?.[1].data.path).toEqual('from.steps.0.choice'); + expect(vizNode.getChildren()?.[0].data.path).toEqual('route.from'); + expect(vizNode.getChildren()?.[1].data.path).toEqual('route.from.steps.0.choice'); /** from */ - expect(fromNode.data.path).toEqual('from'); + expect(fromNode.data.path).toEqual('route.from'); expect(fromNode.getNodeLabel()).toEqual('timer'); /** Since this is the first child node, there's no previous step */ expect(fromNode.getPreviousNode()).toBeUndefined(); @@ -286,7 +286,7 @@ describe('Camel Route', () => { /** choice */ const choiceNode = vizNode.getChildren()?.[1] as IVisualizationNode; - expect(choiceNode.data.path).toEqual('from.steps.0.choice'); + expect(choiceNode.data.path).toEqual('route.from.steps.0.choice'); expect(choiceNode.getNodeLabel()).toEqual('choice'); expect(choiceNode.getPreviousNode()).toBe(fromNode); expect(choiceNode.getNextNode()).toBeUndefined(); @@ -295,7 +295,7 @@ describe('Camel Route', () => { /** choice.when */ const whenNode = choiceNode.getChildren()?.[0]; expect(whenNode).toBeDefined(); - expect(whenNode!.data.path).toEqual('from.steps.0.choice.when.0'); + expect(whenNode!.data.path).toEqual('route.from.steps.0.choice.when.0'); expect(whenNode!.getNodeLabel()).toEqual('when'); }); @@ -317,7 +317,7 @@ describe('Camel Route', () => { */ /** group node */ - expect(vizNode.data.path).toEqual('#'); + expect(vizNode.data.path).toEqual(CamelRouteVisualEntity.ROOT_PATH); expect(vizNode.data.isGroup).toBeTruthy(); expect(vizNode.getNodeLabel()).toEqual('route-8888'); /** Since this is the root node, there's no previous step */ @@ -326,7 +326,7 @@ describe('Camel Route', () => { expect(vizNode.getChildren()).toHaveLength(4); /** from */ - expect(fromNode.data.path).toEqual('from'); + expect(fromNode.data.path).toEqual('route.from'); expect(fromNode.getNodeLabel()).toEqual('timer'); /** Since this is the first child node, there's no previous step */ expect(fromNode.getPreviousNode()).toBeUndefined(); @@ -335,7 +335,7 @@ describe('Camel Route', () => { /** setHeader */ const setHeaderNode = vizNode.getChildren()?.[1] as IVisualizationNode; - expect(setHeaderNode.data.path).toEqual('from.steps.0.set-header'); + expect(setHeaderNode.data.path).toEqual('route.from.steps.0.set-header'); expect(setHeaderNode.getNodeLabel()).toEqual('set-header'); expect(setHeaderNode.getPreviousNode()).toBe(fromNode); expect(setHeaderNode.getNextNode()).toBeDefined(); @@ -343,7 +343,7 @@ describe('Camel Route', () => { /** choice */ const choiceNode = setHeaderNode.getNextNode()!; - expect(choiceNode.data.path).toEqual('from.steps.1.choice'); + expect(choiceNode.data.path).toEqual('route.from.steps.1.choice'); expect(choiceNode.getNodeLabel()).toEqual('choice'); expect(choiceNode.getPreviousNode()).toBe(setHeaderNode); expect(choiceNode.getNextNode()).toBeDefined(); @@ -351,7 +351,7 @@ describe('Camel Route', () => { /** toDirect */ const toDirectNode = choiceNode.getNextNode()!; - expect(toDirectNode.data.path).toEqual('from.steps.2.to'); + expect(toDirectNode.data.path).toEqual('route.from.steps.2.to'); expect(toDirectNode.getNodeLabel()).toEqual('direct'); expect(toDirectNode.getPreviousNode()).toBe(choiceNode); expect(toDirectNode.getNextNode()).toBeUndefined(); @@ -359,7 +359,7 @@ describe('Camel Route', () => { /** choice.when */ const whenNode = choiceNode.getChildren()?.[0]; expect(whenNode).toBeDefined(); - expect(whenNode!.data.path).toEqual('from.steps.1.choice.when.0'); + expect(whenNode!.data.path).toEqual('route.from.steps.1.choice.when.0'); expect(whenNode!.getNodeLabel()).toEqual('when'); /** There's no next step since this spawn a new node's tree */ expect(whenNode!.getPreviousNode()).toBeUndefined(); @@ -370,7 +370,7 @@ describe('Camel Route', () => { /** choice.when.log */ const logWhenNode = whenNode?.getChildren()?.[0]; expect(logWhenNode).toBeDefined(); - expect(logWhenNode!.data.path).toEqual('from.steps.1.choice.when.0.steps.0.log'); + expect(logWhenNode!.data.path).toEqual('route.from.steps.1.choice.when.0.steps.0.log'); expect(logWhenNode!.getNodeLabel()).toEqual('log'); expect(logWhenNode!.getPreviousNode()).toBeUndefined(); expect(logWhenNode!.getNextNode()).toBeUndefined(); @@ -380,7 +380,7 @@ describe('Camel Route', () => { /** choice.otherwise */ const otherwiseNode = choiceNode.getChildren()?.[1]; expect(otherwiseNode).toBeDefined(); - expect(otherwiseNode!.data.path).toEqual('from.steps.1.choice.otherwise'); + expect(otherwiseNode!.data.path).toEqual('route.from.steps.1.choice.otherwise'); expect(otherwiseNode!.getNodeLabel()).toEqual('otherwise'); expect(otherwiseNode!.getPreviousNode()).toBeUndefined(); expect(otherwiseNode!.getNextNode()).toBeUndefined(); @@ -390,7 +390,7 @@ describe('Camel Route', () => { /** choice.otherwise.to 1st */ const firstToOtherwiseNode = otherwiseNode?.getChildren()?.[0]; expect(firstToOtherwiseNode).toBeDefined(); - expect(firstToOtherwiseNode!.data.path).toEqual('from.steps.1.choice.otherwise.steps.0.to'); + expect(firstToOtherwiseNode!.data.path).toEqual('route.from.steps.1.choice.otherwise.steps.0.to'); expect(firstToOtherwiseNode!.getNodeLabel()).toEqual('amqp'); expect(firstToOtherwiseNode!.getPreviousNode()).toBeUndefined(); expect(firstToOtherwiseNode!.getNextNode()).toBeDefined(); @@ -400,7 +400,7 @@ describe('Camel Route', () => { /** choice.otherwise.to 2nd*/ const secondToOtherwiseNode = otherwiseNode?.getChildren()?.[1]; expect(secondToOtherwiseNode).toBeDefined(); - expect(secondToOtherwiseNode!.data.path).toEqual('from.steps.1.choice.otherwise.steps.1.to'); + expect(secondToOtherwiseNode!.data.path).toEqual('route.from.steps.1.choice.otherwise.steps.1.to'); expect(secondToOtherwiseNode!.getNodeLabel()).toEqual('amqp'); expect(secondToOtherwiseNode!.getPreviousNode()).toBe(firstToOtherwiseNode); expect(secondToOtherwiseNode!.getNextNode()).toBeDefined(); @@ -410,7 +410,7 @@ describe('Camel Route', () => { /** choice.otherwise.log */ const logOtherwiseNode = otherwiseNode?.getChildren()?.[2]; expect(logOtherwiseNode).toBeDefined(); - expect(logOtherwiseNode!.data.path).toEqual('from.steps.1.choice.otherwise.steps.2.log'); + expect(logOtherwiseNode!.data.path).toEqual('route.from.steps.1.choice.otherwise.steps.2.log'); expect(logOtherwiseNode!.getNodeLabel()).toEqual('log'); expect(logOtherwiseNode!.getPreviousNode()).toBe(secondToOtherwiseNode); expect(logOtherwiseNode!.getNextNode()).toBeUndefined(); diff --git a/packages/ui/src/models/visualization/flows/camel-route-visual-entity.ts b/packages/ui/src/models/visualization/flows/camel-route-visual-entity.ts index c89ff5124..70ac76fe7 100644 --- a/packages/ui/src/models/visualization/flows/camel-route-visual-entity.ts +++ b/packages/ui/src/models/visualization/flows/camel-route-visual-entity.ts @@ -45,43 +45,46 @@ const getDefaultRouteDefinition = (fromDefinition?: { from: FromDefinition }): { }, }); -export class CamelRouteVisualEntity extends AbstractCamelVisualEntity { +export class CamelRouteVisualEntity extends AbstractCamelVisualEntity<{ route: RouteDefinition }> { id: string; - route: RouteDefinition; readonly type = EntityType.Route; + static readonly ROOT_PATH = 'route'; constructor(routeRaw: { route: RouteDefinition } | { from: FromDefinition } | undefined) { - let route: RouteDefinition; + let routeDef: { route: RouteDefinition }; let routeRawId: string | undefined; if (isCamelFrom(routeRaw)) { - route = getDefaultRouteDefinition(routeRaw).route; + routeDef = getDefaultRouteDefinition(routeRaw); routeRawId = routeRaw.from.id; } else if (isCamelRoute(routeRaw)) { - route = routeRaw.route; + routeDef = routeRaw; routeRawId = routeRaw.route?.id; } else { - route = getDefaultRouteDefinition().route; + routeDef = getDefaultRouteDefinition(); } - super(route); - this.route = route; + super(routeDef); const id = routeRawId ?? getCamelRandomId('route'); this.id = id; - this.route.id = this.id; + this.entityDef.route.id = this.id; } static isApplicable(routeDef: unknown): routeDef is { route: RouteDefinition } | { from: FromDefinition } { return isCamelRoute(routeDef) || isCamelFrom(routeDef); } + getRootPath(): string { + return CamelRouteVisualEntity.ROOT_PATH; + } + /** Internal API methods */ setId(routeId: string): void { this.id = routeId; - this.route.id = this.id; + this.entityDef.route.id = this.id; } toJSON(): { route: RouteDefinition } { - return { route: this.route }; + return { route: this.entityDef.route }; } addStep(options: { @@ -91,9 +94,13 @@ export class CamelRouteVisualEntity extends AbstractCamelVisualEntity { expect(kameletVisualEntity.kamelet.metadata.name).toEqual('new-id'); }); + it('should return the node label when querying the ROOT_PATH', () => { + const kamelet = new KameletVisualEntity(kameletDef); + expect(kamelet.getNodeLabel(KameletVisualEntity.ROOT_PATH)).toEqual('My Kamelet'); + }); + + it('should return the node label when querying a different path', () => { + const kamelet = new KameletVisualEntity(kameletDef); + expect(kamelet.getNodeLabel('template.from')).toEqual('timer'); + }); + describe('getComponentSchema when querying the ROOT_PATH', () => { let entityCatalogMap: Record; beforeEach(async () => { @@ -98,7 +107,7 @@ describe('KameletVisualEntity', () => { it('should return the kamelet root schema when querying the ROOT_PATH', () => { const kamelet = new KameletVisualEntity(kameletDef); - expect(kamelet.getComponentSchema(ROOT_PATH)?.schema).toEqual( + expect(kamelet.getComponentSchema(KameletVisualEntity.ROOT_PATH)?.schema).toEqual( entityCatalogMap.KameletConfiguration.propertiesSchema, ); }); diff --git a/packages/ui/src/models/visualization/flows/kamelet-visual-entity.ts b/packages/ui/src/models/visualization/flows/kamelet-visual-entity.ts index 900acbcff..5f186e6c7 100644 --- a/packages/ui/src/models/visualization/flows/kamelet-visual-entity.ts +++ b/packages/ui/src/models/visualization/flows/kamelet-visual-entity.ts @@ -1,12 +1,6 @@ -import { RouteDefinition } from '@kaoto/camel-catalog/types'; +import { FromDefinition } from '@kaoto/camel-catalog/types'; import { getCamelRandomId } from '../../../camel-utils/camel-random-id'; -import { - ROOT_PATH, - getCustomSchemaFromKamelet, - isDefined, - setValue, - updateKameletFromCustomSchema, -} from '../../../utils'; +import { getCustomSchemaFromKamelet, isDefined, setValue, updateKameletFromCustomSchema } from '../../../utils'; import { DefinedComponent } from '../../camel-catalog-index'; import { EntityType } from '../../camel/entities'; import { CatalogKind } from '../../catalog-kind'; @@ -16,18 +10,24 @@ import { AddStepMode, IVisualizationNode, IVisualizationNodeData, VisualComponen import { AbstractCamelVisualEntity } from './abstract-camel-visual-entity'; import { CamelCatalogService } from './camel-catalog.service'; import { CamelComponentDefaultService } from './support/camel-component-default.service'; +import { NodeLabelType } from '../../settings'; -export class KameletVisualEntity extends AbstractCamelVisualEntity { +export class KameletVisualEntity extends AbstractCamelVisualEntity<{ id: string; template: { from: FromDefinition } }> { id: string; readonly type = EntityType.Kamelet; + static readonly ROOT_PATH = 'template'; constructor(public kamelet: IKameletDefinition) { - super({ id: kamelet.metadata?.name, from: kamelet?.spec.template.from }); + super({ id: kamelet.metadata?.name, template: { from: kamelet?.spec.template.from } }); this.id = (kamelet?.metadata?.name as string) ?? getCamelRandomId('kamelet'); this.kamelet.metadata = kamelet?.metadata ?? { name: this.id }; this.kamelet.metadata.name = kamelet?.metadata.name ?? this.id; } + getRootPath(): string { + return KameletVisualEntity.ROOT_PATH; + } + /** Internal API methods */ setId(routeId: string): void { this.id = routeId; @@ -38,12 +38,20 @@ export class KameletVisualEntity extends AbstractCamelVisualEntity): void { - if (path === ROOT_PATH) { + if (path === this.getRootPath()) { updateKameletFromCustomSchema(this.kamelet, value); this.id = this.kamelet.metadata.name; - this.route.id = this.kamelet.metadata.name; + this.entityDef.id = this.kamelet.metadata.name; return; } super.updateModel(path, value); - if (isDefined(this.route.id)) this.id = this.route.id; + if (isDefined(this.entityDef.id)) this.id = this.entityDef.id; } addStep(options: { @@ -72,9 +80,13 @@ export class KameletVisualEntity extends AbstractCamelVisualEntity): void { if (!path) return; - if (path === ROOT_PATH) { + if (path === this.getRootPath()) { updatePipeFromCustomSchema(this.pipe, value); this.id = this.pipe.metadata!.name as string; return; @@ -187,14 +191,14 @@ export class PipeVisualEntity implements BaseVisualCamelEntity { getNodeInteraction(data: IVisualizationNodeData): NodeInteraction { return { /** Pipe cannot have a Kamelet before the source property */ - canHavePreviousStep: data.path !== ROOT_PATH && data.path !== 'source', + canHavePreviousStep: data.path !== this.getRootPath() && data.path !== 'source', /** Pipe cannot have a Kamelet after the sink property */ - canHaveNextStep: data.path !== ROOT_PATH && data.path !== 'sink', + canHaveNextStep: data.path !== this.getRootPath() && data.path !== 'sink', canHaveChildren: false, canHaveSpecialChildren: false, - canReplaceStep: data.path !== ROOT_PATH, - canRemoveStep: data.path !== ROOT_PATH, - canRemoveFlow: data.path === ROOT_PATH, + canReplaceStep: data.path !== this.getRootPath(), + canRemoveStep: data.path !== this.getRootPath(), + canRemoveFlow: data.path === this.getRootPath(), canBeDisabled: false, }; } @@ -208,7 +212,7 @@ export class PipeVisualEntity implements BaseVisualCamelEntity { toVizNode(): IVisualizationNode { const pipeGroupNode = createVisualizationNode(this.id, { - path: ROOT_PATH, + path: this.getRootPath(), entity: this, isGroup: true, icon: NodeIconResolver.getIcon(this.type, NodeIconType.VisualEntity), diff --git a/packages/ui/src/tests/__snapshots__/nodes-edges.test.ts.snap b/packages/ui/src/tests/__snapshots__/nodes-edges.test.ts.snap index 678b82b84..2fb521901 100644 --- a/packages/ui/src/tests/__snapshots__/nodes-edges.test.ts.snap +++ b/packages/ui/src/tests/__snapshots__/nodes-edges.test.ts.snap @@ -20,7 +20,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -63,7 +63,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -77,7 +77,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -114,7 +114,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -128,7 +128,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -142,7 +142,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -161,7 +161,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -244,7 +244,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -287,7 +287,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -359,7 +359,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -425,7 +425,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -439,7 +439,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -476,7 +476,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -490,7 +490,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -504,7 +504,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -523,7 +523,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -553,7 +553,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -599,7 +599,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -613,7 +613,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -650,7 +650,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -664,7 +664,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -678,7 +678,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -752,7 +752,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -790,7 +790,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -813,7 +813,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -859,7 +859,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -873,7 +873,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -887,7 +887,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -906,7 +906,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -940,7 +940,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -1014,7 +1014,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -1056,7 +1056,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -1082,7 +1082,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -1154,7 +1154,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -1180,7 +1180,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -1215,7 +1215,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -1287,7 +1287,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -1348,7 +1348,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -1362,7 +1362,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -1408,7 +1408,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -1422,7 +1422,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -1436,7 +1436,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -1455,7 +1455,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -1489,7 +1489,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -1563,7 +1563,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -1605,7 +1605,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -1631,7 +1631,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -1703,7 +1703,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -1729,7 +1729,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -1764,7 +1764,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -1836,7 +1836,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -1881,7 +1881,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -1904,7 +1904,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -1949,7 +1949,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -1963,7 +1963,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -1978,7 +1978,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -1997,7 +1997,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -2031,7 +2031,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -2105,7 +2105,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -2147,7 +2147,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -2173,7 +2173,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -2245,7 +2245,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -2271,7 +2271,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -2306,7 +2306,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -2378,7 +2378,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -2439,7 +2439,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -2453,7 +2453,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -2498,7 +2498,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -2512,7 +2512,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -2527,7 +2527,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -2546,7 +2546,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -2580,7 +2580,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -2654,7 +2654,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -2696,7 +2696,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -2722,7 +2722,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -2794,7 +2794,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -2820,7 +2820,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -2855,7 +2855,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -2927,7 +2927,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -3000,7 +3000,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -3014,7 +3014,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -3051,7 +3051,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -3065,7 +3065,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -3079,7 +3079,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -3098,7 +3098,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -3132,7 +3132,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -3206,7 +3206,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -3248,7 +3248,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -3274,7 +3274,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -3346,7 +3346,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -3372,7 +3372,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -3407,7 +3407,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -3479,7 +3479,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -3521,7 +3521,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -3555,7 +3555,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -3598,7 +3598,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -3612,7 +3612,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -3649,7 +3649,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -3663,7 +3663,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -3677,7 +3677,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -3731,7 +3731,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -3745,7 +3745,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -3782,7 +3782,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -3796,7 +3796,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -3810,7 +3810,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -3833,7 +3833,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -3908,7 +3908,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -3957,7 +3957,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -3971,7 +3971,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -4008,7 +4008,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -4022,7 +4022,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -4036,7 +4036,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -4070,7 +4070,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -4144,7 +4144,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -4170,7 +4170,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -4253,7 +4253,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234", @@ -4313,7 +4313,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -4356,7 +4356,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -4370,7 +4370,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -4407,7 +4407,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -4421,7 +4421,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -4435,7 +4435,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -4454,7 +4454,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -4513,7 +4513,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -4527,7 +4527,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -4564,7 +4564,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -4578,7 +4578,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -4592,7 +4592,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -4611,7 +4611,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -4639,7 +4639,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -4666,7 +4666,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": "sql", "icon": "", - "path": "from.steps.1.to", + "path": "route.from.steps.1.to", "processorName": "to", }, "id": "sql-1234", @@ -4712,7 +4712,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.when.0.steps.0.setHeader", + "path": "route.from.steps.0.choice.when.0.steps.0.setHeader", "processorName": "setHeader", }, "id": "setHeader-1234", @@ -4726,7 +4726,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.when.0", + "path": "route.from.steps.0.choice.when.0", "processorName": "when", }, "id": "when-1234", @@ -4763,7 +4763,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "componentName": undefined, "icon": "", - "path": "from.steps.0.choice.otherwise.steps.0.log", + "path": "route.from.steps.0.choice.otherwise.steps.0.log", "processorName": "log", }, "id": "log-1234", @@ -4777,7 +4777,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice.otherwise", + "path": "route.from.steps.0.choice.otherwise", "processorName": "otherwise", }, "id": "otherwise-1234", @@ -4791,7 +4791,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "data": { "icon": "", "isGroup": true, - "path": "from.steps.0.choice", + "path": "route.from.steps.0.choice", "processorName": "choice", }, "id": "choice-1234", @@ -4814,7 +4814,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` "componentName": "timer", "icon": "", "isGroup": false, - "path": "from", + "path": "route.from", "processorName": "from", }, "id": "timer-1234", @@ -4890,7 +4890,7 @@ exports[`Nodes and Edges should generate edges for steps with branches 1`] = ` }, "icon": "", "isGroup": true, - "path": "#", + "path": "route", "processorName": "route", }, "id": "route-1234",