This is an automated email from the ASF dual-hosted git repository.
marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
The following commit(s) were added to refs/heads/main by this push:
new b1fd32dc Fix #1368
b1fd32dc is described below
commit b1fd32dc852716c7d4696adf94b5d78a4065e4e0
Author: Marat Gubaidullin <[email protected]>
AuthorDate: Tue Aug 20 19:05:07 2024 -0400
Fix #1368
---
.../property/property/ComponentPropertyField.tsx | 10 ++++++----
.../property/property/DslPropertyField.tsx | 2 +-
.../src/designer/property/usePropertiesHook.tsx | 9 ++++++---
.../webui/src/designer/route/DslConnections.tsx | 7 ++++---
.../src/main/webui/src/designer/utils/CamelUi.tsx | 9 +++++----
.../webui/src/topology/TopologyPropertiesPanel.tsx | 4 ++--
karavan-core/src/core/api/ComponentApi.ts | 3 +++
karavan-core/src/core/api/TopologyUtils.ts | 23 +++++++++++++++++++---
.../property/property/ComponentPropertyField.tsx | 10 ++++++----
.../property/property/DslPropertyField.tsx | 2 +-
.../src/designer/property/usePropertiesHook.tsx | 9 ++++++---
.../src/designer/route/DslConnections.tsx | 7 ++++---
karavan-designer/src/designer/utils/CamelUi.tsx | 9 +++++----
.../src/topology/TopologyPropertiesPanel.tsx | 4 ++--
.../property/property/ComponentPropertyField.tsx | 10 ++++++----
.../property/property/DslPropertyField.tsx | 2 +-
.../src/designer/property/usePropertiesHook.tsx | 9 ++++++---
.../src/designer/route/DslConnections.tsx | 7 ++++---
karavan-space/src/designer/utils/CamelUi.tsx | 9 +++++----
.../src/topology/TopologyPropertiesPanel.tsx | 4 ++--
20 files changed, 95 insertions(+), 54 deletions(-)
diff --git
a/karavan-app/src/main/webui/src/designer/property/property/ComponentPropertyField.tsx
b/karavan-app/src/main/webui/src/designer/property/property/ComponentPropertyField.tsx
index 56d83d0f..9832d9a2 100644
---
a/karavan-app/src/main/webui/src/designer/property/property/ComponentPropertyField.tsx
+++
b/karavan-app/src/main/webui/src/designer/property/property/ComponentPropertyField.tsx
@@ -55,6 +55,7 @@ import {KubernetesIcon} from "../../icons/ComponentIcons";
import EditorIcon from "@patternfly/react-icons/dist/js/icons/code-icon";
import {ExpressionModalEditor} from
"../../../expression/ExpressionModalEditor";
import {PropertyPlaceholderDropdown} from "./PropertyPlaceholderDropdown";
+import {INTERNAL_COMPONENTS} from "karavan-core/lib/api/ComponentApi";
const prefix = "parameters";
const beanPrefix = "#bean:";
@@ -142,16 +143,17 @@ export function ComponentPropertyField(props: Props) {
}
function canBeInternalUri(property: ComponentProperty): boolean {
- if (props.element && props.element.dslName === 'ToDefinition' &&
property.name === 'name') {
+ if (props.element && props.element.dslName === 'ToDefinition' &&
(property.name === 'name' || property.name === 'address')) {
const uri: string = (props.element as ToDefinition).uri || '';
- return uri.startsWith("direct") || uri.startsWith("seda");
+ const parts = uri.split(":");
+ return parts.length > 0 && INTERNAL_COMPONENTS.includes(parts[0]);
} else {
return false;
}
}
function checkUri(startsWith: string): boolean {
- if (props.element && props.element.dslName === 'ToDefinition' &&
property.name === 'name') {
+ if (props.element && props.element.dslName === 'ToDefinition' &&
(property.name === 'name' || property.name === 'address')) {
const uri: string = (props.element as ToDefinition).uri || '';
return uri.startsWith(startsWith);
} else {
@@ -163,7 +165,7 @@ export function ComponentPropertyField(props: Props) {
const selectOptions: JSX.Element[] = [];
const componentName = getInternalComponentName(property.name,
props.element);
const internalUris = CamelUi.getInternalRouteUris(integration,
componentName, false);
- let uris: string[] = CamelUi.getInternalUris(files,
checkUri('direct'), checkUri('seda'));
+ let uris: string[] = CamelUi.getInternalUris(files,
checkUri('direct'), checkUri('seda'), checkUri('vertx'));
uris.push(...internalUris);
uris = [...new Set(uris.map(e => e.includes(":") ? e.split(":")?.at(1)
|| "" : e))]
if (value && value.length > 0 && !uris.includes(value)) {
diff --git
a/karavan-app/src/main/webui/src/designer/property/property/DslPropertyField.tsx
b/karavan-app/src/main/webui/src/designer/property/property/DslPropertyField.tsx
index c2bd3a10..7a8d99e3 100644
---
a/karavan-app/src/main/webui/src/designer/property/property/DslPropertyField.tsx
+++
b/karavan-app/src/main/webui/src/designer/property/property/DslPropertyField.tsx
@@ -741,7 +741,7 @@ export function DslPropertyField(props: Props) {
function getInternalUriSelect(property: PropertyMeta, value: any) {
const selectOptions: JSX.Element[] = [];
- const uris: string[] = CamelUi.getInternalUris(files, true, true);
+ const uris: string[] = CamelUi.getInternalUris(files, true, true,
true);
if (uris && uris.length > 0) {
selectOptions.push(...uris.map((value: string) =>
<SelectOption key={value} value={value.trim()}/>));
diff --git
a/karavan-app/src/main/webui/src/designer/property/usePropertiesHook.tsx
b/karavan-app/src/main/webui/src/designer/property/usePropertiesHook.tsx
index 09cc5c2b..2d806c0d 100644
--- a/karavan-app/src/main/webui/src/designer/property/usePropertiesHook.tsx
+++ b/karavan-app/src/main/webui/src/designer/property/usePropertiesHook.tsx
@@ -27,6 +27,7 @@ import {useDesignerStore, useIntegrationStore} from
"../DesignerStore";
import {shallow} from "zustand/shallow";
import {CamelMetadataApi} from "karavan-core/lib/model/CamelMetadata";
import {EventBus} from "../utils/EventBus";
+import {INTERNAL_COMPONENTS} from "karavan-core/lib/api/ComponentApi";
export function usePropertiesHook(designerType: 'routes' | 'rest' | 'beans' =
'routes') {
@@ -142,10 +143,12 @@ export function usePropertiesHook(designerType: 'routes'
| 'rest' | 'beans' = 'r
}
function getInternalComponentName(propertyName: string, element?:
CamelElement): string {
- if (element && element.dslName === 'ToDefinition' && propertyName ===
'name') {
+ if (element && element.dslName === 'ToDefinition' && (propertyName ===
'name' || propertyName === 'address')) {
const uri: string = (element as ToDefinition).uri || '';
- if (uri.startsWith("direct")) return "direct";
- if (uri.startsWith("seda")) return "seda";
+ const parts = uri.split(":");
+ if (parts.length > 0 && INTERNAL_COMPONENTS.includes(parts[0])) {
+ return parts[0];
+ }
return '';
} else {
return '';
diff --git a/karavan-app/src/main/webui/src/designer/route/DslConnections.tsx
b/karavan-app/src/main/webui/src/designer/route/DslConnections.tsx
index 8c96ff4e..f27782e3 100644
--- a/karavan-app/src/main/webui/src/designer/route/DslConnections.tsx
+++ b/karavan-app/src/main/webui/src/designer/route/DslConnections.tsx
@@ -17,7 +17,7 @@
import React, {JSX, useEffect, useState} from 'react';
import '../karavan.css';
import {DslPosition, EventBus} from "../utils/EventBus";
-import {CamelUi, NAV_COMPONENTS} from "../utils/CamelUi";
+import {CamelUi} from "../utils/CamelUi";
import {useConnectionsStore, useDesignerStore, useIntegrationStore} from
"../DesignerStore";
import {shallow} from "zustand/shallow";
import {CamelDefinitionApiExt} from
"karavan-core/lib/api/CamelDefinitionApiExt";
@@ -28,6 +28,7 @@ import {Button, Tooltip} from "@patternfly/react-core";
import {InfrastructureAPI} from "../utils/InfrastructureAPI";
import {getIntegrations} from "../../topology/TopologyApi";
import {ComponentApi} from "karavan-core/lib/api/ComponentApi";
+import {INTERNAL_COMPONENTS} from "karavan-core/lib/api/ComponentApi";
const overlapGap: number = 40;
const DIAMETER: number = 34;
@@ -84,7 +85,7 @@ export function DslConnections() {
function getElementType(element: CamelElement): 'internal' | 'remote' |
'nav' {
const uri = (element as any).uri;
- if (NAV_COMPONENTS.includes((uri))) {
+ if (INTERNAL_COMPONENTS.includes((uri))) {
return 'nav';
} else {
const component = ComponentApi.findByName(uri);
@@ -146,7 +147,7 @@ export function DslConnections() {
if (pos) {
const step = (pos.step as any);
const uri = step?.uri;
- const internalCall: boolean = step && uri && step?.dslName ===
'FromDefinition' && NAV_COMPONENTS.includes(uri);
+ const internalCall: boolean = step && uri && step?.dslName ===
'FromDefinition' && INTERNAL_COMPONENTS.includes(uri);
const name: string = internalCall ? (step?.parameters?.name) :
undefined;
const routes = internalCall ? tons.get(uri + ':' + name) || [] :
[];
const isInternal = data[2] === 'internal';
diff --git a/karavan-app/src/main/webui/src/designer/utils/CamelUi.tsx
b/karavan-app/src/main/webui/src/designer/utils/CamelUi.tsx
index 1958b22a..4f1d010b 100644
--- a/karavan-app/src/main/webui/src/designer/utils/CamelUi.tsx
+++ b/karavan-app/src/main/webui/src/designer/utils/CamelUi.tsx
@@ -170,8 +170,6 @@ export class RouteToCreate {
}
}
-export const NAV_COMPONENTS = ['direct', 'seda', 'vertx']
-
const INTEGRATION_PATTERNS = 'Integration Patterns';
const stepConvertMap = new Map<string, string>([
@@ -342,7 +340,7 @@ export class CamelUi {
.filter((r: RouteDefinition) =>
r.from.uri.startsWith(componentName))
.forEach((r: RouteDefinition) => {
const uri = r.from.uri;
- const name = r.from.parameters.name;
+ const name = componentName === 'vertx' ?
r.from.parameters.address : r.from.parameters.name;
if (showComponentName && name) {
result.push(uri + ":" + name);
} else if (name){
@@ -352,7 +350,7 @@ export class CamelUi {
return result;
}
- static getInternalUris = (files: IntegrationFile[], direct: boolean, seda:
boolean) => {
+ static getInternalUris = (files: IntegrationFile[], direct: boolean, seda:
boolean, vertx: boolean) => {
const urls: string[] = [];
const integrations = getIntegrations(files);
integrations.forEach(i => {
@@ -362,6 +360,9 @@ export class CamelUi {
if (seda) {
urls.push(...CamelUi.getInternalRouteUris(i, "seda"));
}
+ if (vertx) {
+ urls.push(...CamelUi.getInternalRouteUris(i, "vertx"));
+ }
})
return urls;
}
diff --git
a/karavan-app/src/main/webui/src/topology/TopologyPropertiesPanel.tsx
b/karavan-app/src/main/webui/src/topology/TopologyPropertiesPanel.tsx
index 0fd93b3d..55a1953f 100644
--- a/karavan-app/src/main/webui/src/topology/TopologyPropertiesPanel.tsx
+++ b/karavan-app/src/main/webui/src/topology/TopologyPropertiesPanel.tsx
@@ -30,7 +30,7 @@ import {
TooltipPosition
} from "@patternfly/react-core";
import CloseIcon from "@patternfly/react-icons/dist/esm/icons/times-icon";
-import {NAV_COMPONENTS} from "../designer/utils/CamelUi";
+import {INTERNAL_COMPONENTS} from "karavan-core/lib/api/ComponentApi";
interface Props {
onSetFile: (fileName: string) => void
@@ -69,7 +69,7 @@ export function TopologyPropertiesPanel(props: Props) {
if (isRoute()) {
const uri: string = nodeData?.step?.from.uri || '';
const name: string = nodeData?.step?.from.parameters?.name || '';
- if (NAV_COMPONENTS.includes(uri)) {
+ if (INTERNAL_COMPONENTS.includes(uri)) {
return uri.concat(":").concat(name);
} else {
return uri;
diff --git a/karavan-core/src/core/api/ComponentApi.ts
b/karavan-core/src/core/api/ComponentApi.ts
index 3a390c6c..ca3b0d37 100644
--- a/karavan-core/src/core/api/ComponentApi.ts
+++ b/karavan-core/src/core/api/ComponentApi.ts
@@ -21,6 +21,9 @@ const Components: Component[] = [];
const SupportedComponents: SupportedComponent[] = [];
let SupportedOnly: boolean = false;
const BlockedComponents: string[] = [];
+
+export const INTERNAL_COMPONENTS = ['direct', 'seda', 'vertx']
+
export class ComponentApi {
private constructor() {}
diff --git a/karavan-core/src/core/api/TopologyUtils.ts
b/karavan-core/src/core/api/TopologyUtils.ts
index bfe60e22..32c43ba0 100644
--- a/karavan-core/src/core/api/TopologyUtils.ts
+++ b/karavan-core/src/core/api/TopologyUtils.ts
@@ -22,7 +22,7 @@ import {
PatchDefinition,
PostDefinition,
PutDefinition,
- RestDefinition, RouteConfigurationDefinition, SagaDefinition,
+ RestDefinition, RouteConfigurationDefinition, RouteDefinition,
SagaDefinition,
} from '../model/CamelDefinition';
import {
CamelElement,
@@ -34,11 +34,10 @@ import {
TopologyRestNode, TopologyRouteConfigurationNode,
TopologyRouteNode,
} from '../model/TopologyDefinition';
-import { ComponentApi } from './ComponentApi';
+import { ComponentApi, INTERNAL_COMPONENTS } from './ComponentApi';
import { CamelDefinitionApiExt } from './CamelDefinitionApiExt';
import { CamelDisplayUtil } from './CamelDisplayUtil';
import { CamelUtil } from './CamelUtil';
-import { notDeepEqual } from 'node:assert';
const outgoingDefinitions: string[] = ['ToDefinition', 'KameletDefinition',
'ToDynamicDefinition', "PollEnrichDefinition", "EnrichDefinition",
"WireTapDefinition", "SagaDefinition"];
@@ -242,12 +241,30 @@ export class TopologyUtils {
result.push(new TopologyOutgoingNode(id, type,
connectorType, route.id, title, filename, e, uniqueUri));
}
})
+ result.push(...TopologyUtils.findDeadLetterChannelNodes(route,
filename))
})
})
return result;
}
+ static findDeadLetterChannelNodes(route: RouteDefinition, filename:
string):TopologyOutgoingNode[] {
+ const result:TopologyOutgoingNode[] = [];
+ const deadLetterChannel = route.errorHandler?.deadLetterChannel;
+ const deadLetterUri = deadLetterChannel?.deadLetterUri;
+ if (deadLetterChannel !== undefined && deadLetterUri !== undefined) {
+ const parts = deadLetterUri.split(':');
+ if (parts.length > 1 && INTERNAL_COMPONENTS.includes(parts[0])) {
+ const id = 'outgoing-' + route.id + '-' +
deadLetterChannel?.id;
+ const title =
CamelDisplayUtil.getStepDescription(deadLetterChannel);
+ const type = 'internal';
+ const connectorType = 'component';
+ result.push(new TopologyOutgoingNode(id, type, connectorType,
route.id || '', title, filename, deadLetterChannel, deadLetterUri));
+ }
+ }
+ return result;
+ }
+
static findTopologyRouteConfigurationOutgoingNodes = (integrations:
Integration[]): TopologyOutgoingNode[] => {
const result:TopologyOutgoingNode[] = [];
integrations.forEach(i => {
diff --git
a/karavan-designer/src/designer/property/property/ComponentPropertyField.tsx
b/karavan-designer/src/designer/property/property/ComponentPropertyField.tsx
index 56d83d0f..9832d9a2 100644
--- a/karavan-designer/src/designer/property/property/ComponentPropertyField.tsx
+++ b/karavan-designer/src/designer/property/property/ComponentPropertyField.tsx
@@ -55,6 +55,7 @@ import {KubernetesIcon} from "../../icons/ComponentIcons";
import EditorIcon from "@patternfly/react-icons/dist/js/icons/code-icon";
import {ExpressionModalEditor} from
"../../../expression/ExpressionModalEditor";
import {PropertyPlaceholderDropdown} from "./PropertyPlaceholderDropdown";
+import {INTERNAL_COMPONENTS} from "karavan-core/lib/api/ComponentApi";
const prefix = "parameters";
const beanPrefix = "#bean:";
@@ -142,16 +143,17 @@ export function ComponentPropertyField(props: Props) {
}
function canBeInternalUri(property: ComponentProperty): boolean {
- if (props.element && props.element.dslName === 'ToDefinition' &&
property.name === 'name') {
+ if (props.element && props.element.dslName === 'ToDefinition' &&
(property.name === 'name' || property.name === 'address')) {
const uri: string = (props.element as ToDefinition).uri || '';
- return uri.startsWith("direct") || uri.startsWith("seda");
+ const parts = uri.split(":");
+ return parts.length > 0 && INTERNAL_COMPONENTS.includes(parts[0]);
} else {
return false;
}
}
function checkUri(startsWith: string): boolean {
- if (props.element && props.element.dslName === 'ToDefinition' &&
property.name === 'name') {
+ if (props.element && props.element.dslName === 'ToDefinition' &&
(property.name === 'name' || property.name === 'address')) {
const uri: string = (props.element as ToDefinition).uri || '';
return uri.startsWith(startsWith);
} else {
@@ -163,7 +165,7 @@ export function ComponentPropertyField(props: Props) {
const selectOptions: JSX.Element[] = [];
const componentName = getInternalComponentName(property.name,
props.element);
const internalUris = CamelUi.getInternalRouteUris(integration,
componentName, false);
- let uris: string[] = CamelUi.getInternalUris(files,
checkUri('direct'), checkUri('seda'));
+ let uris: string[] = CamelUi.getInternalUris(files,
checkUri('direct'), checkUri('seda'), checkUri('vertx'));
uris.push(...internalUris);
uris = [...new Set(uris.map(e => e.includes(":") ? e.split(":")?.at(1)
|| "" : e))]
if (value && value.length > 0 && !uris.includes(value)) {
diff --git
a/karavan-designer/src/designer/property/property/DslPropertyField.tsx
b/karavan-designer/src/designer/property/property/DslPropertyField.tsx
index c2bd3a10..7a8d99e3 100644
--- a/karavan-designer/src/designer/property/property/DslPropertyField.tsx
+++ b/karavan-designer/src/designer/property/property/DslPropertyField.tsx
@@ -741,7 +741,7 @@ export function DslPropertyField(props: Props) {
function getInternalUriSelect(property: PropertyMeta, value: any) {
const selectOptions: JSX.Element[] = [];
- const uris: string[] = CamelUi.getInternalUris(files, true, true);
+ const uris: string[] = CamelUi.getInternalUris(files, true, true,
true);
if (uris && uris.length > 0) {
selectOptions.push(...uris.map((value: string) =>
<SelectOption key={value} value={value.trim()}/>));
diff --git a/karavan-designer/src/designer/property/usePropertiesHook.tsx
b/karavan-designer/src/designer/property/usePropertiesHook.tsx
index 09cc5c2b..2d806c0d 100644
--- a/karavan-designer/src/designer/property/usePropertiesHook.tsx
+++ b/karavan-designer/src/designer/property/usePropertiesHook.tsx
@@ -27,6 +27,7 @@ import {useDesignerStore, useIntegrationStore} from
"../DesignerStore";
import {shallow} from "zustand/shallow";
import {CamelMetadataApi} from "karavan-core/lib/model/CamelMetadata";
import {EventBus} from "../utils/EventBus";
+import {INTERNAL_COMPONENTS} from "karavan-core/lib/api/ComponentApi";
export function usePropertiesHook(designerType: 'routes' | 'rest' | 'beans' =
'routes') {
@@ -142,10 +143,12 @@ export function usePropertiesHook(designerType: 'routes'
| 'rest' | 'beans' = 'r
}
function getInternalComponentName(propertyName: string, element?:
CamelElement): string {
- if (element && element.dslName === 'ToDefinition' && propertyName ===
'name') {
+ if (element && element.dslName === 'ToDefinition' && (propertyName ===
'name' || propertyName === 'address')) {
const uri: string = (element as ToDefinition).uri || '';
- if (uri.startsWith("direct")) return "direct";
- if (uri.startsWith("seda")) return "seda";
+ const parts = uri.split(":");
+ if (parts.length > 0 && INTERNAL_COMPONENTS.includes(parts[0])) {
+ return parts[0];
+ }
return '';
} else {
return '';
diff --git a/karavan-designer/src/designer/route/DslConnections.tsx
b/karavan-designer/src/designer/route/DslConnections.tsx
index 8c96ff4e..f27782e3 100644
--- a/karavan-designer/src/designer/route/DslConnections.tsx
+++ b/karavan-designer/src/designer/route/DslConnections.tsx
@@ -17,7 +17,7 @@
import React, {JSX, useEffect, useState} from 'react';
import '../karavan.css';
import {DslPosition, EventBus} from "../utils/EventBus";
-import {CamelUi, NAV_COMPONENTS} from "../utils/CamelUi";
+import {CamelUi} from "../utils/CamelUi";
import {useConnectionsStore, useDesignerStore, useIntegrationStore} from
"../DesignerStore";
import {shallow} from "zustand/shallow";
import {CamelDefinitionApiExt} from
"karavan-core/lib/api/CamelDefinitionApiExt";
@@ -28,6 +28,7 @@ import {Button, Tooltip} from "@patternfly/react-core";
import {InfrastructureAPI} from "../utils/InfrastructureAPI";
import {getIntegrations} from "../../topology/TopologyApi";
import {ComponentApi} from "karavan-core/lib/api/ComponentApi";
+import {INTERNAL_COMPONENTS} from "karavan-core/lib/api/ComponentApi";
const overlapGap: number = 40;
const DIAMETER: number = 34;
@@ -84,7 +85,7 @@ export function DslConnections() {
function getElementType(element: CamelElement): 'internal' | 'remote' |
'nav' {
const uri = (element as any).uri;
- if (NAV_COMPONENTS.includes((uri))) {
+ if (INTERNAL_COMPONENTS.includes((uri))) {
return 'nav';
} else {
const component = ComponentApi.findByName(uri);
@@ -146,7 +147,7 @@ export function DslConnections() {
if (pos) {
const step = (pos.step as any);
const uri = step?.uri;
- const internalCall: boolean = step && uri && step?.dslName ===
'FromDefinition' && NAV_COMPONENTS.includes(uri);
+ const internalCall: boolean = step && uri && step?.dslName ===
'FromDefinition' && INTERNAL_COMPONENTS.includes(uri);
const name: string = internalCall ? (step?.parameters?.name) :
undefined;
const routes = internalCall ? tons.get(uri + ':' + name) || [] :
[];
const isInternal = data[2] === 'internal';
diff --git a/karavan-designer/src/designer/utils/CamelUi.tsx
b/karavan-designer/src/designer/utils/CamelUi.tsx
index 1958b22a..4f1d010b 100644
--- a/karavan-designer/src/designer/utils/CamelUi.tsx
+++ b/karavan-designer/src/designer/utils/CamelUi.tsx
@@ -170,8 +170,6 @@ export class RouteToCreate {
}
}
-export const NAV_COMPONENTS = ['direct', 'seda', 'vertx']
-
const INTEGRATION_PATTERNS = 'Integration Patterns';
const stepConvertMap = new Map<string, string>([
@@ -342,7 +340,7 @@ export class CamelUi {
.filter((r: RouteDefinition) =>
r.from.uri.startsWith(componentName))
.forEach((r: RouteDefinition) => {
const uri = r.from.uri;
- const name = r.from.parameters.name;
+ const name = componentName === 'vertx' ?
r.from.parameters.address : r.from.parameters.name;
if (showComponentName && name) {
result.push(uri + ":" + name);
} else if (name){
@@ -352,7 +350,7 @@ export class CamelUi {
return result;
}
- static getInternalUris = (files: IntegrationFile[], direct: boolean, seda:
boolean) => {
+ static getInternalUris = (files: IntegrationFile[], direct: boolean, seda:
boolean, vertx: boolean) => {
const urls: string[] = [];
const integrations = getIntegrations(files);
integrations.forEach(i => {
@@ -362,6 +360,9 @@ export class CamelUi {
if (seda) {
urls.push(...CamelUi.getInternalRouteUris(i, "seda"));
}
+ if (vertx) {
+ urls.push(...CamelUi.getInternalRouteUris(i, "vertx"));
+ }
})
return urls;
}
diff --git a/karavan-designer/src/topology/TopologyPropertiesPanel.tsx
b/karavan-designer/src/topology/TopologyPropertiesPanel.tsx
index 0fd93b3d..55a1953f 100644
--- a/karavan-designer/src/topology/TopologyPropertiesPanel.tsx
+++ b/karavan-designer/src/topology/TopologyPropertiesPanel.tsx
@@ -30,7 +30,7 @@ import {
TooltipPosition
} from "@patternfly/react-core";
import CloseIcon from "@patternfly/react-icons/dist/esm/icons/times-icon";
-import {NAV_COMPONENTS} from "../designer/utils/CamelUi";
+import {INTERNAL_COMPONENTS} from "karavan-core/lib/api/ComponentApi";
interface Props {
onSetFile: (fileName: string) => void
@@ -69,7 +69,7 @@ export function TopologyPropertiesPanel(props: Props) {
if (isRoute()) {
const uri: string = nodeData?.step?.from.uri || '';
const name: string = nodeData?.step?.from.parameters?.name || '';
- if (NAV_COMPONENTS.includes(uri)) {
+ if (INTERNAL_COMPONENTS.includes(uri)) {
return uri.concat(":").concat(name);
} else {
return uri;
diff --git
a/karavan-space/src/designer/property/property/ComponentPropertyField.tsx
b/karavan-space/src/designer/property/property/ComponentPropertyField.tsx
index 56d83d0f..9832d9a2 100644
--- a/karavan-space/src/designer/property/property/ComponentPropertyField.tsx
+++ b/karavan-space/src/designer/property/property/ComponentPropertyField.tsx
@@ -55,6 +55,7 @@ import {KubernetesIcon} from "../../icons/ComponentIcons";
import EditorIcon from "@patternfly/react-icons/dist/js/icons/code-icon";
import {ExpressionModalEditor} from
"../../../expression/ExpressionModalEditor";
import {PropertyPlaceholderDropdown} from "./PropertyPlaceholderDropdown";
+import {INTERNAL_COMPONENTS} from "karavan-core/lib/api/ComponentApi";
const prefix = "parameters";
const beanPrefix = "#bean:";
@@ -142,16 +143,17 @@ export function ComponentPropertyField(props: Props) {
}
function canBeInternalUri(property: ComponentProperty): boolean {
- if (props.element && props.element.dslName === 'ToDefinition' &&
property.name === 'name') {
+ if (props.element && props.element.dslName === 'ToDefinition' &&
(property.name === 'name' || property.name === 'address')) {
const uri: string = (props.element as ToDefinition).uri || '';
- return uri.startsWith("direct") || uri.startsWith("seda");
+ const parts = uri.split(":");
+ return parts.length > 0 && INTERNAL_COMPONENTS.includes(parts[0]);
} else {
return false;
}
}
function checkUri(startsWith: string): boolean {
- if (props.element && props.element.dslName === 'ToDefinition' &&
property.name === 'name') {
+ if (props.element && props.element.dslName === 'ToDefinition' &&
(property.name === 'name' || property.name === 'address')) {
const uri: string = (props.element as ToDefinition).uri || '';
return uri.startsWith(startsWith);
} else {
@@ -163,7 +165,7 @@ export function ComponentPropertyField(props: Props) {
const selectOptions: JSX.Element[] = [];
const componentName = getInternalComponentName(property.name,
props.element);
const internalUris = CamelUi.getInternalRouteUris(integration,
componentName, false);
- let uris: string[] = CamelUi.getInternalUris(files,
checkUri('direct'), checkUri('seda'));
+ let uris: string[] = CamelUi.getInternalUris(files,
checkUri('direct'), checkUri('seda'), checkUri('vertx'));
uris.push(...internalUris);
uris = [...new Set(uris.map(e => e.includes(":") ? e.split(":")?.at(1)
|| "" : e))]
if (value && value.length > 0 && !uris.includes(value)) {
diff --git a/karavan-space/src/designer/property/property/DslPropertyField.tsx
b/karavan-space/src/designer/property/property/DslPropertyField.tsx
index c2bd3a10..7a8d99e3 100644
--- a/karavan-space/src/designer/property/property/DslPropertyField.tsx
+++ b/karavan-space/src/designer/property/property/DslPropertyField.tsx
@@ -741,7 +741,7 @@ export function DslPropertyField(props: Props) {
function getInternalUriSelect(property: PropertyMeta, value: any) {
const selectOptions: JSX.Element[] = [];
- const uris: string[] = CamelUi.getInternalUris(files, true, true);
+ const uris: string[] = CamelUi.getInternalUris(files, true, true,
true);
if (uris && uris.length > 0) {
selectOptions.push(...uris.map((value: string) =>
<SelectOption key={value} value={value.trim()}/>));
diff --git a/karavan-space/src/designer/property/usePropertiesHook.tsx
b/karavan-space/src/designer/property/usePropertiesHook.tsx
index 09cc5c2b..2d806c0d 100644
--- a/karavan-space/src/designer/property/usePropertiesHook.tsx
+++ b/karavan-space/src/designer/property/usePropertiesHook.tsx
@@ -27,6 +27,7 @@ import {useDesignerStore, useIntegrationStore} from
"../DesignerStore";
import {shallow} from "zustand/shallow";
import {CamelMetadataApi} from "karavan-core/lib/model/CamelMetadata";
import {EventBus} from "../utils/EventBus";
+import {INTERNAL_COMPONENTS} from "karavan-core/lib/api/ComponentApi";
export function usePropertiesHook(designerType: 'routes' | 'rest' | 'beans' =
'routes') {
@@ -142,10 +143,12 @@ export function usePropertiesHook(designerType: 'routes'
| 'rest' | 'beans' = 'r
}
function getInternalComponentName(propertyName: string, element?:
CamelElement): string {
- if (element && element.dslName === 'ToDefinition' && propertyName ===
'name') {
+ if (element && element.dslName === 'ToDefinition' && (propertyName ===
'name' || propertyName === 'address')) {
const uri: string = (element as ToDefinition).uri || '';
- if (uri.startsWith("direct")) return "direct";
- if (uri.startsWith("seda")) return "seda";
+ const parts = uri.split(":");
+ if (parts.length > 0 && INTERNAL_COMPONENTS.includes(parts[0])) {
+ return parts[0];
+ }
return '';
} else {
return '';
diff --git a/karavan-space/src/designer/route/DslConnections.tsx
b/karavan-space/src/designer/route/DslConnections.tsx
index 8c96ff4e..f27782e3 100644
--- a/karavan-space/src/designer/route/DslConnections.tsx
+++ b/karavan-space/src/designer/route/DslConnections.tsx
@@ -17,7 +17,7 @@
import React, {JSX, useEffect, useState} from 'react';
import '../karavan.css';
import {DslPosition, EventBus} from "../utils/EventBus";
-import {CamelUi, NAV_COMPONENTS} from "../utils/CamelUi";
+import {CamelUi} from "../utils/CamelUi";
import {useConnectionsStore, useDesignerStore, useIntegrationStore} from
"../DesignerStore";
import {shallow} from "zustand/shallow";
import {CamelDefinitionApiExt} from
"karavan-core/lib/api/CamelDefinitionApiExt";
@@ -28,6 +28,7 @@ import {Button, Tooltip} from "@patternfly/react-core";
import {InfrastructureAPI} from "../utils/InfrastructureAPI";
import {getIntegrations} from "../../topology/TopologyApi";
import {ComponentApi} from "karavan-core/lib/api/ComponentApi";
+import {INTERNAL_COMPONENTS} from "karavan-core/lib/api/ComponentApi";
const overlapGap: number = 40;
const DIAMETER: number = 34;
@@ -84,7 +85,7 @@ export function DslConnections() {
function getElementType(element: CamelElement): 'internal' | 'remote' |
'nav' {
const uri = (element as any).uri;
- if (NAV_COMPONENTS.includes((uri))) {
+ if (INTERNAL_COMPONENTS.includes((uri))) {
return 'nav';
} else {
const component = ComponentApi.findByName(uri);
@@ -146,7 +147,7 @@ export function DslConnections() {
if (pos) {
const step = (pos.step as any);
const uri = step?.uri;
- const internalCall: boolean = step && uri && step?.dslName ===
'FromDefinition' && NAV_COMPONENTS.includes(uri);
+ const internalCall: boolean = step && uri && step?.dslName ===
'FromDefinition' && INTERNAL_COMPONENTS.includes(uri);
const name: string = internalCall ? (step?.parameters?.name) :
undefined;
const routes = internalCall ? tons.get(uri + ':' + name) || [] :
[];
const isInternal = data[2] === 'internal';
diff --git a/karavan-space/src/designer/utils/CamelUi.tsx
b/karavan-space/src/designer/utils/CamelUi.tsx
index 1958b22a..4f1d010b 100644
--- a/karavan-space/src/designer/utils/CamelUi.tsx
+++ b/karavan-space/src/designer/utils/CamelUi.tsx
@@ -170,8 +170,6 @@ export class RouteToCreate {
}
}
-export const NAV_COMPONENTS = ['direct', 'seda', 'vertx']
-
const INTEGRATION_PATTERNS = 'Integration Patterns';
const stepConvertMap = new Map<string, string>([
@@ -342,7 +340,7 @@ export class CamelUi {
.filter((r: RouteDefinition) =>
r.from.uri.startsWith(componentName))
.forEach((r: RouteDefinition) => {
const uri = r.from.uri;
- const name = r.from.parameters.name;
+ const name = componentName === 'vertx' ?
r.from.parameters.address : r.from.parameters.name;
if (showComponentName && name) {
result.push(uri + ":" + name);
} else if (name){
@@ -352,7 +350,7 @@ export class CamelUi {
return result;
}
- static getInternalUris = (files: IntegrationFile[], direct: boolean, seda:
boolean) => {
+ static getInternalUris = (files: IntegrationFile[], direct: boolean, seda:
boolean, vertx: boolean) => {
const urls: string[] = [];
const integrations = getIntegrations(files);
integrations.forEach(i => {
@@ -362,6 +360,9 @@ export class CamelUi {
if (seda) {
urls.push(...CamelUi.getInternalRouteUris(i, "seda"));
}
+ if (vertx) {
+ urls.push(...CamelUi.getInternalRouteUris(i, "vertx"));
+ }
})
return urls;
}
diff --git a/karavan-space/src/topology/TopologyPropertiesPanel.tsx
b/karavan-space/src/topology/TopologyPropertiesPanel.tsx
index 0fd93b3d..55a1953f 100644
--- a/karavan-space/src/topology/TopologyPropertiesPanel.tsx
+++ b/karavan-space/src/topology/TopologyPropertiesPanel.tsx
@@ -30,7 +30,7 @@ import {
TooltipPosition
} from "@patternfly/react-core";
import CloseIcon from "@patternfly/react-icons/dist/esm/icons/times-icon";
-import {NAV_COMPONENTS} from "../designer/utils/CamelUi";
+import {INTERNAL_COMPONENTS} from "karavan-core/lib/api/ComponentApi";
interface Props {
onSetFile: (fileName: string) => void
@@ -69,7 +69,7 @@ export function TopologyPropertiesPanel(props: Props) {
if (isRoute()) {
const uri: string = nodeData?.step?.from.uri || '';
const name: string = nodeData?.step?.from.parameters?.name || '';
- if (NAV_COMPONENTS.includes(uri)) {
+ if (INTERNAL_COMPONENTS.includes(uri)) {
return uri.concat(":").concat(name);
} else {
return uri;