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

JDL should have ability to indicate field to use in UI for foreign key references. #24557

Closed
heilaschaefer opened this issue Dec 14, 2023 · 3 comments

Comments

@heilaschaefer
Copy link

heilaschaefer commented Dec 14, 2023

Overview of the feature request

When generating UI for foreign key references, the UI's use the "id" field for the human select of the setup. This is rarely meaningful. JDL should have a way to indicate which field should be used in this circumstance. current generated code (react style): <option value="" key="0" /> {billingUnits ? billingUnits.map(otherEntity => ( <option value={otherEntity.id} key={otherEntity.id}> {otherEntity.id} </option> )) : null} better code (now switch from "id" to "name" : <option value="" key="0" /> {billingUnits ? billingUnits.map(otherEntity => ( <option value={otherEntity.id} key={otherEntity.id}> {otherEntity.name} </option> )) : null} The idea is that in the JDL the field "name" would be marked somehow as the "human readable" version of the field. Let's be honest, the "id" almost never is useful to a human. Motivation for or Use Case Adding this feature is not perfect. certainly some people might want to use a combination of fields or a function to create the label. But it would make the auto-generated UI more useful to humans. Related issues or PR [x ] Checking this box is mandatory (this is just to show you read everything)

@mshima
Copy link
Member

mshima commented Dec 14, 2023

See the display field at https://www.jhipster.tech/jdl/relationships#syntax

@heilaschaefer
Copy link
Author

AHA! Seemed so obviously needed that I was surprised I could not find it. I may try to submit a documentation PR to make things more clear, first I need to really understand it myself! will close

@heilaschaefer heilaschaefer closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 2023
@mshima
Copy link
Member

mshima commented Dec 14, 2023

@heilaschaefer any contributions is welcome.

@deepu105 deepu105 added this to the 8.2.0 milestone Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants