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 2022/03/28 17:39:55 UTC

[camel-karavan] branch main updated: Fix issues with MultiValueField (#239)

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 4ed4f82  Fix issues with MultiValueField (#239)
4ed4f82 is described below

commit 4ed4f820a8a4145afc58b98e9e68755635f91619
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Mon Mar 28 13:39:50 2022 -0400

    Fix issues with MultiValueField (#239)
---
 .../src/designer/route/property/DslPropertyField.tsx          | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/karavan-designer/src/designer/route/property/DslPropertyField.tsx b/karavan-designer/src/designer/route/property/DslPropertyField.tsx
index 6e6df32..9f4d656 100644
--- a/karavan-designer/src/designer/route/property/DslPropertyField.tsx
+++ b/karavan-designer/src/designer/route/property/DslPropertyField.tsx
@@ -115,7 +115,7 @@ export class DslPropertyField extends React.Component<Props, State> {
     }
 
     getLabel = (property: PropertyMeta, value: any) => {
-        if (property.isObject && !property.isArray && !["ExpressionDefinition"].includes(property.type)) {
+        if (!this.isMultiValueField(property) && property.isObject && !property.isArray && !["ExpressionDefinition"].includes(property.type)) {
             const tooltip = value ? "Delete " + property.name : "Add " + property.name;
             const x = value ? undefined : CamelDefinitionApi.createStep(property.type, {});
             const icon = value ? (<DeleteIcon noVerticalAlign/>) : (<AddIcon noVerticalAlign/>);
@@ -461,6 +461,11 @@ export class DslPropertyField extends React.Component<Props, State> {
         )
     }
 
+
+    isMultiValueField = (property: PropertyMeta): boolean => {
+        return ['string'].includes(property.type) && property.name !== 'expression' && property.isArray && !property.enumVals;
+    }
+
     render() {
         const isKamelet = CamelUi.isKameletComponent(this.props.element);
         const property: PropertyMeta = this.props.property;
@@ -475,7 +480,7 @@ export class DslPropertyField extends React.Component<Props, State> {
                     && this.getExpressionField(property, value)}
                 {property.isObject && !property.isArray && !["ExpressionDefinition", "ExpressionSubElementDefinition"].includes(property.type)
                     && this.getObjectField(property, value)}
-                {property.isObject && property.isArray
+                {property.isObject && property.isArray && !this.isMultiValueField(property)
                     && this.getMultiValueObjectField(property, value)}
                 {property.name === 'expression' && property.type === "string" && !property.isArray
                     && this.getTextArea(property, value)}
@@ -490,7 +495,7 @@ export class DslPropertyField extends React.Component<Props, State> {
                     && this.getTextField(property, value)}
                 {['string'].includes(property.type) && property.name.endsWith("Ref") && !property.isArray && !property.enumVals
                     && this.getSelectBean(property, value)}
-                {['string'].includes(property.type) && property.name !== 'expression' && property.isArray && !property.enumVals
+                {this.isMultiValueField(property)
                     && this.getMultiValueField(property, value)}
                 {property.type === 'boolean'
                     && this.getSwitch(property, value)}