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 0d0e1dc Bean slector for ref (#183) 0d0e1dc is described below commit 0d0e1dcc5d4f23c735f8b1d2f7732f2882973d3b Author: Marat Gubaidullin <marat.gubaidul...@gmail.com> AuthorDate: Thu Feb 10 17:33:54 2022 -0500 Bean slector for ref (#183) --- karavan-core/src/core/api/CamelDefinitionApiExt.ts | 15 +++++---- karavan-core/src/core/api/CamelDefinitionYaml.ts | 6 ++-- karavan-core/src/core/api/CamelUtil.ts | 6 ++-- karavan-core/src/core/model/CamelDefinition.ts | 13 +------- .../src/designer/beans/BeanProperties.tsx | 23 ++++---------- .../src/designer/beans/BeansDesigner.tsx | 18 +++++------ .../src/designer/field/DataFormatField.tsx | 4 ++- .../src/designer/field/DslPropertyField.tsx | 36 +++++++++++++++++++--- .../src/designer/field/ExpressionField.tsx | 4 ++- .../src/designer/field/ObjectField.tsx | 4 ++- karavan-designer/src/designer/karavan.css | 8 ++--- .../src/designer/route/DslProperties.tsx | 2 ++ karavan-designer/src/designer/utils/CamelUi.ts | 8 ++--- .../src/main/resources/CamelDefinition.header.ts | 11 ------- 14 files changed, 82 insertions(+), 76 deletions(-) diff --git a/karavan-core/src/core/api/CamelDefinitionApiExt.ts b/karavan-core/src/core/api/CamelDefinitionApiExt.ts index 1197f73..348a688 100644 --- a/karavan-core/src/core/api/CamelDefinitionApiExt.ts +++ b/karavan-core/src/core/api/CamelDefinitionApiExt.ts @@ -18,7 +18,7 @@ import {CamelMetadataApi, ElementMeta, Languages, PropertyMeta} from "../model/C import {ComponentApi} from "./ComponentApi"; import {CamelUtil} from "./CamelUtil"; import { - Bean, Beans, + NamedBeanDefinition, Beans, CamelElement, CamelElementMeta, ExpressionDefinition, Integration, RouteDefinition @@ -43,8 +43,11 @@ export class CamelDefinitionApiExt { if (step.dslName === 'RouteDefinition') { integration.spec.flows?.push(step as RouteDefinition); } else { - const flows = CamelDefinitionApiExt.addStepToSteps(integration.spec.flows || [], step, parentId, position); - integration.spec.flows = flows as RouteDefinition[]; + const flows: any[] = []; + integration.spec.flows?.filter(flow => flow.dslName === 'Beans').forEach(bean => flows.push(bean)); + const routes = CamelDefinitionApiExt.addStepToSteps(integration.spec.flows?.filter(flow => flow.dslName === 'RouteDefinition') || [], step, parentId, position); + flows.push(...routes); + integration.spec.flows = flows; } return integration; } @@ -184,7 +187,7 @@ export class CamelDefinitionApiExt { return result } - static addBeanToIntegration = (integration: Integration, bean: Bean): Integration => { + static addBeanToIntegration = (integration: Integration, bean: NamedBeanDefinition): Integration => { const flows: any[] = []; if (integration.spec.flows?.filter(flow => flow.dslName === 'Beans').length === 0) { flows.push(...integration.spec.flows); @@ -192,7 +195,7 @@ export class CamelDefinitionApiExt { } else { flows.push(...integration.spec.flows?.filter(flow => flow.dslName !== 'Beans') || []); integration.spec.flows?.filter(flow => flow.dslName === 'Beans').forEach(flow => { - const beans: Bean[] = []; + const beans: NamedBeanDefinition[] = []; if ((flow as Beans).beans.filter(b => b.uuid === bean.uuid).length === 0){ beans.push(...(flow as Beans).beans.filter(b => b.uuid !== bean.uuid)); beans.push(bean); @@ -210,7 +213,7 @@ export class CamelDefinitionApiExt { return integration; } - static deleteBeanFromIntegration = (integration: Integration, bean?: Bean): Integration => { + static deleteBeanFromIntegration = (integration: Integration, bean?: NamedBeanDefinition): Integration => { const flows: any[] = []; integration.spec.flows?.forEach(flow => { if (flow.dslName === 'Beans') { diff --git a/karavan-core/src/core/api/CamelDefinitionYaml.ts b/karavan-core/src/core/api/CamelDefinitionYaml.ts index 0587dc0..5488458 100644 --- a/karavan-core/src/core/api/CamelDefinitionYaml.ts +++ b/karavan-core/src/core/api/CamelDefinitionYaml.ts @@ -17,7 +17,7 @@ import * as yaml from 'js-yaml'; import { Integration, - CamelElement, RouteDefinition, Bean, Beans, + CamelElement, RouteDefinition, NamedBeanDefinition, Beans, } from "../model/CamelDefinition"; import {CamelUtil} from "./CamelUtil"; import {CamelDefinitionYamlStep} from "./CamelDefinitionYamlStep"; @@ -48,7 +48,7 @@ export class CamelDefinitionYaml { delete object.expressionName; } else if (object.dslName.endsWith('DataFormat')) { delete object.dataFormatName; - } else if (object.dslName = 'Bean') { + } else if (object.dslName = 'NamedBeanDefinition') { if (object.properties && Object.keys(object.properties).length === 0) delete object.properties; } delete object.uuid; @@ -150,7 +150,7 @@ export class CamelDefinitionYaml { }) } b.properties = props; - result.beans.push(new Bean(b)) + result.beans.push(new NamedBeanDefinition(b)) }) return result; } diff --git a/karavan-core/src/core/api/CamelUtil.ts b/karavan-core/src/core/api/CamelUtil.ts index 484c7fb..71d9b96 100644 --- a/karavan-core/src/core/api/CamelUtil.ts +++ b/karavan-core/src/core/api/CamelUtil.ts @@ -16,7 +16,7 @@ */ import { Integration, - CamelElement, Bean, Beans, + CamelElement, NamedBeanDefinition, Beans, } from "../model/CamelDefinition"; import {CamelDefinitionApi} from "./CamelDefinitionApi"; @@ -43,9 +43,9 @@ export class CamelUtil { return CamelDefinitionApi.createStep(step.dslName, clone, true); } - static cloneBean = (bean: Bean): Bean => { + static cloneBean = (bean: NamedBeanDefinition): NamedBeanDefinition => { const clone = JSON.parse(JSON.stringify(bean)); - const newBean = new Bean(clone); + const newBean = new NamedBeanDefinition(clone); newBean.uuid = bean.uuid; return newBean; } diff --git a/karavan-core/src/core/model/CamelDefinition.ts b/karavan-core/src/core/model/CamelDefinition.ts index 6e22563..84a11b0 100644 --- a/karavan-core/src/core/model/CamelDefinition.ts +++ b/karavan-core/src/core/model/CamelDefinition.ts @@ -54,7 +54,7 @@ export class CamelElement { } export class Beans extends CamelElement { - beans: Bean[] = [] + beans: NamedBeanDefinition[] = [] public constructor(init?: Partial<Beans>) { super("Beans") @@ -62,17 +62,6 @@ export class Beans extends CamelElement { } } -export class Bean extends CamelElement { - name: string = '' - type: string = '' - properties: any - - public constructor(init?: Partial<Bean>) { - super("Bean") - Object.assign(this, init); - } -} - export class CamelElementMeta { step?: CamelElement parentUuid?: string diff --git a/karavan-designer/src/designer/beans/BeanProperties.tsx b/karavan-designer/src/designer/beans/BeanProperties.tsx index ad6b578..14fa152 100644 --- a/karavan-designer/src/designer/beans/BeanProperties.tsx +++ b/karavan-designer/src/designer/beans/BeanProperties.tsx @@ -18,26 +18,15 @@ import React from 'react'; import { Form, FormGroup, - TextInput, - Text, - Title, - TextVariants, Button, + TextInput, Button, } from '@patternfly/react-core'; import '../karavan.css'; import "@patternfly/patternfly/patternfly.css"; -import {DataFormatField} from "../field/DataFormatField"; -import {DslPropertyField} from "../field/DslPropertyField"; import { - CamelElement, Integration, - ExpressionDefinition, - DataFormatDefinition, Bean + NamedBeanDefinition, } from "karavan-core/lib/model/CamelDefinition"; -import {CamelDefinitionApiExt} from "karavan-core/lib/api/CamelDefinitionApiExt"; -import {ComponentApi} from "karavan-core/lib/api/ComponentApi"; import {CamelUtil} from "karavan-core/lib/api/CamelUtil"; -import {CamelUi} from "../utils/CamelUi"; -import {CamelMetadataApi, PropertyMeta} from "karavan-core/lib/model/CamelMetadata"; import {v4 as uuidv4} from "uuid"; import DeleteIcon from "@patternfly/react-icons/dist/js/icons/times-icon"; import AddIcon from "@patternfly/react-icons/dist/js/icons/plus-circle-icon"; @@ -45,13 +34,13 @@ import {IntegrationHeader} from "../utils/KaravanComponents"; interface Props { integration: Integration - bean?: Bean + bean?: NamedBeanDefinition dark: boolean - onChange: (bean: Bean) => void + onChange: (bean: NamedBeanDefinition) => void } interface State { - bean?: Bean + bean?: NamedBeanDefinition properties: Map<string, [string, string]> key: string } @@ -84,7 +73,7 @@ export class BeanProperties extends React.Component<Props, State> { } } - setBean = (bean?: Bean) => { + setBean = (bean?: NamedBeanDefinition) => { this.setState({ bean: bean, properties: bean?.properties ? this.preparePropertiesMap(bean.properties) : new Map<string, [string, string]>() diff --git a/karavan-designer/src/designer/beans/BeansDesigner.tsx b/karavan-designer/src/designer/beans/BeansDesigner.tsx index 2416964..24c02bb 100644 --- a/karavan-designer/src/designer/beans/BeansDesigner.tsx +++ b/karavan-designer/src/designer/beans/BeansDesigner.tsx @@ -19,7 +19,7 @@ import { Button, Card, CardActions, CardBody, CardFooter, CardHeader, CardTitle, Gallery, Modal, PageSection } from '@patternfly/react-core'; import '../karavan.css'; -import {Bean, Integration} from "karavan-core/lib/model/CamelDefinition"; +import {NamedBeanDefinition, Integration} from "karavan-core/lib/model/CamelDefinition"; import {CamelUi} from "../utils/CamelUi"; import PlusIcon from "@patternfly/react-icons/dist/esm/icons/plus-icon"; import {CamelDefinitionApiExt} from "karavan-core/lib/api/CamelDefinitionApiExt"; @@ -39,7 +39,7 @@ interface Props { interface State { integration: Integration showDeleteConfirmation: boolean - selectedBean?: Bean + selectedBean?: NamedBeanDefinition key: string showBeanEditor: boolean } @@ -71,7 +71,7 @@ export class BeansDesigner extends React.Component<Props, State> { } } - showDeleteConfirmation = (e: React.MouseEvent, bean: Bean) => { + showDeleteConfirmation = (e: React.MouseEvent, bean: NamedBeanDefinition) => { e.stopPropagation(); this.setState({selectedBean: bean, showDeleteConfirmation: true}); } @@ -86,11 +86,11 @@ export class BeansDesigner extends React.Component<Props, State> { integration: i, showDeleteConfirmation: false, key: Math.random().toString(), - selectedBean: new Bean() + selectedBean: new NamedBeanDefinition() }); } - changeBean = (bean: Bean) => { + changeBean = (bean: NamedBeanDefinition) => { const clone = CamelUtil.cloneIntegration(this.state.integration); const i = CamelDefinitionApiExt.addBeanToIntegration(clone, bean); this.setState({integration: i, key: Math.random().toString(), selectedBean: bean}); @@ -122,7 +122,7 @@ export class BeansDesigner extends React.Component<Props, State> { this.setState({showBeanEditor: true}) } - selectBean = (bean?: Bean) => { + selectBean = (bean?: NamedBeanDefinition) => { this.setState({selectedBean: bean}) } @@ -134,10 +134,10 @@ export class BeansDesigner extends React.Component<Props, State> { }; createBean = () => { - this.changeBean(new Bean()); + this.changeBean(new NamedBeanDefinition()); } - getCard(bean: Bean, index: number) { + getCard(bean: NamedBeanDefinition, index: number) { return ( <Card key={bean.dslName + index} isHoverable isCompact className={this.state.selectedBean?.uuid === bean.uuid ? "bean-card bean-card-selected" : "bean-card bean-card-unselected"} @@ -163,7 +163,7 @@ export class BeansDesigner extends React.Component<Props, State> { <div className="beans-page-columns" data-click="BEANS" onClick={event => this.unselectBean(event)}> <div className="beans-panel"> <Gallery hasGutter className="beans-gallery" data-click="BEANS" onClick={event => this.unselectBean(event)}> - {beans.map((bean: Bean, index: number) => this.getCard(bean, index))} + {beans.map((bean: NamedBeanDefinition, index: number) => this.getCard(bean, index))} </Gallery> <div className="add-button-div" data-click="BEANS" onClick={event => this.unselectBean(event)}> <Button icon={<PlusIcon/>} variant={beans.length === 0 ? "primary" : "secondary"} onClick={e => this.createBean()} className="add-bean-button"> diff --git a/karavan-designer/src/designer/field/DataFormatField.tsx b/karavan-designer/src/designer/field/DataFormatField.tsx index 78d4487..7513eba 100644 --- a/karavan-designer/src/designer/field/DataFormatField.tsx +++ b/karavan-designer/src/designer/field/DataFormatField.tsx @@ -26,7 +26,7 @@ import '../karavan.css'; import "@patternfly/patternfly/patternfly.css"; import {CamelMetadataApi, PropertyMeta} from "karavan-core/lib/model/CamelMetadata"; import {CamelDefinitionApiExt} from "karavan-core/lib/api/CamelDefinitionApiExt"; -import {CamelElement, DataFormatDefinition} from "karavan-core/lib/model/CamelDefinition"; +import {CamelElement, DataFormatDefinition, Integration} from "karavan-core/lib/model/CamelDefinition"; import {CamelDefinitionApi} from "karavan-core/lib/api/CamelDefinitionApi"; import {DslPropertyField} from "./DslPropertyField"; import {DataFormats} from "karavan-core/lib/model/CamelMetadata"; @@ -35,6 +35,7 @@ interface Props { dslName: string, value: CamelElement, onDataFormatChange?: ( value:DataFormatDefinition) => void + integration: Integration, } interface State { @@ -123,6 +124,7 @@ export class DataFormatField extends React.Component<Props, State> { fieldId={"properties"}> {value && properties?.map((property: PropertyMeta) => <DslPropertyField property={property} + integration={this.props.integration} element={value} value={value ? (value as any)[property.name] : undefined} onExpressionChange={exp => {}} diff --git a/karavan-designer/src/designer/field/DslPropertyField.tsx b/karavan-designer/src/designer/field/DslPropertyField.tsx index 820d2b2..c1941c9 100644 --- a/karavan-designer/src/designer/field/DslPropertyField.tsx +++ b/karavan-designer/src/designer/field/DslPropertyField.tsx @@ -35,7 +35,7 @@ import {CamelDefinitionApiExt} from "karavan-core/lib/api/CamelDefinitionApiExt" import {ExpressionField} from "./ExpressionField"; import {CamelUi} from "../utils/CamelUi"; import {ComponentParameterField} from "./ComponentParameterField"; -import {CamelElement, DataFormatDefinition} from "karavan-core/lib/model/CamelDefinition"; +import {CamelElement, DataFormatDefinition, Integration} from "karavan-core/lib/model/CamelDefinition"; import {KameletPropertyField} from "./KameletPropertyField"; import {ExpressionDefinition} from "karavan-core/lib/model/CamelDefinition"; import PlusIcon from "@patternfly/react-icons/dist/esm/icons/plus-icon"; @@ -51,6 +51,7 @@ interface Props { onDataFormatChange?: (value: DataFormatDefinition) => void, onParameterChange?: (parameter: string, value: string | number | boolean | any, pathParameter?: boolean) => void, element?: CamelElement + integration: Integration, } interface State { @@ -153,7 +154,7 @@ export class DslPropertyField extends React.Component<Props, State> { getExpressionField = (property: PropertyMeta, value: any) => { return ( <div className="expression"> - <ExpressionField property={property} value={value} onExpressionChange={this.props.onExpressionChange}/> + <ExpressionField property={property} value={value} onExpressionChange={this.props.onExpressionChange} integration={this.props.integration}/> </div> ) } @@ -161,7 +162,7 @@ export class DslPropertyField extends React.Component<Props, State> { getObjectField = (property: PropertyMeta, value: any) => { return ( <div className="object"> - {value && <ObjectField property={property} value={value} onPropertyUpdate={this.props.onChange}/>} + {value && <ObjectField property={property} value={value} onPropertyUpdate={this.props.onChange} integration={this.props.integration} />} </div> ) } @@ -177,6 +178,31 @@ export class DslPropertyField extends React.Component<Props, State> { ) } + getSelectBean = (property: PropertyMeta, value: any) => { + const selectOptions: JSX.Element[] = []; + const beans = CamelUi.getBeans(this.props.integration); + if (beans) { + selectOptions.push(<SelectOption key={0} value={"Select..."} isPlaceholder/>); + selectOptions.push(...beans.map((bean) => <SelectOption key={bean.name} value={bean.name} description={bean.type}/>)); + } + return ( + <Select + variant={SelectVariant.single} + aria-label={property.name} + onToggle={isExpanded => { + this.openSelect(property.name) + }} + onSelect={(e, value, isPlaceholder) => this.propertyChanged(property.name, (!isPlaceholder ? value : undefined))} + selections={value} + isOpen={this.isSelectOpen(property.name)} + aria-labelledby={property.name} + direction={SelectDirection.down} + > + {selectOptions} + </Select> + ) + } + getSelect = (property: PropertyMeta, value: any) => { const selectOptions: JSX.Element[] = [] if (property.enumVals && property.enumVals.length > 0) { @@ -312,8 +338,10 @@ export class DslPropertyField extends React.Component<Props, State> { && this.getMultiValueObjectField(property, value)} {property.name === 'expression' && property.type === "string" && !property.isArray && this.getTextArea(property, value)} - {['string', 'duration', 'integer', 'number'].includes(property.type) && property.name !== 'expression' && !property.isArray && !property.enumVals + {['string', 'duration', 'integer', 'number'].includes(property.type) && property.name !== 'expression' && !property.name.endsWith("Ref") && !property.isArray && !property.enumVals && this.getTextField(property, value)} + {['string'].includes(property.type) && property.name.endsWith("Ref") && !property.isArray && !property.enumVals + && this.getSelectBean(property, value)} {['string'].includes(property.type) && property.name !== 'expression' && property.isArray && !property.enumVals && this.getMultiValueField(property, value)} {property.type === 'boolean' diff --git a/karavan-designer/src/designer/field/ExpressionField.tsx b/karavan-designer/src/designer/field/ExpressionField.tsx index 1b23db8..cc9608f 100644 --- a/karavan-designer/src/designer/field/ExpressionField.tsx +++ b/karavan-designer/src/designer/field/ExpressionField.tsx @@ -28,7 +28,7 @@ import "@patternfly/patternfly/patternfly.css"; import HelpIcon from "@patternfly/react-icons/dist/js/icons/help-icon"; import {CamelMetadataApi, Languages, PropertyMeta} from "karavan-core/lib/model/CamelMetadata"; import {CamelDefinitionApiExt} from "karavan-core/lib/api/CamelDefinitionApiExt"; -import {CamelElement, ExpressionDefinition} from "karavan-core/lib/model/CamelDefinition"; +import {CamelElement, ExpressionDefinition, Integration} from "karavan-core/lib/model/CamelDefinition"; import {CamelDefinitionApi} from "karavan-core/lib/api/CamelDefinitionApi"; import {DslPropertyField} from "./DslPropertyField"; import {CamelUi} from "../utils/CamelUi"; @@ -37,6 +37,7 @@ interface Props { property: PropertyMeta, value: CamelElement, onExpressionChange?: ( value:ExpressionDefinition) => void + integration: Integration, } interface State { @@ -140,6 +141,7 @@ export class ExpressionField extends React.Component<Props, State> { }> {value && this.getProps().map((property: PropertyMeta) => <DslPropertyField key={property.name + this.props.value?.uuid} property={property} + integration={this.props.integration} element={value} value={value ? (value as any)[property.name] : undefined} onExpressionChange={exp => {}} diff --git a/karavan-designer/src/designer/field/ObjectField.tsx b/karavan-designer/src/designer/field/ObjectField.tsx index 4d159ac..6af4d83 100644 --- a/karavan-designer/src/designer/field/ObjectField.tsx +++ b/karavan-designer/src/designer/field/ObjectField.tsx @@ -20,7 +20,7 @@ import "@patternfly/patternfly/patternfly.css"; import {DslPropertyField} from "./DslPropertyField"; import { CamelElement, - ExpressionDefinition, + ExpressionDefinition, Integration, } from "karavan-core/lib/model/CamelDefinition"; import {CamelDefinitionApiExt} from "karavan-core/lib/api/CamelDefinitionApiExt"; import {CamelUtil} from "karavan-core/lib/api/CamelUtil"; @@ -30,6 +30,7 @@ interface Props { property: PropertyMeta, value?: CamelElement, onPropertyUpdate?: (fieldId: string, value: CamelElement) => void + integration: Integration, } interface State { @@ -74,6 +75,7 @@ export class ObjectField extends React.Component<Props, State> { <div> {value && CamelDefinitionApiExt.getElementProperties(value.dslName).map((property: PropertyMeta) => <DslPropertyField key={property.name} + integration={this.props.integration} property={property} element={value} value={value ? (value as any)[property.name] : undefined} diff --git a/karavan-designer/src/designer/karavan.css b/karavan-designer/src/designer/karavan.css index 4a20c73..e8d812a 100644 --- a/karavan-designer/src/designer/karavan.css +++ b/karavan-designer/src/designer/karavan.css @@ -323,10 +323,10 @@ .karavan .properties .pf-c-select__menu-item { width: 280px; font-size: 15px; - /*white-space: nowrap;*/ - /*overflow: hidden;*/ - /*text-overflow: ellipsis;*/ - /*line-height: 12px;*/ +} + +.karavan .properties .pf-c-select__menu-item-description { + overflow-wrap: anywhere; } .karavan .properties .number { diff --git a/karavan-designer/src/designer/route/DslProperties.tsx b/karavan-designer/src/designer/route/DslProperties.tsx index 86f4a1e..c7fb57a 100644 --- a/karavan-designer/src/designer/route/DslProperties.tsx +++ b/karavan-designer/src/designer/route/DslProperties.tsx @@ -140,6 +140,7 @@ export class DslProperties extends React.Component<Props, State> { {this.state.step && this.getComponentHeader()} {this.state.step && !['MarshalDefinition', 'UnmarshalDefinition'].includes(this.state.step.dslName) && this.getProps().map((property: PropertyMeta) => <DslPropertyField key={property.name} + integration={this.props.integration} property={property} element={this.state.step} value={this.state.step ? (this.state.step as any)[property.name] : undefined} @@ -150,6 +151,7 @@ export class DslProperties extends React.Component<Props, State> { )} {this.state.step && ['MarshalDefinition', 'UnmarshalDefinition'].includes(this.state.step.dslName) && <DataFormatField + integration={this.props.integration} dslName={this.state.step.dslName} value={this.state.step} onDataFormatChange={this.dataFormatChanged} /> diff --git a/karavan-designer/src/designer/utils/CamelUi.ts b/karavan-designer/src/designer/utils/CamelUi.ts index 37b7eac..341b76b 100644 --- a/karavan-designer/src/designer/utils/CamelUi.ts +++ b/karavan-designer/src/designer/utils/CamelUi.ts @@ -22,8 +22,8 @@ import {ComponentProperty} from "karavan-core/lib/model/ComponentModels"; import {CamelMetadataApi} from "karavan-core/lib/model/CamelMetadata"; import {CamelUtil} from "karavan-core/lib/api/CamelUtil"; import {CamelDefinitionApiExt} from "karavan-core/lib/api/CamelDefinitionApiExt"; -import {CamelElement, KameletDefinition, RouteDefinition} from "karavan-core/lib/model/CamelDefinition"; -import {Bean, Beans, Integration} from "karavan-core/src/core/model/CamelDefinition"; +import {CamelElement, KameletDefinition, NamedBeanDefinition, RouteDefinition} from "karavan-core/lib/model/CamelDefinition"; +import {Integration} from "karavan-core/src/core/model/CamelDefinition"; const StepElements: string[] = [ "AggregateDefinition", @@ -376,8 +376,8 @@ export class CamelUi { return result; } - static getBeans = (integration: Integration): Bean[] => { - const result: Bean[] = []; + static getBeans = (integration: Integration): NamedBeanDefinition[] => { + const result: NamedBeanDefinition[] = []; const beans = integration.spec.flows?.filter((e: any) => e.dslName === 'Beans'); if (beans && beans.length > 0 && beans[0].beans) { result.push(...beans[0].beans); diff --git a/karavan-generator/src/main/resources/CamelDefinition.header.ts b/karavan-generator/src/main/resources/CamelDefinition.header.ts index ebda5ea..e10095a 100644 --- a/karavan-generator/src/main/resources/CamelDefinition.header.ts +++ b/karavan-generator/src/main/resources/CamelDefinition.header.ts @@ -62,17 +62,6 @@ export class Beans extends CamelElement { } } -export class Bean extends CamelElement { - name: string = '' - type: string = '' - properties: any - - public constructor(init?: Partial<Bean>) { - super("Bean") - Object.assign(this, init); - } -} - export class CamelElementMeta { step?: CamelElement parentUuid?: string