Skip to content

Commit

Permalink
Fix for properties #931
Browse files Browse the repository at this point in the history
  • Loading branch information
mgubaidullin committed Oct 31, 2023
1 parent 09197e0 commit 38236be
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
1 change: 0 additions & 1 deletion karavan-space/src/designer/KaravanDesigner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
17 changes: 11 additions & 6 deletions karavan-space/src/designer/route/property/DslPropertyField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
})
}

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -654,6 +658,7 @@ export function DslPropertyField(props: Props) {
</div>
)
}

function getExpandableComponentParameters(properties: ComponentProperty[], label: string) {
const element = props.element;

Expand All @@ -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;
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
})
}

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -654,6 +658,7 @@ export function DslPropertyField(props: Props) {
</div>
)
}

function getExpandableComponentParameters(properties: ComponentProperty[], label: string) {
const element = props.element;

Expand All @@ -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;
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 38236be

Please sign in to comment.