Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

others(element-template-generator): 902 template generator generate dropdown choices automatically #3982

Conversation

mathias-vandaele
Copy link
Collaborator

Description

It brings an easy way of creating dropdown using the @elementTemplate annotation

I tried to follow the way @johnBgood wanted it here

Related issues

closes #https://github.com/camunda/team-connectors/issues/902

Checklist

  • PR has a milestone or the no milestone label.

@mathias-vandaele mathias-vandaele requested a review from a team as a code owner February 11, 2025 07:52
@mathias-vandaele mathias-vandaele changed the title 902 template generator generate dropdown choices automatically others(element-template-generator): 902 template generator generate dropdown choices automatically Feb 11, 2025
@mathias-vandaele mathias-vandaele self-assigned this Feb 11, 2025
@mathias-vandaele mathias-vandaele added this to the 8.7.0-alpha5 milestone Feb 11, 2025
@mathias-vandaele mathias-vandaele force-pushed the 902-template-generator-generate-dropdownchoices-automatically branch from 5948f2e to da58727 Compare February 11, 2025 07:54
@mathias-vandaele mathias-vandaele force-pushed the 902-template-generator-generate-dropdownchoices-automatically branch 2 times, most recently from 5c80663 to 6fa9461 Compare February 12, 2025 07:11
Comment on lines 30 to 32
String value();

String label();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comments for what these values will be used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do it.

@sbuettner
Btw, as value represents the value as it will be inside the variables, is it really necessary, we could use the Enum value itself, don't you think ?

Copy link
Contributor

@sbuettner sbuettner Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, lets remove the value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mathias-vandaele Maybe we can call the annotation @EnumValue instead of "label" to make it more clear? cc @johnBgood

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might even be DropdownItem{label= "the label", default="true"}. We then have everything in 1 single place

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnBgood I made all the changes. The only issue with managing the default value within the @enumLabel is that it conflicts with the defaultValue inside ElementTemplate.

Do you think we can merge this current version? I removed the value, renamed enumLabel to enumValue, and added this annotation to a couple of connectors.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only issue with managing the default value within the @enumLabel is that it conflicts with the defaultValue inside ElementTemplate.

I don't get this part, but I trust you to make the best decision 👌

@sbuettner
Copy link
Contributor

@mathias-vandaele Would be great if you can migrate 1-2 additional Connectors as well to see whether the implementation leads to the expected results.

@mathias-vandaele mathias-vandaele force-pushed the 902-template-generator-generate-dropdownchoices-automatically branch 3 times, most recently from ada930f to 8d1dec0 Compare February 17, 2025 15:29
sbuettner
sbuettner previously approved these changes Feb 17, 2025
Copy link
Contributor

@sbuettner sbuettner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @mathias-vandaele.

I generally like @johnBgood proposal of calling it DropdownItem. We also have DropdownChoice as well. No hard feelings from my side.

@mathias-vandaele mathias-vandaele force-pushed the 902-template-generator-generate-dropdownchoices-automatically branch from 7a0c374 to 7ae05bf Compare February 18, 2025 08:05
Comment on lines 13 to 19
@JsonEnumDefaultValue
@DropdownItem(label = "PLAIN", order = 0)
PLAIN("text/plain; charset=utf-8"),
@DropdownItem(label = "HTML", order = 1)
HTML("text/html; charset=utf-8"),
@DropdownItem(label = "HTML & Plaintext", order = 2)
MULTIPART("multipart/mixed; charset=utf-8");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets use the order returned by Enum.values() instead of requiring to define it.

@mathias-vandaele mathias-vandaele force-pushed the 902-template-generator-generate-dropdownchoices-automatically branch from 7ae05bf to ed29f06 Compare February 18, 2025 08:59
@mathias-vandaele mathias-vandaele force-pushed the 902-template-generator-generate-dropdownchoices-automatically branch from ed29f06 to c216a8b Compare February 18, 2025 12:29
@mathias-vandaele mathias-vandaele added this pull request to the merge queue Feb 18, 2025
Merged via the queue into main with commit 0db9c33 Feb 18, 2025
13 checks passed
@mathias-vandaele mathias-vandaele deleted the 902-template-generator-generate-dropdownchoices-automatically branch February 18, 2025 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants