altinn-studio
altinn-studio copied to clipboard
v4/ Add Config tools for AttachmentList
Description (updated)
This PR enables the configuration of the AttachmentList
v4. It consists of a dataTypeIds
property, an array defining data types for displaying attachments, and has various combinations:
- Specific data types - user-selected types for displaying attachments.
- System-generated PDFs
["ref-data-as-pdf"]
- for displaying PDFs containing overall app input. - All data types (excluding PDFs)
[ ] or undefined
- default, displays all attachments except PDFs. - All data types (including PDFs)
["include-all"]
- similar to 3, but includes PDFs. - App developers can also choose between two process task options:
- Default: Include data types from all process tasks.
- Option: Include only data types from the current process task
["current-task"]
.
Implemented in Studio for various configurations:
- Switch 1: Current task (on) and all tasks (off - default).
- Switch 2: Include system-generated PDFs (on) and exclude them (off - default).
- Indeterminate checkbox: When checked, all available attachments in the combobox are selected.
- Combobox multiple: All available attachments.
Operates with two data structures:
-
External data (
dataExternalFormat
): Studio data saved to the backend. The functionselectionIsValid
prevents saving if no data types or reserved data type (PDF) are selected, displaying an error message. -
Internal data (
dataInternalFormat
): Studio data used in the overall code.
Source: https://docs.altinn.studio/community/changelog/app-frontend/v4/#attachmentlist-config-changes
Codecov Report
Attention: Patch coverage is 98.12500%
with 3 lines
in your changes are missing coverage. Please review.
Project coverage is 90.18%. Comparing base (
e07f414
) to head (2395a3b
).
Additional details and impacted files
@@ Coverage Diff @@
## main #12250 +/- ##
==========================================
+ Coverage 90.11% 90.18% +0.07%
==========================================
Files 1289 1296 +7
Lines 18410 18547 +137
Branches 2242 2259 +17
==========================================
+ Hits 16590 16727 +137
+ Misses 1561 1560 -1
- Partials 259 260 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Description is updated ⬆️
Konverteringsfunksjonene er nå oppdatert og har tilpasset React-komponentene.
Møtte på en utfordring med onChangeTask
, som førte til at jeg la til en funksjon handleDataTypesWhenCurrentTaskChange
for å unngå krasj. Dette var nødvendig for å håndtere et case når currentTask
gikk fra false til true mens alle vedlegg var valgt. Den oppdaterte ikke antall vedlegg valgt med bakgrunn i at det kun er nåværende oppgave som nå gjelder.
Prøvde å håndtere denne logikken når dataen var på vei ut i convertInternalToExternalFormat
, men må også oppdatere staten ellers ville combobox
føre til at det krasjer. Jeg funderer på om det kan ha noe med at det ikke rekkes å rerendres før onValueChange
i combobox
blir trigget. Er et issue på det i designsystemet; https://github.com/digdir/designsystemet/issues/1640