KaotoIO / kaoto

The UI of the Kaoto project
https://kaoto.io
Apache License 2.0
35 stars 25 forks source link

Bean component should provide list of available beans in the ref field #1553

Open tplevko opened 3 days ago

tplevko commented 3 days ago

Describe the Bug

Bean component doesn't provide list of available beans in the ref field.

Route used:

- beans:
    - name: myCustomer
      type: com.mycompany.Customer
      scriptLanguage: java
      script: |
        var b = new com.mycompany.CustomerBuilder();
        b.name('Acme').street('Somestreet 42').zip(90210).gold(true);
        return b.build();
- from:
    uri: "timer:yaml"
    parameters:
      period: "5000"
    steps:
      - bean:
          ref: myCustomer
          method: summary
      - log: "${body}"

Steps to Reproduce the Bug or Issue

  1. create route
  2. see the "Bean" component doesn't provide list of available beans in the ref field

Screenshots or Videos

https://github.com/user-attachments/assets/09b4f6c2-05ff-4a18-829a-cf998e6e0b9d

Platform

lordrip commented 2 days ago

I see, in the same way, we're assigning CustomLongTextField for the expression fields, we could do the same for ref fields, by default showing the Beans list. Maybe something like the following could help.

    case String:
      /* catalog preprocessor put 'string' as a type and the javaType as a schema $comment */
      if (comment?.startsWith('class:') || props.name.startsWith('ref')) {
        return BeanReferenceField;