in karavan-space/src/designer/property/property/DslPropertyField.tsx [497:554]
function getJavaTypeGeneratedInput(property: PropertyMeta, value: any) {
const {dslLanguage} = props;
const selectOptions: SelectOptionProps[] = [];
const allBeansByJavaInterface = SpiBeanApi.findByInterfaceType(property.javaType);
const allBeansJavaTypes: (string | undefined)[] = allBeansByJavaInterface.map(b => b.javaType).filter(b => b !== undefined) || [];
if (beans) {
selectOptions.push(...beans.filter(bean => allBeansJavaTypes.includes(bean.type.replace('#class:', ''))).map((bean) => {
return {value: beanPrefix + bean.name, children: bean.name, description: bean.name}
}));
selectOptions.push(...SpiBeanApi.findByInterfaceTypeSimple(property.javaType).map((bean) => {
return {
value: classPrefix + bean.javaType, children: bean.name, description: bean.description
}
})
);
}
if (value !== undefined && value.length > 0 && selectOptions.filter(o => o.value === value?.toString()).length === 0) {
selectOptions.push({
value: value, children: value, description: 'Custom Java Class'
})
}
return (
<InputGroup className={valueChangedClassName}>
<InputGroupItem isFill>
<SelectField
id={property.name}
name={property.name}
placeholder='Select bean'
selectOptions={selectOptions}
value={value?.toString()}
onChange={(name, value) => propertyChanged(property.name, value)}
/>
</InputGroupItem>
<InputGroupItem>
<Tooltip position="bottom-end" content={"Create Java Class"}>
<Button isDisabled={value?.length === 0} variant="control"
onClick={e => showCode(value, property.javaType)}>
<PlusIcon/>
</Button>
</Tooltip>
</InputGroupItem>
{showEditor && <InputGroupItem>
<ExpressionModalEditor name={property.name}
customCode={customCode}
showEditor={showEditor}
dark={dark}
dslLanguage={dslLanguage}
title="Java Class"
onClose={() => setShowEditor(false)}
onSave={(fieldId, value1) => {
propertyChanged(fieldId, value);
InfrastructureAPI.onSaveCustomCode?.(value, value1);
setShowEditor(false)
}}/>
</InputGroupItem>}
</InputGroup>
)
}