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 8181fc9  Fix component parameters (#19)
8181fc9 is described below

commit 8181fc95623179431b2e6b21af51b4c4964d5fa0
Author: Marat Gubaidullin <marat.gubaidul...@gmail.com>
AuthorDate: Fri Oct 8 20:35:19 2021 -0400

    Fix component parameters (#19)
---
 karavan-designer/src/designer/api/ComponentApi.tsx             |  1 +
 karavan-designer/src/designer/ui/DslProperties.tsx             | 10 +++++-----
 .../camel/karavan/generator/CamelComponentsGenerator.java      |  3 ++-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/karavan-designer/src/designer/api/ComponentApi.tsx 
b/karavan-designer/src/designer/api/ComponentApi.tsx
index 43e02dc..3f59ffe 100644
--- a/karavan-designer/src/designer/api/ComponentApi.tsx
+++ b/karavan-designer/src/designer/api/ComponentApi.tsx
@@ -111,6 +111,7 @@ export const ComponentApi = {
             if (!advanced) {
                 result.push(...properties.filter(p => p.label.length === 0));
                 result.push(...properties.filter(p => p.label.startsWith(type) 
&& !p.label.includes("advanced")));
+                result.push(...properties.filter(p => p.label === 
"formatting"));
             } else {
                 result.push(...properties.filter(p => p.label.startsWith(type) 
&& p.label.includes("advanced")));
                 result.push(...properties.filter(p => p.label === "advanced"));
diff --git a/karavan-designer/src/designer/ui/DslProperties.tsx 
b/karavan-designer/src/designer/ui/DslProperties.tsx
index 9f9e7e2..499aab2 100644
--- a/karavan-designer/src/designer/ui/DslProperties.tsx
+++ b/karavan-designer/src/designer/ui/DslProperties.tsx
@@ -252,7 +252,7 @@ export class DslProperties extends React.Component<Props, 
State> {
                         </button>
                     </Popover>
                 }>
-                {property.type === 'string' && property.enum === undefined && 
<TextInput
+                {['string', 'duration'].includes(property.type) && 
property.enum === undefined && <TextInput
                     className="text-field" isRequired
                     type={property.secret ? "password" : "text"}
                     id={id} name={id}
@@ -287,14 +287,14 @@ export class DslProperties extends React.Component<Props, 
State> {
                         id={id} name={id}
                         value={typeof value === 'number' ? value : undefined}
                         inputName={id}
-                        onMinus={() => this.parametersChanged(property.name, 
typeof value === 'number' ? value - 1 : -1)}
-                        onPlus={() => this.parametersChanged(property.name, 
typeof value === 'number' ? value + 1 : 1)}
-                        onChange={(e: any) => 
this.parametersChanged(property.name, Number(e.target.value))}/>
+                        onMinus={() => this.parametersChanged(property.name, 
typeof value === 'number' ? value - 1 : -1, property.kind === 'path')}
+                        onPlus={() => this.parametersChanged(property.name, 
typeof value === 'number' ? value + 1 : 1, property.kind === 'path')}
+                        onChange={(e: any) => 
this.parametersChanged(property.name, Number(e.target.value), property.kind === 
'path')}/>
                     <Button
                         className="clear-button"
                         variant="tertiary"
                         isSmall icon={<UndoIcon/>}
-                        onClick={e => this.parametersChanged(property.name, 
undefined)}/>
+                        onClick={e => this.parametersChanged(property.name, 
undefined,property.kind === 'path')}/>
                 </div>
                 }
             </FormGroup>
diff --git 
a/karavan-generator/src/main/java/org/apache/camel/karavan/generator/CamelComponentsGenerator.java
 
b/karavan-generator/src/main/java/org/apache/camel/karavan/generator/CamelComponentsGenerator.java
index faa0c3f..2f1a660 100644
--- 
a/karavan-generator/src/main/java/org/apache/camel/karavan/generator/CamelComponentsGenerator.java
+++ 
b/karavan-generator/src/main/java/org/apache/camel/karavan/generator/CamelComponentsGenerator.java
@@ -54,7 +54,8 @@ public final class CamelComponentsGenerator {
             String json = getComponent(name);
             JsonObject obj = new JsonObject(json);
             obj.remove("componentProperties");
-            if (!obj.getJsonObject("component").getBoolean("deprecated")){
+            if (!obj.getJsonObject("component").getBoolean("deprecated")
+            && 
!obj.getJsonObject("component").getString("name").equals("kamelet")){
                 saveFile(path, name + ".json", obj.toString());
                 list.append(name).append("\n");
             }

Reply via email to