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 38236be3c0008b08bf5c593057dd67533e62786c Author: Marat Gubaidullin <ma...@talismancloud.io> AuthorDate: Tue Oct 31 17:02:37 2023 -0400 Fix for properties #931 --- karavan-space/src/designer/KaravanDesigner.tsx | 1 - .../src/designer/route/property/DslPropertyField.tsx | 17 +++++++++++------ .../src/main/webui/src/designer/KaravanDesigner.tsx | 1 - .../src/designer/route/property/DslPropertyField.tsx | 17 +++++++++++------ .../designer/route/property/KameletPropertyField.tsx | 1 - 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/karavan-space/src/designer/KaravanDesigner.tsx b/karavan-space/src/designer/KaravanDesigner.tsx index b1af73c5..eb967d0e 100644 --- a/karavan-space/src/designer/KaravanDesigner.tsx +++ b/karavan-space/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-space/src/designer/route/property/DslPropertyField.tsx b/karavan-space/src/designer/route/property/DslPropertyField.tsx index 9ab39ce7..f42235dc 100644 --- a/karavan-space/src/designer/route/property/DslPropertyField.tsx +++ b/karavan-space/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; }) diff --git a/karavan-web/karavan-app/src/main/webui/src/designer/KaravanDesigner.tsx b/karavan-web/karavan-app/src/main/webui/src/designer/KaravanDesigner.tsx index b1af73c5..eb967d0e 100644 --- a/karavan-web/karavan-app/src/main/webui/src/designer/KaravanDesigner.tsx +++ b/karavan-web/karavan-app/src/main/webui/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-web/karavan-app/src/main/webui/src/designer/route/property/DslPropertyField.tsx b/karavan-web/karavan-app/src/main/webui/src/designer/route/property/DslPropertyField.tsx index 9ab39ce7..f42235dc 100644 --- a/karavan-web/karavan-app/src/main/webui/src/designer/route/property/DslPropertyField.tsx +++ b/karavan-web/karavan-app/src/main/webui/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; }) diff --git a/karavan-web/karavan-app/src/main/webui/src/designer/route/property/KameletPropertyField.tsx b/karavan-web/karavan-app/src/main/webui/src/designer/route/property/KameletPropertyField.tsx index 0bac1c32..96b880c1 100644 --- a/karavan-web/karavan-app/src/main/webui/src/designer/route/property/KameletPropertyField.tsx +++ b/karavan-web/karavan-app/src/main/webui/src/designer/route/property/KameletPropertyField.tsx @@ -34,7 +34,6 @@ import ShowIcon from "@patternfly/react-icons/dist/js/icons/eye-icon"; import HideIcon from "@patternfly/react-icons/dist/js/icons/eye-slash-icon"; import DockerIcon from "@patternfly/react-icons/dist/js/icons/docker-icon"; import {usePropertiesHook} from "../usePropertiesHook"; -import {CamelUi} from "../../utils/CamelUi"; import {Select, SelectDirection, SelectOption, SelectVariant} from "@patternfly/react-core/deprecated"; interface Props {