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 2023/10/31 14:58:04 UTC

(camel-karavan) 02/03: Fix issue with Exception properties

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 5996049e5b9b5a6d61ea1a1e7cf05d614879bf81
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Tue Oct 31 10:32:54 2023 -0400

    Fix issue with Exception properties
---
 karavan-designer/public/example/demo.camel.yaml    | 81 ++--------------------
 karavan-designer/src/App.tsx                       |  4 +-
 karavan-designer/src/designer/KaravanDesigner.tsx  |  1 -
 .../designer/route/property/DslPropertyField.tsx   | 17 +++--
 4 files changed, 17 insertions(+), 86 deletions(-)

diff --git a/karavan-designer/public/example/demo.camel.yaml b/karavan-designer/public/example/demo.camel.yaml
index 82e33ec2..b7f803a7 100644
--- a/karavan-designer/public/example/demo.camel.yaml
+++ b/karavan-designer/public/example/demo.camel.yaml
@@ -1,77 +1,4 @@
-- route:
-    id: route-612d
-    from:
-      uri: kamelet:aws-s3-cdc-source
-      id: from-e37e
-- route:
-    id: route-605c
-    from:
-      uri: activemq
-      id: from-3131
-      parameters:
-        destinationName: test
-      steps:
-        - marshal:
-            id: marshal-1452
-        - log:
-            message: ${body}
-            id: log-c8e7
-- route:
-    id: route-e4bb
-    from:
-      uri: kamelet:timer-source
-      id: from-dd68
-      parameters:
-        message: '1111'
-      steps:
-        - to:
-            uri: activemq
-            id: to-4fca
-            parameters:
-              destinationName: test
-- route:
-    id: route-0a30
-    from:
-      uri: amqp
-      id: from-ca7d
-      parameters:
-        destinationName: hello
-      steps:
-        - log:
-            message: ${body}
-            id: log-d0f4
-        - to:
-            uri: kamelet:kafka-not-secured-sink
-            id: to-c86f
-            parameters:
-              topic: topic1
-              bootstrapServers: localhost:9092
-- route:
-    id: route-e39c
-    from:
-      uri: kamelet:kafka-not-secured-source
-      id: from-d419
-      parameters:
-        bootstrapServers: localhost:9092
-        topic: topic1
-      steps:
-        - to:
-            uri: direct
-            id: to-7401
-            parameters:
-              name: hello
-- route:
-    id: route-be79
-    from:
-      uri: kamelet:kafka-not-secured-source
-      id: from-27e8
-      parameters:
-        bootstrapServers: localhost:9092
-        topic: topic2
-- route:
-    id: hello
-    from:
-      uri: direct
-      id: from-db43
-      parameters:
-        name: hello
+- routeConfiguration:
+    onException:
+      - onException:
+          id: onException-78ab
diff --git a/karavan-designer/src/App.tsx b/karavan-designer/src/App.tsx
index af23ed39..649fd775 100644
--- a/karavan-designer/src/App.tsx
+++ b/karavan-designer/src/App.tsx
@@ -81,8 +81,8 @@ class App extends React.Component<Props, State> {
             fetch("components/components.json"),
             fetch("snippets/org.apache.camel.AggregationStrategy"),
             fetch("snippets/org.apache.camel.Processor"),
-            // fetch("example/demo.camel.yaml")
-            fetch("example/aws-cloudwatch-sink.kamelet.yaml")
+            fetch("example/demo.camel.yaml")
+            // fetch("example/aws-cloudwatch-sink.kamelet.yaml")
             // fetch("example/aws-s3-cdc-source.kamelet.yaml")
             // fetch("components/supported-components.json"),
         ]).then(responses =>
diff --git a/karavan-designer/src/designer/KaravanDesigner.tsx b/karavan-designer/src/designer/KaravanDesigner.tsx
index b1af73c5..eb967d0e 100644
--- a/karavan-designer/src/designer/KaravanDesigner.tsx
+++ b/karavan-designer/src/designer/KaravanDesigner.tsx
@@ -96,7 +96,6 @@ export function KaravanDesigner(props: Props) {
             EventBus.sendAlert("Error parsing YAML", (e as Error).message, 'danger')
             return Integration.createNew(filename, 'plain');
         }
-
     }
 
     function save(integration: Integration, propertyOnly: boolean): void {
diff --git a/karavan-designer/src/designer/route/property/DslPropertyField.tsx b/karavan-designer/src/designer/route/property/DslPropertyField.tsx
index 9ab39ce7..f42235dc 100644
--- a/karavan-designer/src/designer/route/property/DslPropertyField.tsx
+++ b/karavan-designer/src/designer/route/property/DslPropertyField.tsx
@@ -120,8 +120,9 @@ export function DslPropertyField(props: Props) {
 
     function arrayChanged(fieldId: string, value: string) {
         setArrayValues(prevState => {
-            prevState.set(fieldId, value);
-            return prevState;
+            const map: Map<string,string> = new Map<string, string>(prevState);
+            map.set(fieldId, value);
+            return map;
         })
     }
 
@@ -598,13 +599,16 @@ export function DslPropertyField(props: Props) {
     }
 
     function getMultiValueField(property: PropertyMeta, value: any) {
+        console.log(property)
         return (
             <div>
                 <TextInputGroup className="input-group">
                     <TextInputGroupMain value={arrayValues.get(property.name)}
-                                        onChange={(e, v) => arrayChanged(property.name, v)} onKeyUp={e => {
-                        if (e.key === 'Enter') arraySave(property.name)
-                    }}>
+                                        onChange={(e, v) => arrayChanged(property.name, v)}
+                                        onKeyUp={e => {
+                                            if (e.key === 'Enter') arraySave(property.name)
+                                        }}
+                    >
                         <ChipGroup>
                             {value && Array.from(value).map((v: any, index: number) => (
                                 <Chip key={"chip-" + index} className="chip"
@@ -654,6 +658,7 @@ export function DslPropertyField(props: Props) {
             </div>
         )
     }
+
     function getExpandableComponentParameters(properties: ComponentProperty[], label: string) {
         const element = props.element;
 
@@ -665,7 +670,7 @@ export function DslPropertyField(props: Props) {
                         if (isExpanded && !isShowAdvanced.includes(label)) {
                             prevState = [...prevState, label]
                         } else {
-                            prevState = prevState.filter(s => s!== label);
+                            prevState = prevState.filter(s => s !== label);
                         }
                         return prevState;
                     })