You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2024/07/11 14:58:00 UTC
(camel-karavan) branch main updated (300bfa0c -> 32fd842b)
This is an automated email from the ASF dual-hosted git repository.
marat pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
discard 300bfa0c topology
discard c37d2935 Route Config in Topology
new 32fd842b Route Config in Topology
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (300bfa0c)
\
N -- N -- N refs/heads/main (32fd842b)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
(camel-karavan) 01/01: Route Config in Topology
Posted by ma...@apache.org.
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
commit 32fd842bdbda2f5a17c85123a88923158f1f1383
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Wed Jul 10 12:05:06 2024 -0400
Route Config in Topology
topology
---
.../src/main/webui/src/topology/TopologyApi.tsx | 27 ++++-
.../src/main/webui/src/topology/TopologyStore.ts | 2 +-
karavan-core/src/core/api/TopologyUtils.ts | 13 ++-
karavan-designer/public/example/demo.camel.yaml | 113 ++++++++++++---------
karavan-designer/src/App.tsx | 2 +-
karavan-designer/src/topology/TopologyApi.tsx | 27 ++++-
karavan-space/src/topology/TopologyApi.tsx | 27 ++++-
karavan-space/src/topology/TopologyStore.ts | 2 +-
8 files changed, 148 insertions(+), 65 deletions(-)
diff --git a/karavan-app/src/main/webui/src/topology/TopologyApi.tsx b/karavan-app/src/main/webui/src/topology/TopologyApi.tsx
index 26d5c40c..174ad6a6 100644
--- a/karavan-app/src/main/webui/src/topology/TopologyApi.tsx
+++ b/karavan-app/src/main/webui/src/topology/TopologyApi.tsx
@@ -234,11 +234,13 @@ export function getRestEdges(rest: TopologyRestNode[], tins: TopologyIncomingNod
export function getInternalEdges(tons: TopologyOutgoingNode[], tins: TopologyIncomingNode[]): EdgeModel[] {
const result: EdgeModel[] = [];
tons.filter(ton => ton.type === 'internal').forEach((ton, index) => {
- const uri: string = (ton.step as any).uri;
- if (uri.startsWith("direct") || uri.startsWith("seda")) {
- const name = (ton.step as any).parameters.name;
+ const step = (ton.step as any);
+ if (step?.dslName === 'DeadLetterChannelDefinition') {
+ const parts = step.deadLetterUri?.split(":");
+ const uri: string = parts[0];
+ const name: string = parts[1];
const target = TopologyUtils.getRouteIdByUriAndName(tins, uri, name);
- const node: EdgeModel = {
+ const node: EdgeModel = {
id: 'internal-' + ton.id + '-' + index,
type: 'edge',
source: 'route-' + ton.routeId,
@@ -247,6 +249,21 @@ export function getInternalEdges(tons: TopologyOutgoingNode[], tins: TopologyInc
animationSpeed: EdgeAnimationSpeed.medium
}
if (target) result.push(node);
+ } else {
+ const uri: string = (ton.step as any).uri;
+ if (uri?.startsWith("direct") || uri?.startsWith("seda")) {
+ const name = (ton.step as any).parameters.name;
+ const target = TopologyUtils.getRouteIdByUriAndName(tins, uri, name);
+ const node: EdgeModel = {
+ id: 'internal-' + ton.id + '-' + index,
+ type: 'edge',
+ source: 'route-' + ton.routeId,
+ target: target,
+ edgeStyle: EdgeStyle.solid,
+ animationSpeed: EdgeAnimationSpeed.medium
+ }
+ if (target) result.push(node);
+ }
}
});
return result;
@@ -308,7 +325,7 @@ export function getModel(files: IntegrationFile[], grouping?: boolean): Model {
edges.push(...getRestEdges(trestns, tins));
edges.push(...getInternalEdges(tons, tins));
edges.push(...getInternalEdges(trcons, tins));
- edges.push(...getExternalEdges(tons,tins));
+ // edges.push(...getExternalEdges(tons,tins));
return {nodes: nodes, edges: edges, graph: {id: 'g1', type: 'graph', layout: 'Dagre'}};
}
diff --git a/karavan-app/src/main/webui/src/topology/TopologyStore.ts b/karavan-app/src/main/webui/src/topology/TopologyStore.ts
index 63b7ed4f..0ba80503 100644
--- a/karavan-app/src/main/webui/src/topology/TopologyStore.ts
+++ b/karavan-app/src/main/webui/src/topology/TopologyStore.ts
@@ -56,7 +56,7 @@ export const useTopologyStore = createWithEqualityFn<TopologyState>((set) => ({
return {nodeData: nodeData};
});
},
- showGroups: false,
+ showGroups: true,
setShowGroups: (showGroups: boolean) => {
set((state: TopologyState) => {
return {showGroups: showGroups};
diff --git a/karavan-core/src/core/api/TopologyUtils.ts b/karavan-core/src/core/api/TopologyUtils.ts
index 4d0b22e0..4ec740a9 100644
--- a/karavan-core/src/core/api/TopologyUtils.ts
+++ b/karavan-core/src/core/api/TopologyUtils.ts
@@ -272,9 +272,20 @@ export class TopologyUtils {
const type = TopologyUtils.isElementInternalComponent(e) ? 'internal' : 'external';
const connectorType = TopologyUtils.getConnectorType(e);
const uniqueUri = TopologyUtils.getUniqueUri(e);
- result.push(new TopologyOutgoingNode(id, type, connectorType, rc.id || 'default', title, filename, e, uniqueUri));
+ result.push(new TopologyOutgoingNode(id, type, connectorType, rc.id || 'undefined', title, filename, e, uniqueUri));
})
})
+ if (rc.errorHandler?.deadLetterChannel) {
+ const e = rc.errorHandler?.deadLetterChannel
+ const id = 'outgoing-' + rc.id + '-' + e.id;
+ const title = CamelDisplayUtil.getStepDescription(e);
+ const type = (e?.deadLetterUri?.startsWith('direct:') || e?.deadLetterUri?.startsWith('seda:') )
+ ? 'internal'
+ : 'external';
+ const connectorType = 'component';
+ const uniqueUri = e?.deadLetterUri
+ result.push(new TopologyOutgoingNode(id, type, connectorType, rc.id || 'undefined', title, filename, e, uniqueUri));
+ }
})
})
diff --git a/karavan-designer/public/example/demo.camel.yaml b/karavan-designer/public/example/demo.camel.yaml
index ef7ef78f..c41432b0 100644
--- a/karavan-designer/public/example/demo.camel.yaml
+++ b/karavan-designer/public/example/demo.camel.yaml
@@ -1,55 +1,76 @@
- route:
- id: route-b0b7
- nodePrefixId: route-dfc
+ id: route-654e
+ description: Error Handler
+ nodePrefixId: route-a06
from:
- id: from-70b1
- uri: kamelet:timer-source
+ id: from-6dd1
+ description: DLQ
+ uri: direct
parameters:
- message: Hello
- period: 1
+ name: dlq
steps:
- - to:
- id: to-df39
- uri: amqp
- - to:
- id: to-1600
- uri: kamelet:kafka-sink
- - choice:
- id: choice-41b7
- when:
- - id: when-29c0
- expression:
- simple:
- id: simple-289b
- steps:
- - aggregate:
- id: aggregate-1193
- completionSize: 121212
- completionTimeout: "{{bean:beanName.method}}"
- steps:
- - bean:
- id: bean-a9e0
- - to:
- id: to-df17
- uri: amqp
- otherwise:
- id: otherwise-b00c
- steps:
- - aggregate:
- id: aggregate-46cb
- completionSize: 1
- steps:
- - to:
- id: to-5565
- uri: activemq
+ - log:
+ id: log-bf00
+ message: "ERROR: ${exception}"
- route:
- id: test
+ id: route-c11a
+ description: From
+ nodePrefixId: route-ae1
+ autoStartup: true
from:
- id: from-aeed
- uri: direct
+ id: from-b6f1
+ description: Command received
+ uri: kamelet:kafka-not-secured-source
parameters:
- name: test
+ topic: wh_commands
+ bootstrapServers: kafka:9092
+ autoCommitEnable: true
+ consumerGroup: lightstep
steps:
+ - setVariable:
+ id: setVariable-61a9
+ description: Set command
+ name: command
+ expression:
+ simple:
+ id: simple-965d
+ expression: ${body}
+ - setBody:
+ id: setBody-0515
+ description: Prepare message
+ expression:
+ groovy:
+ id: groovy-bb4f
+ expression: >-
+
+ - log:
+ id: log-7190
+ description: Log message
+ message: "Message: ${body}"
- to:
- id: to-1daf
- uri: kamelet:aws-bedrock-agent-runtime-sink
+ id: to-bb55
+ description: Call
+ uri: netty
+ parameters:
+ protocol: tcp
+- route:
+ id: route-42e3
+ description: Events from box
+ nodePrefixId: route-de0
+ autoStartup: false
+ from:
+ id: from-5b8a
+ description: Event received
+ uri: netty
+ parameters:
+ protocol: tcp
+
+ steps:
+ - log:
+ id: log-63db
+ message: ${body}
+- routeConfiguration:
+ errorHandler:
+ deadLetterChannel:
+ id: deadLetterChannel-3bf9
+ deadLetterUri: direct:dlq
diff --git a/karavan-designer/src/App.tsx b/karavan-designer/src/App.tsx
index bc6d9f7b..b7344e30 100644
--- a/karavan-designer/src/App.tsx
+++ b/karavan-designer/src/App.tsx
@@ -58,7 +58,7 @@ class MenuItem {
export function App() {
- const [pageId, setPageId] = useState<string>('designer');
+ const [pageId, setPageId] = useState<string>('topology');
const [name, setName] = useState<string>('example.yaml');
const [key, setKey] = useState<string>('');
const [yaml, setYaml] = useState<string>('');
diff --git a/karavan-designer/src/topology/TopologyApi.tsx b/karavan-designer/src/topology/TopologyApi.tsx
index fa5ca2d2..b297b186 100644
--- a/karavan-designer/src/topology/TopologyApi.tsx
+++ b/karavan-designer/src/topology/TopologyApi.tsx
@@ -82,13 +82,13 @@ export function getRoutes(tins: TopologyRouteNode[]): NodeModel[] {
width: NODE_DIAMETER,
height: NODE_DIAMETER,
shape: NodeShape.rect,
- status: NodeStatus.default,
data: {
isAlternate: false,
type: 'route',
icon: 'route',
step: tin.route,
routeId: tin.routeId,
+ autoStartup: tin.route.autoStartup !== false,
fileName: tin.fileName,
}
}
@@ -234,11 +234,13 @@ export function getRestEdges(rest: TopologyRestNode[], tins: TopologyIncomingNod
export function getInternalEdges(tons: TopologyOutgoingNode[], tins: TopologyIncomingNode[]): EdgeModel[] {
const result: EdgeModel[] = [];
tons.filter(ton => ton.type === 'internal').forEach((ton, index) => {
- const uri: string = (ton.step as any).uri;
- if (uri.startsWith("direct") || uri.startsWith("seda")) {
- const name = (ton.step as any).parameters.name;
+ const step = (ton.step as any);
+ if (step?.dslName === 'DeadLetterChannelDefinition') {
+ const parts = step.deadLetterUri?.split(":");
+ const uri: string = parts[0];
+ const name: string = parts[1];
const target = TopologyUtils.getRouteIdByUriAndName(tins, uri, name);
- const node: EdgeModel = {
+ const node: EdgeModel = {
id: 'internal-' + ton.id + '-' + index,
type: 'edge',
source: 'route-' + ton.routeId,
@@ -247,6 +249,21 @@ export function getInternalEdges(tons: TopologyOutgoingNode[], tins: TopologyInc
animationSpeed: EdgeAnimationSpeed.medium
}
if (target) result.push(node);
+ } else {
+ const uri: string = (ton.step as any).uri;
+ if (uri?.startsWith("direct") || uri?.startsWith("seda")) {
+ const name = (ton.step as any).parameters.name;
+ const target = TopologyUtils.getRouteIdByUriAndName(tins, uri, name);
+ const node: EdgeModel = {
+ id: 'internal-' + ton.id + '-' + index,
+ type: 'edge',
+ source: 'route-' + ton.routeId,
+ target: target,
+ edgeStyle: EdgeStyle.solid,
+ animationSpeed: EdgeAnimationSpeed.medium
+ }
+ if (target) result.push(node);
+ }
}
});
return result;
diff --git a/karavan-space/src/topology/TopologyApi.tsx b/karavan-space/src/topology/TopologyApi.tsx
index 26d5c40c..174ad6a6 100644
--- a/karavan-space/src/topology/TopologyApi.tsx
+++ b/karavan-space/src/topology/TopologyApi.tsx
@@ -234,11 +234,13 @@ export function getRestEdges(rest: TopologyRestNode[], tins: TopologyIncomingNod
export function getInternalEdges(tons: TopologyOutgoingNode[], tins: TopologyIncomingNode[]): EdgeModel[] {
const result: EdgeModel[] = [];
tons.filter(ton => ton.type === 'internal').forEach((ton, index) => {
- const uri: string = (ton.step as any).uri;
- if (uri.startsWith("direct") || uri.startsWith("seda")) {
- const name = (ton.step as any).parameters.name;
+ const step = (ton.step as any);
+ if (step?.dslName === 'DeadLetterChannelDefinition') {
+ const parts = step.deadLetterUri?.split(":");
+ const uri: string = parts[0];
+ const name: string = parts[1];
const target = TopologyUtils.getRouteIdByUriAndName(tins, uri, name);
- const node: EdgeModel = {
+ const node: EdgeModel = {
id: 'internal-' + ton.id + '-' + index,
type: 'edge',
source: 'route-' + ton.routeId,
@@ -247,6 +249,21 @@ export function getInternalEdges(tons: TopologyOutgoingNode[], tins: TopologyInc
animationSpeed: EdgeAnimationSpeed.medium
}
if (target) result.push(node);
+ } else {
+ const uri: string = (ton.step as any).uri;
+ if (uri?.startsWith("direct") || uri?.startsWith("seda")) {
+ const name = (ton.step as any).parameters.name;
+ const target = TopologyUtils.getRouteIdByUriAndName(tins, uri, name);
+ const node: EdgeModel = {
+ id: 'internal-' + ton.id + '-' + index,
+ type: 'edge',
+ source: 'route-' + ton.routeId,
+ target: target,
+ edgeStyle: EdgeStyle.solid,
+ animationSpeed: EdgeAnimationSpeed.medium
+ }
+ if (target) result.push(node);
+ }
}
});
return result;
@@ -308,7 +325,7 @@ export function getModel(files: IntegrationFile[], grouping?: boolean): Model {
edges.push(...getRestEdges(trestns, tins));
edges.push(...getInternalEdges(tons, tins));
edges.push(...getInternalEdges(trcons, tins));
- edges.push(...getExternalEdges(tons,tins));
+ // edges.push(...getExternalEdges(tons,tins));
return {nodes: nodes, edges: edges, graph: {id: 'g1', type: 'graph', layout: 'Dagre'}};
}
diff --git a/karavan-space/src/topology/TopologyStore.ts b/karavan-space/src/topology/TopologyStore.ts
index 63b7ed4f..0ba80503 100644
--- a/karavan-space/src/topology/TopologyStore.ts
+++ b/karavan-space/src/topology/TopologyStore.ts
@@ -56,7 +56,7 @@ export const useTopologyStore = createWithEqualityFn<TopologyState>((set) => ({
return {nodeData: nodeData};
});
},
- showGroups: false,
+ showGroups: true,
setShowGroups: (showGroups: boolean) => {
set((state: TopologyState) => {
return {showGroups: showGroups};