-
Notifications
You must be signed in to change notification settings - Fork 30
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
Support multiple datamodels in the same task #2108
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…fig for all data types
…edOptionIndex and avoiding waitUntilSaved
…s before proceeding
olemartinorg
approved these changes
Sep 5, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🫶
There's a few TODOs left in the code, but I'm thinking these can be left in there for now, and cleaned up at some point later.
# Conflicts: # src/features/datamodel/useBindingSchema.tsx # src/features/form/layout/LayoutsContext.tsx
…le-datamodels # Conflicts: # src/layout/Summary2/SummaryComponent2/SummaryComponent2.test.tsx
…is forwards-compatible with subforms, and saves on network requests
# Conflicts: # src/features/datamodel/useBindingSchema.tsx # src/features/form/layout/LayoutsContext.tsx
…put type was broken (had implicit anys). Fixing this fixes the broken tests.
…is is now re-rendered when we update the query cache)
# Conflicts: # src/layout/List/index.tsx # test/e2e/integration/frontend-test/dynamics.ts
Quality Gate passedIssues Measures |
19 tasks
19 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds support for multiple data models in the same process task.
Configuration
This should be fully backwards compatible, and previously there was only one data model for a task as defined in
layout-sets.json
; I will refer to this model as the "default" data model, as this will always get loaded into the form, and will be used when refering to form data fields without explicitly specifying which data model to use. No changes tolayout-sets.json
are necessary to use multiple data models. In fact, having the "default" data model defined there is still requried due to some implementation specific reasons. This may not be required in the near future, but that depends on if we can do it without introducing breaking changes for existing apps.To refer to other data models than the "default" one you need to specify which one explicitly in the layout files:
Data model bindings:
Expressions:
Text resources works the same way as before, you could already refer to any data model there, the only difference now is that if you have multiple models that are editable, text resources refering to these models will now update as the data changes.
The app will automatically load any data models that are referenced in the layout files.
Note:
dataModel
-expressions are also checked for references. However, since we cannot actually run expressions before fetching data models, we can only detect data types that are referenced with a raw string. I.e. if you use an expression to set thedataType
parameter in thedataModel
expression, we cannot determine what data model to fetch and will log a warning.Deprecated properties
Some existing component properties were not possible to extend to support multiple datamodels due to the way they were structured. Some of these properties now have replacements that should be just as good and also supports multiple data models. In these cases the old properties are now marked as deprecated, meaning that they will still work exactly like before, but we intend to remove them in a future major release. The properties now marked as deprecated are the following:
mapping
-property for options-based components:RadioButtons
Likert
FileUploadWithTag
Checkboxes
MultipleSelect
Dropdown
mapping
-property forList
componentbindingToShowInSummary
-property forList
componentThe
mapping
-property can be replaced with thequeryParameters
-property for all of the above, which has now been extended to support expressions so that you can reference the data model there instead. And since thedataModel
andcomponent
expressions support multiple data models,queryParameters
does too.The
bindingToShowInSummary
-property forList
can be replaced with thesummaryBinding
-property. The difference here is that instead of specifying the datamodel path, you specify one of the binding names fromdataModelBindings
. You could not specify a data model path that was not in theList
component'sdataModelBindings
inbindingToShowInSummary
anyway, so no functionality is lost.Features that currently do not support multiple data models
mapping
-property for thePaymentDetails
only works with the "default" data model, and is not deprecated because there is currently no replacement that maintains the desired functionality that also supports multiple data models. Handle updating PaymentDetails components orderlines without using deprecated "Mapping" #2102mapping
-property for theInstantiationButton
component. Create a feature request if you need support for multiple data models for instantiation with prefill.RemoveHiddenData
,RequiredValidation
, andExpressionValidation
. Layout & Expression changes due to supporting multiple data models app-lib-dotnet#600Other
Also fixes #2091, as any data model that is
locked
(already submitted in a previous task) will be designated readOnly. This entails that these models will not be validated, and writing to them will not work and will log an error to dev tools.Related Issue(s)
Verification/QA
kind/*
label to this PR for proper release notes grouping