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/12/09 14:29:07 UTC
(camel-karavan) branch main updated: Fixe for UI
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 b4fb84e8 Fixe for UI
b4fb84e8 is described below
commit b4fb84e8c8e96360027d439d38fe5c66964bf9b2
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Sat Dec 9 09:29:00 2023 -0500
Fixe for UI
---
karavan-designer/public/example/demo.camel.yaml | 257 +++++++++++----------
karavan-designer/src/App.tsx | 2 +-
.../route/property/ComponentParameterField.tsx | 5 +-
.../src/designer/route/useRouteDesignerHook.tsx | 20 +-
4 files changed, 155 insertions(+), 129 deletions(-)
diff --git a/karavan-designer/public/example/demo.camel.yaml b/karavan-designer/public/example/demo.camel.yaml
index 1bc2b8ae..224de986 100644
--- a/karavan-designer/public/example/demo.camel.yaml
+++ b/karavan-designer/public/example/demo.camel.yaml
@@ -4,128 +4,135 @@
from:
uri: timer
id: from-cfa5
- steps:
- - choice:
- when:
- - expression:
- simple:
- id: simple-99bf
- id: when-ab5e
- steps:
- - to:
- uri: arangodb
- id: to-f70a
- - removeProperties:
- id: removeProperties-344a
- - expression:
- simple:
- id: simple-d199
- id: when-37cd
- steps:
- - to:
- uri: amqp
- id: to-fbfe
- - choice:
- when:
- - expression:
- simple:
- id: simple-e78b
- id: when-b7d0
- otherwise:
- id: otherwise-40d0
- id: choice-8f6b
- otherwise:
- id: otherwise-382c
- steps:
- - log:
- message: ${body}
- id: log-6831
- id: choice-c1db
- - saga:
- id: saga-8f2c
- steps:
- - to:
- uri: kamelet:azure-cosmosdb-sink
- id: to-1394
-- route:
- nodePrefixId: route-171
- id: route-99f9
- from:
- uri: kamelet:azure-storage-blob-source
- id: from-f8e9
- steps:
- - multicast:
- id: multicast-6a53
- steps:
- - log:
- message: ${body}
- id: log-799d
- - log:
- message: ${body}
- id: log-fc8e
- - log:
- message: ${body}
- id: log-1e42
- - filter:
- expression:
- simple:
- id: simple-7ff9
- id: filter-8c99
- steps:
- - process:
- id: process-e1c1
- description: Call cutom java bean
- - delay:
- expression:
- simple:
- id: simple-64a6
- id: delay-b1ec
- - doTry:
- id: doTry-46cd
- doCatch:
- - id: doCatch-c6e7
- steps:
- - log:
- message: ${body}
- id: log-77df
- - choice:
- when:
- - expression:
- simple:
- id: simple-c7db
- id: when-f058
- otherwise:
- id: otherwise-1e11
- id: choice-8374
- - wireTap:
- id: wireTap-a25e
- doFinally:
- id: doFinally-0a65
- steps:
- - log:
- message: ${body}
- id: log-f4fa
- - log:
- message: ${body}
- id: log-cd30
- steps:
- - pollEnrich:
- expression:
- simple:
- id: simple-6181
- id: pollEnrich-a41b
- - filter:
- expression:
- simple:
- id: simple-a69b
- id: filter-07cf
- steps:
- - setBody:
- expression:
- simple:
- id: simple-f0dc
- id: setBody-3c0c
- - process:
- id: process-6d06
- - circuitBreaker:
- id: circuitBreaker-4af8
+# steps:
+# - marshal:
+# id: marshal-b68c
+# - filter:
+# expression:
+# simple:
+# id: simple-1465
+# id: filter-b351
+# - choice:
+# when:
+# - expression:
+# simple:
+# id: simple-99bf
+# id: when-ab5e
+# steps:
+# - to:
+# uri: arangodb
+# id: to-f70a
+# - removeProperties:
+# id: removeProperties-344a
+# - expression:
+# simple:
+# id: simple-d199
+# id: when-37cd
+# steps:
+# - to:
+# uri: amqp
+# id: to-fbfe
+# - choice:
+# when:
+# - expression:
+# simple:
+# id: simple-e78b
+# id: when-b7d0
+# otherwise:
+# id: otherwise-40d0
+# id: choice-8f6b
+# otherwise:
+# id: otherwise-382c
+# steps:
+# - log:
+# message: ${body}
+# id: log-6831
+# id: choice-c1db
+# - saga:
+# id: saga-8f2c
+# steps:
+# - to:
+# uri: kamelet:azure-cosmosdb-sink
+# id: to-1394
+#- route:
+# nodePrefixId: route-171
+# id: route-99f9
+# from:
+# uri: kamelet:azure-storage-blob-source
+# id: from-f8e9
+# steps:
+# - multicast:
+# id: multicast-6a53
+# steps:
+# - log:
+# message: ${body}
+# id: log-799d
+# - log:
+# message: ${body}
+# id: log-fc8e
+# - log:
+# message: ${body}
+# id: log-1e42
+# - filter:
+# expression:
+# simple:
+# id: simple-7ff9
+# id: filter-8c99
+# steps:
+# - process:
+# id: process-e1c1
+# description: Call cutom java bean
+# - delay:
+# expression:
+# simple:
+# id: simple-64a6
+# id: delay-b1ec
+# - doTry:
+# id: doTry-46cd
+# doCatch:
+# - id: doCatch-c6e7
+# steps:
+# - log:
+# message: ${body}
+# id: log-77df
+# - choice:
+# when:
+# - expression:
+# simple:
+# id: simple-c7db
+# id: when-f058
+# otherwise:
+# id: otherwise-1e11
+# id: choice-8374
+# - wireTap:
+# id: wireTap-a25e
+# doFinally:
+# id: doFinally-0a65
+# steps:
+# - log:
+# message: ${body}
+# id: log-f4fa
+# - log:
+# message: ${body}
+# id: log-cd30
+# steps:
+# - pollEnrich:
+# expression:
+# simple:
+# id: simple-6181
+# id: pollEnrich-a41b
+# - filter:
+# expression:
+# simple:
+# id: simple-a69b
+# id: filter-07cf
+# steps:
+# - setBody:
+# expression:
+# simple:
+# id: simple-f0dc
+# id: setBody-3c0c
+# - process:
+# id: process-6d06
+# - circuitBreaker:
+# id: circuitBreaker-4af8
diff --git a/karavan-designer/src/App.tsx b/karavan-designer/src/App.tsx
index eadcdfbb..a6613131 100644
--- a/karavan-designer/src/App.tsx
+++ b/karavan-designer/src/App.tsx
@@ -116,7 +116,7 @@ class App extends React.Component<Props, State> {
}
save(filename: string, yaml: string, propertyOnly: boolean) {
- // console.log(yaml);
+ console.log(yaml);
}
getSpinner() {
diff --git a/karavan-designer/src/designer/route/property/ComponentParameterField.tsx b/karavan-designer/src/designer/route/property/ComponentParameterField.tsx
index f80c3e75..49eb2f6a 100644
--- a/karavan-designer/src/designer/route/property/ComponentParameterField.tsx
+++ b/karavan-designer/src/designer/route/property/ComponentParameterField.tsx
@@ -297,13 +297,14 @@ export function ComponentParameterField(props: Props) {
}
function getSwitch(property: ComponentProperty, value: any) {
+ const isChecked = value !== undefined ? Boolean(value) : (property.defaultValue !== undefined && ['true', true].includes(property.defaultValue))
return (
<Switch
id={id} name={id}
value={value?.toString()}
aria-label={id}
- isChecked={value !== undefined ? Boolean(value) : property.defaultValue !== undefined && property.defaultValue === 'true'}
- onChange={e => parametersChanged(property.name, !Boolean(value))}/>
+ isChecked={isChecked}
+ onChange={(e, checked) => parametersChanged(property.name, checked)}/>
)
}
diff --git a/karavan-designer/src/designer/route/useRouteDesignerHook.tsx b/karavan-designer/src/designer/route/useRouteDesignerHook.tsx
index 1457adba..51b97e20 100644
--- a/karavan-designer/src/designer/route/useRouteDesignerHook.tsx
+++ b/karavan-designer/src/designer/route/useRouteDesignerHook.tsx
@@ -18,7 +18,14 @@ import React from 'react';
import '../karavan.css';
import {DslMetaModel} from "../utils/DslMetaModel";
import {CamelUtil} from "karavan-core/lib/api/CamelUtil";
-import {ChoiceDefinition, FromDefinition, LogDefinition, RouteConfigurationDefinition, RouteDefinition} from "karavan-core/lib/model/CamelDefinition";
+import {
+ ChoiceDefinition,
+ FromDefinition, JsonDataFormat,
+ LogDefinition,
+ MarshalDefinition,
+ RouteConfigurationDefinition,
+ RouteDefinition, UnmarshalDefinition
+} from "karavan-core/lib/model/CamelDefinition";
import {CamelElement, MetadataLabels} from "karavan-core/lib/model/IntegrationDefinition";
import {CamelDefinitionApiExt} from "karavan-core/lib/api/CamelDefinitionApiExt";
import {CamelDefinitionApi} from "karavan-core/lib/api/CamelDefinitionApi";
@@ -247,6 +254,7 @@ export function useRouteDesignerHook () {
default:
const step = CamelDefinitionApi.createStep(dsl.dsl, undefined);
const augmentedStep = setDslDefaults(step);
+ console.log(step, augmentedStep)
addStep(augmentedStep, parentId, position)
break;
}
@@ -261,6 +269,16 @@ export function useRouteDesignerHook () {
(step as ChoiceDefinition).when?.push(CamelDefinitionApi.createStep('WhenDefinition', undefined));
(step as ChoiceDefinition).otherwise = CamelDefinitionApi.createStep('OtherwiseDefinition', undefined);
}
+ if (step.dslName === 'MarshalDefinition') {
+ if (CamelDefinitionApiExt.getDataFormat(step) === undefined) {
+ (step as MarshalDefinition).json = new JsonDataFormat()
+ }
+ }
+ if (step.dslName === 'UnmarshalDefinition') {
+ if (CamelDefinitionApiExt.getDataFormat(step) === undefined) {
+ (step as UnmarshalDefinition).json = new JsonDataFormat()
+ }
+ }
return step;
}