diff --git a/karavan-app/src/main/webui/src/designer/property/property/DslPropertyField.tsx b/karavan-app/src/main/webui/src/designer/property/property/DslPropertyField.tsx index a8d3430caa8..9fd45783759 100644 --- a/karavan-app/src/main/webui/src/designer/property/property/DslPropertyField.tsx +++ b/karavan-app/src/main/webui/src/designer/property/property/DslPropertyField.tsx @@ -470,6 +470,7 @@ export function DslPropertyField(props: Props) { } function showCode(name: string, javaType: string) { + console.log(name, javaType) const {property} = props; InfrastructureAPI.onGetCustomCode?.(name, property.javaType).then(value => { if (value === undefined) { @@ -487,6 +488,7 @@ export function DslPropertyField(props: Props) { const {dslLanguage} = props; const selectOptions: SelectOptionProps[] = []; if (beans) { + console.log(beans) selectOptions.push(...beans.map((bean) => { return {value: beanPrefix + bean.name, children: bean.name} })); @@ -497,51 +499,46 @@ export function DslPropertyField(props: Props) { }) ); } + if (selectOptions.filter(o => o.value === value?.toString()).length === 0) { + selectOptions.push({ + value: value, children: value, description: 'Custom Bean' + }) + } return ( - propertyChanged(property.name, value)} - /> - // - // - // { - // propertyChanged(property.name, CamelUtil.capitalizeName(value?.replace(/\s/g, ''))) - // }} - // readOnlyVariant={isUriReadOnly(property) ? "default" : undefined}/> - // - // - // - // - // - // - // {showEditor && - // setShowEditor(false)} - // onSave={(fieldId, value1) => { - // propertyChanged(fieldId, value); - // InfrastructureAPI.onSaveCustomCode?.(value, value1); - // setShowEditor(false) - // }}/> - // } - // + + + propertyChanged(property.name, value)} + /> + + + + + + + {showEditor && + setShowEditor(false)} + onSave={(fieldId, value1) => { + propertyChanged(fieldId, value); + InfrastructureAPI.onSaveCustomCode?.(value, value1); + setShowEditor(false) + }}/> + } + ) } diff --git a/karavan-app/src/main/webui/src/designer/property/property/SelectField.tsx b/karavan-app/src/main/webui/src/designer/property/property/SelectField.tsx index 3f3affc0565..ad4b1834c13 100644 --- a/karavan-app/src/main/webui/src/designer/property/property/SelectField.tsx +++ b/karavan-app/src/main/webui/src/designer/property/property/SelectField.tsx @@ -82,7 +82,7 @@ export function SelectField(props: Props) { setSelectOptions(newSelectOptions); }, [filterValue]); - const createItemId = (value: any) => `select-typeahead-${value.replace(' ', '-')}`; + const createItemId = (value: any) => `select-typeahead-${value?.replace(' ', '-')}`; const setActiveAndFocusedItem = (itemIndex: number) => { setFocusedItemIndex(itemIndex); diff --git a/karavan-designer/src/designer/property/property/DslPropertyField.tsx b/karavan-designer/src/designer/property/property/DslPropertyField.tsx index a8d3430caa8..9fd45783759 100644 --- a/karavan-designer/src/designer/property/property/DslPropertyField.tsx +++ b/karavan-designer/src/designer/property/property/DslPropertyField.tsx @@ -470,6 +470,7 @@ export function DslPropertyField(props: Props) { } function showCode(name: string, javaType: string) { + console.log(name, javaType) const {property} = props; InfrastructureAPI.onGetCustomCode?.(name, property.javaType).then(value => { if (value === undefined) { @@ -487,6 +488,7 @@ export function DslPropertyField(props: Props) { const {dslLanguage} = props; const selectOptions: SelectOptionProps[] = []; if (beans) { + console.log(beans) selectOptions.push(...beans.map((bean) => { return {value: beanPrefix + bean.name, children: bean.name} })); @@ -497,51 +499,46 @@ export function DslPropertyField(props: Props) { }) ); } + if (selectOptions.filter(o => o.value === value?.toString()).length === 0) { + selectOptions.push({ + value: value, children: value, description: 'Custom Bean' + }) + } return ( - propertyChanged(property.name, value)} - /> - // - // - // { - // propertyChanged(property.name, CamelUtil.capitalizeName(value?.replace(/\s/g, ''))) - // }} - // readOnlyVariant={isUriReadOnly(property) ? "default" : undefined}/> - // - // - // - // - // - // - // {showEditor && - // setShowEditor(false)} - // onSave={(fieldId, value1) => { - // propertyChanged(fieldId, value); - // InfrastructureAPI.onSaveCustomCode?.(value, value1); - // setShowEditor(false) - // }}/> - // } - // + + + propertyChanged(property.name, value)} + /> + + + + + + + {showEditor && + setShowEditor(false)} + onSave={(fieldId, value1) => { + propertyChanged(fieldId, value); + InfrastructureAPI.onSaveCustomCode?.(value, value1); + setShowEditor(false) + }}/> + } + ) } diff --git a/karavan-designer/src/designer/property/property/SelectField.tsx b/karavan-designer/src/designer/property/property/SelectField.tsx index 3f3affc0565..ad4b1834c13 100644 --- a/karavan-designer/src/designer/property/property/SelectField.tsx +++ b/karavan-designer/src/designer/property/property/SelectField.tsx @@ -82,7 +82,7 @@ export function SelectField(props: Props) { setSelectOptions(newSelectOptions); }, [filterValue]); - const createItemId = (value: any) => `select-typeahead-${value.replace(' ', '-')}`; + const createItemId = (value: any) => `select-typeahead-${value?.replace(' ', '-')}`; const setActiveAndFocusedItem = (itemIndex: number) => { setFocusedItemIndex(itemIndex); diff --git a/karavan-space/src/designer/property/property/DslPropertyField.tsx b/karavan-space/src/designer/property/property/DslPropertyField.tsx index a8d3430caa8..9fd45783759 100644 --- a/karavan-space/src/designer/property/property/DslPropertyField.tsx +++ b/karavan-space/src/designer/property/property/DslPropertyField.tsx @@ -470,6 +470,7 @@ export function DslPropertyField(props: Props) { } function showCode(name: string, javaType: string) { + console.log(name, javaType) const {property} = props; InfrastructureAPI.onGetCustomCode?.(name, property.javaType).then(value => { if (value === undefined) { @@ -487,6 +488,7 @@ export function DslPropertyField(props: Props) { const {dslLanguage} = props; const selectOptions: SelectOptionProps[] = []; if (beans) { + console.log(beans) selectOptions.push(...beans.map((bean) => { return {value: beanPrefix + bean.name, children: bean.name} })); @@ -497,51 +499,46 @@ export function DslPropertyField(props: Props) { }) ); } + if (selectOptions.filter(o => o.value === value?.toString()).length === 0) { + selectOptions.push({ + value: value, children: value, description: 'Custom Bean' + }) + } return ( - propertyChanged(property.name, value)} - /> - // - // - // { - // propertyChanged(property.name, CamelUtil.capitalizeName(value?.replace(/\s/g, ''))) - // }} - // readOnlyVariant={isUriReadOnly(property) ? "default" : undefined}/> - // - // - // - // - // - // - // {showEditor && - // setShowEditor(false)} - // onSave={(fieldId, value1) => { - // propertyChanged(fieldId, value); - // InfrastructureAPI.onSaveCustomCode?.(value, value1); - // setShowEditor(false) - // }}/> - // } - // + + + propertyChanged(property.name, value)} + /> + + + + + + + {showEditor && + setShowEditor(false)} + onSave={(fieldId, value1) => { + propertyChanged(fieldId, value); + InfrastructureAPI.onSaveCustomCode?.(value, value1); + setShowEditor(false) + }}/> + } + ) } diff --git a/karavan-space/src/designer/property/property/SelectField.tsx b/karavan-space/src/designer/property/property/SelectField.tsx index 3f3affc0565..ad4b1834c13 100644 --- a/karavan-space/src/designer/property/property/SelectField.tsx +++ b/karavan-space/src/designer/property/property/SelectField.tsx @@ -82,7 +82,7 @@ export function SelectField(props: Props) { setSelectOptions(newSelectOptions); }, [filterValue]); - const createItemId = (value: any) => `select-typeahead-${value.replace(' ', '-')}`; + const createItemId = (value: any) => `select-typeahead-${value?.replace(' ', '-')}`; const setActiveAndFocusedItem = (itemIndex: number) => { setFocusedItemIndex(itemIndex);