-
Notifications
You must be signed in to change notification settings - Fork 70
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
v4/ Add Config tools for AttachmentList #12250
Conversation
…pes that is datamodel)
Codecov ReportAttention: Patch coverage is
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 ☔ View full report in Codecov by Sentry. |
...c/components/config/componentSpecificContent/AttachmentList/AttachmentListComponent.test.tsx
Fixed
Show fixed
Hide fixed
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.
Nice work! 🙂 I tested locally and it seems to work as expected. I just encountered some issues when I tried to add/edit/delete selected data types.
An error occurs when I edit a selected component id
error1.mov
An error occurs when I click the current task checkbox and then click an item
error2.mov
The list is not updating when adding or deleting a new data type
adding.mov
deleting.mov
...c/components/config/componentSpecificContent/AttachmentList/AttachmentListInternalFormat.tsx
Show resolved
Hide resolved
… --> if selected data type is deleted or edited
…immidiately when an attachment component is deleted
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.
Nice work! 🚀
...itor/src/components/config/componentSpecificContent/AttachmentList/AttachmentListContent.tsx
Outdated
Show resolved
Hide resolved
Code changes have been approved.
* remove includePdf property * init attachmentList + display all datatypes in combobox (minus dataTypes that is datamodel) * filter added * Add some texts and cover some scenarios * include all attachments, all attach (exl. pdf), and sort them + description update * added behaviour when special variants is used + more * attachmentList functions as desired now * Refactor attachmentList + Content, and add pending spinner * remove unused file * update type * init tests for attachmentListComponent * added unit tests, but need to add some more and clean up the code * unit tests completed! * unit test - completed v2 * Add spinner on higher lvl * update code after ux feedback * update tests * other updates * cover some tests * naming * cover more lines * naming v2 * cover the uncovered partial lines * one last adjustment + remove comments * move function removeItemByValue to lib * change text * changes after feedback - next step implement indeterminate * Merge branch 'main' into update-attachmentList-config-v4 * small fix * remove console.log from App.tsx * implement indeterminate checkbox + change logic of incoming and outcoming data * assign state on currentTask to avoid saving to backend when no attachments/pdf selected * some cleanup * refactor outgoing data logic * update component and content logic + refactor * update onChangeTask - need to use an updated list of attachments * add unit tests for external format * add tests when converting to internal and external format * update tests on converting internal external * Refactor highest level to only handle incoming and outgoing data * second level -> attachmentListInternalFormat * Lvl 3 - internal format combobox * Updated attachmentListUtils * AttachmentListUtils - update naming + cleanup * small change in naming * Updated arrayUtils * fix validation function + add tests for validation * update ArrayUtils.intersection with tests and more use of it * renaming and get rid of the last bug! * temperoray status on attachmentListComponent tests before removing the once that are unecessary * check test coverage * try to check coverage * 3th attempt * Update unit tests * update unit tests * add spinner when data is fetching + tests * Some cleanup * renaming convert functions * update unit tests to use it.each format instead * test driven dev - update external and internal convert functions to have the same inputs/outputs * add fieldset wrapper * Fix converting unit tests after feedback * Updated convert functions, validation function + small adjustments in tests * Refactor react logic to handle the updated convert functions * remove console.log * Fix: call OnChange when onChangeTask is called :D * add types * Update component unit tests * move convert functions in separate files + own type file * small adjustments in unit tests * small changes * convert functions - split to two files and their own tests files * updated convertToInternalFunction * renaming validation function * refactor attachmentList: -Component, -Content, -InternalFormat files * simplify convertToExternalFormat function * rename file * rename file back * rename files lowercase * reuse function extractCurrentAvailableAttachments * solve a case when convert to internal format and only pdf is selected * small adjustment in unit test * fix breaking changes after merge with main * update naming mockStore after merge with main * fix - make sure that selected datatypes exists in available datatypes --> if selected data type is deleted or edited * add useEffect * Make sure initial selected values in combobox is displayed correctly immidiately when an attachment component is deleted * removal of key index * remove index*
Description (updated)
This PR enables the configuration of the
AttachmentList
v4. It consists of adataTypeIds
property, an array defining data types for displaying attachments, and has various combinations:["ref-data-as-pdf"]
- for displaying PDFs containing overall app input.[ ] or undefined
- default, displays all attachments except PDFs.["include-all"]
- similar to 3, but includes PDFs.["current-task"]
.Implemented in Studio for various configurations:
Operates with two data structures:
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.dataInternalFormat
): Studio data used in the overall code.Source: https://docs.altinn.studio/community/changelog/app-frontend/v4/#attachmentlist-config-changes