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

Update data model selection in component config #12949

Merged
merged 53 commits into from
Jul 16, 2024

Conversation

lassopicasso
Copy link
Contributor

@lassopicasso lassopicasso commented Jun 12, 2024

Description

This PR introduces support for two formats of data model binding in config:

  1. Old Format: The data model binding is a string, allowing only the selection of the data model field.
  2. New Format: The data model binding is an object with properties dataType and field.

For now, the new format is behind a feature flag, multipleDataModelsPerTask. Once this flag is removed, changes to data model bindings will always be saved in the new format.

With the feature flag enabled, users can select both the data model and the specific property of the data model bindings in the configuration of the selected component.

Additionally, validation has been added to handle cases where a data model or a data model field binding no longer exists. In both cases, the data model field will fall back to a dummy option with an empty string. If the data model itself no longer exists, it will fall back to the default data model.

Refactoring

  • Split up the tests for editDataModelBindings to align the tests closer to the actual files being tested.
  • Restructured the code related to the parent editDataModelBinding.

Additional

Added/updated unit tests and playwright tests

Note

A new file, SelectDataFieldBinding.tsx, has been created for logic related to data field binding. This decision was made because the existing SelectDataFieldComponent file was difficult to work with due to its linkage to deprecated "rule for calculations" code. The existing file is expected to be removed in issue #13027 or later on.

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

@github-actions github-actions bot added area/process Area: Related to app process (e.g. signing, receipt, fill inn, payment, etc). area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. solution/studio/designer Issues related to the Altinn Studio Designer solution. labels Jun 12, 2024
@github-actions github-actions bot added the quality/testing Tests that are missing, needs to be created or could be improved. label Jul 4, 2024
@lassopicasso lassopicasso added area/data-modeling Area: Related to data models - e.g. create, edit, use data models. and removed area/process Area: Related to app process (e.g. signing, receipt, fill inn, payment, etc). labels Jul 8, 2024
@lassopicasso lassopicasso marked this pull request as ready for review July 8, 2024 16:59
Copy link
Contributor

@standeren standeren left a comment

Choose a reason for hiding this comment

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

Amazing work here 🥳
Just som small things for you to consider, and also a small css fix;
Some spacing between the buttons are missing 🙈
Skjermbilde 2024-07-15 kl  10 25 34

@lassopicasso lassopicasso requested a review from standeren July 15, 2024 13:16
Copy link
Contributor

@standeren standeren 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 🎉

@lassopicasso lassopicasso merged commit f5c3598 into main Jul 16, 2024
8 of 9 checks passed
@lassopicasso lassopicasso deleted the update-data-model-selection-in-component-config branch July 16, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/data-modeling Area: Related to data models - e.g. create, edit, use data models. area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. quality/testing Tests that are missing, needs to be created or could be improved. solution/studio/designer Issues related to the Altinn Studio Designer solution.
Projects
None yet
3 participants