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

defaultValue for configurable-enum dropdowns #2273

Closed
sleidig opened this issue Mar 1, 2024 · 4 comments · Fixed by #2841
Closed

defaultValue for configurable-enum dropdowns #2273

sleidig opened this issue Mar 1, 2024 · 4 comments · Fixed by #2841
Assignees
Labels
Client: by X Client: _codo released on @master managed by CI (semantic-release) released managed by CI (semantic-release)

Comments

@sleidig
Copy link
Member

sleidig commented Mar 1, 2024

In the Entity Schema we can set a defaultValue for an attribute/field. However, this currently does not work for configurable-enum dataType, because values for that are transformed in contrast to simple string dataType.

For public forms we do support this:

this.prefilled = this.entitySchemaService.transformDatabaseToEntityFormat(
this.formConfig.prefilled,
this.entityType.schema,
);

Probably this approach can be used to improve the implementation of the default value assignment:

private getDefaultValue<T>(schema: EntitySchemaField) {

@github-project-automation github-project-automation bot moved this to Triage / Analysis in All Tasks & Issues Mar 1, 2024
@sleidig sleidig moved this from Triage / Analysis to Todo (ready for work) in All Tasks & Issues Feb 5, 2025
@sleidig sleidig moved this from Todo (ready for work) to Planned (current "sprint") in All Tasks & Issues Feb 5, 2025
@Abhinegi2 Abhinegi2 moved this from Planned (current "sprint") to In Progress in All Tasks & Issues Feb 5, 2025
@Abhinegi2
Copy link
Contributor

As discussed in our technical call regarding this issue, my approach will be:

  1. Use the ID in the defaultValueConfig for configurableEnum (instead of relying on the label).
  2. Add a new method in EntitySchemaService to transform or retrieve the configurableEnum object from the given ID.
  3. Integrate this method into DefaultValueService, within the handleStaticMode method.
  4. Write test cases for this implementation.

Let me know if you have any feedback or suggestions.

@sleidig
Copy link
Member Author

sleidig commented Feb 5, 2025

@Abhinegi2 , you shouldn't have to implement a new method in EntitySchemaService but rather the valueToEntityForm() method should do that already if called with the relevant parameters:

@Abhinegi2 Abhinegi2 moved this from In Progress to Technical Review in All Tasks & Issues Feb 6, 2025
@sleidig sleidig moved this from Technical Review to In Progress in All Tasks & Issues Feb 6, 2025
@Abhinegi2 Abhinegi2 moved this from In Progress to Functional Review in All Tasks & Issues Feb 7, 2025
@Abhinegi2 Abhinegi2 moved this from Functional Review to Technical Review in All Tasks & Issues Feb 7, 2025
@sleidig sleidig moved this from Technical Review to Done in All Tasks & Issues Feb 7, 2025
@sleidig sleidig closed this as completed in 022af59 Feb 7, 2025
@aam-digital-ci
Copy link
Collaborator

🎉 This issue has been resolved in version 3.46.2-master.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@aam-digital-ci aam-digital-ci added the released on @master managed by CI (semantic-release) label Feb 7, 2025
@aam-digital-ci
Copy link
Collaborator

🎉 This issue has been resolved in version 3.46.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@aam-digital-ci aam-digital-ci added the released managed by CI (semantic-release) label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client: by X Client: _codo released on @master managed by CI (semantic-release) released managed by CI (semantic-release)
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants