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 6ae0742e Fix #803
6ae0742e is described below

commit 6ae0742eb29b12f912f04b831b5c8a3273cbeadc
Author: Marat Gubaidullin <[email protected]>
AuthorDate: Sat Jun 24 14:22:27 2023 -0400

    Fix #803
---
 .../src/designer/route/DslConnections.tsx          |  1 -
 .../route/property/ComponentParameterField.tsx     | 23 +++++++++++-----------
 .../designer/route/property/DslPropertyField.tsx   |  5 +++--
 karavan-designer/src/designer/utils/CamelUi.tsx    |  6 ++++--
 4 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/karavan-designer/src/designer/route/DslConnections.tsx 
b/karavan-designer/src/designer/route/DslConnections.tsx
index f18866e1..7ccfe8fe 100644
--- a/karavan-designer/src/designer/route/DslConnections.tsx
+++ b/karavan-designer/src/designer/route/DslConnections.tsx
@@ -147,7 +147,6 @@ export class DslConnections extends React.Component<Props, 
State> {
         while (this.hasOverlap(outs)) {
             outs = this.addGap(outs);
         }
-        // console.log(outs);
         return outs;
     }
 
diff --git 
a/karavan-designer/src/designer/route/property/ComponentParameterField.tsx 
b/karavan-designer/src/designer/route/property/ComponentParameterField.tsx
index faad51c8..e9c6d02f 100644
--- a/karavan-designer/src/designer/route/property/ComponentParameterField.tsx
+++ b/karavan-designer/src/designer/route/property/ComponentParameterField.tsx
@@ -59,6 +59,7 @@ interface State {
     showKubernetesSelector: boolean
     kubernetesSelectorProperty?: string
     ref: any
+    id: string
 }
 
 export class ComponentParameterField extends React.Component<Props, State> {
@@ -69,6 +70,7 @@ export class ComponentParameterField extends 
React.Component<Props, State> {
         showPassword: false,
         showKubernetesSelector: false,
         ref: React.createRef(),
+        id: prefix + "-" + this.props.property.name
     }
 
     parametersChanged = (parameter: string, value: string | number | boolean | 
any, pathParameter?: boolean, newRoute?: RouteToCreate) => {
@@ -93,6 +95,7 @@ export class ComponentParameterField extends 
React.Component<Props, State> {
         }
         return (
             <Select
+                id={this.state.id} name={this.state.id}
                 variant={SelectVariant.single}
                 aria-label={property.name}
                 onToggle={isExpanded => {
@@ -142,8 +145,9 @@ export class ComponentParameterField extends 
React.Component<Props, State> {
             selectOptions.push(...uris.map((value: string) =>
                 <SelectOption key={value} value={value.trim()}/>));
         }
-        return <InputGroup>
+        return <InputGroup id={this.state.id} name={this.state.id}>
             <Select
+                id={this.state.id} name={this.state.id}
                 placeholderText="Select or type an URI"
                 variant={SelectVariant.typeahead}
                 aria-label={property.name}
@@ -212,7 +216,6 @@ export class ComponentParameterField extends 
React.Component<Props, State> {
     getStringInput(property: ComponentProperty, value: any) {
         const {showEditor, showPassword} = this.state;
         const inKubernetes = KubernetesAPI.inKubernetes;
-        const id = prefix + "-" + property.name;
         const noKubeSelectorButton = ["uri", "id", "description", 
"group"].includes(property.name);
         return <InputGroup>
             {inKubernetes && !showEditor && !noKubeSelectorButton &&
@@ -224,14 +227,14 @@ export class ComponentParameterField extends 
React.Component<Props, State> {
             {(!showEditor || property.secret) &&
                 <TextInput className="text-field" isRequired 
ref={this.state.ref}
                            type={property.secret && !showPassword ? "password" 
: "text"}
-                           id={id} name={id}
+                           id={this.state.id} name={this.state.id}
                            value={value !== undefined ? value : 
property.defaultValue}
                            onChange={e => 
this.parametersChanged(property.name, e, property.kind === 'path')}/>}
             {showEditor && !property.secret &&
                 <TextArea autoResize={true} ref={this.state.ref}
                           className="text-field" isRequired
                           type="text"
-                          id={id} name={id}
+                          id={this.state.id} name={this.state.id}
                           value={value !== undefined ? value : 
property.defaultValue}
                           onChange={e => this.parametersChanged(property.name, 
e, property.kind === 'path')}/>}
             {!property.secret &&
@@ -252,12 +255,11 @@ export class ComponentParameterField extends 
React.Component<Props, State> {
     }
 
     getTextInput = (property: ComponentProperty, value: any) => {
-        const id = prefix + "-" + property.name;
         return (
             <TextInput
                 className="text-field" isRequired
                 type={['integer', 'int', 'number'].includes(property.type) ? 
'number' : (property.secret ? "password" : "text")}
-                id={id} name={id}
+                id={this.state.id} name={this.state.id}
                 value={value !== undefined ? value : property.defaultValue}
                 onChange={e => this.parametersChanged(property.name, 
['integer', 'int', 'number'].includes(property.type) ? Number(e) : e, 
property.kind === 'path')}/>
         )
@@ -271,6 +273,7 @@ export class ComponentParameterField extends 
React.Component<Props, State> {
         }
         return (
             <Select
+                id={this.state.id} name={this.state.id}
                 variant={SelectVariant.single}
                 aria-label={property.name}
                 onToggle={isExpanded => {
@@ -288,12 +291,11 @@ export class ComponentParameterField extends 
React.Component<Props, State> {
     }
 
     getSwitch = (property: ComponentProperty, value: any) => {
-        const id = prefix + "-" + property.name;
         return (
             <Switch
-                id={id} name={id}
+                id={this.state.id} name={this.state.id}
                 value={value?.toString()}
-                aria-label={id}
+                aria-label={this.state.id}
                 isChecked={value !== undefined ? Boolean(value) : 
property.defaultValue !== undefined && property.defaultValue === 'true'}
                 onChange={e => this.parametersChanged(property.name, 
!Boolean(value))}/>
         )
@@ -302,12 +304,11 @@ export class ComponentParameterField extends 
React.Component<Props, State> {
     render() {
         const property: ComponentProperty = this.props.property;
         const value = this.props.value;
-        const id = prefix + "-" + property.name;
+        const id = this.state.id;
         return (
             <FormGroup
                 key={id}
                 label={property.displayName}
-                fieldId={id}
                 isRequired={property.required}
                 labelIcon={
                     <Popover
diff --git a/karavan-designer/src/designer/route/property/DslPropertyField.tsx 
b/karavan-designer/src/designer/route/property/DslPropertyField.tsx
index 48f10440..fb81df12 100644
--- a/karavan-designer/src/designer/route/property/DslPropertyField.tsx
+++ b/karavan-designer/src/designer/route/property/DslPropertyField.tsx
@@ -301,7 +301,8 @@ export class DslPropertyField extends 
React.Component<Props, State> {
                     autoResize
                     className="text-field" isRequired
                     type={"text"}
-                    id={property.name} name={property.name}
+                    id={property.name}
+                    name={property.name}
                     height={"100px"}
                     value={value?.toString()}
                     onChange={e => this.propertyChanged(property.name, e)}/>
@@ -403,6 +404,7 @@ export class DslPropertyField extends 
React.Component<Props, State> {
                 onSelect={(e, value, isPlaceholder) => 
this.propertyChanged(property.name, (!isPlaceholder ? value : undefined))}
                 selections={value}
                 isOpen={this.isSelectOpen(property.name)}
+                id={property.name}
                 aria-labelledby={property.name}
                 direction={SelectDirection.down}
             >
@@ -697,7 +699,6 @@ export class DslPropertyField extends 
React.Component<Props, State> {
                 <FormGroup
                     label={this.props.hideLabel ? undefined : 
this.getLabel(property, value)}
                     isRequired={property.required}
-                    fieldId={property.name}
                     labelIcon={this.getLabelIcon(property)}>
                     {value && ["ExpressionDefinition", 
"ExpressionSubElementDefinition"].includes(property.type)
                         && this.getExpressionField(property, value)}
diff --git a/karavan-designer/src/designer/utils/CamelUi.tsx 
b/karavan-designer/src/designer/utils/CamelUi.tsx
index 419db7a8..a577a069 100644
--- a/karavan-designer/src/designer/utils/CamelUi.tsx
+++ b/karavan-designer/src/designer/utils/CamelUi.tsx
@@ -248,8 +248,10 @@ export class CamelUi {
         integration.spec.flows?.filter(f => f.dslName === 'RouteDefinition')
             .filter((r: RouteDefinition) => 
r.from.uri.startsWith(componentName))
             .forEach((r: RouteDefinition) => {
-                if (showComponentName) result.push(r.from.uri)
-                else result.push(r.from.uri.replace(componentName+":", ""));
+                const uri = r.from.uri;
+                const name = r.from.parameters.name;
+                if (showComponentName) result.push(uri + ":" + name);
+                else result.push(name);
             });
         return result;
     }

Reply via email to