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

Subform pdf summary #2447

Merged
merged 31 commits into from
Sep 23, 2024
Merged

Subform pdf summary #2447

merged 31 commits into from
Sep 23, 2024

Conversation

adamhaeger
Copy link
Contributor

@adamhaeger adamhaeger commented Sep 13, 2024

Description

Related Issue(s)

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

src/features/pdf/PdfView2.tsx Fixed Show fixed Hide fixed
src/features/pdf/PdfView2.tsx Fixed Show fixed Hide fixed
src/features/pdf/PdfView2.tsx Fixed Show fixed Hide fixed
src/features/pdf/PdfView2.tsx Fixed Show fixed Hide fixed
src/features/pdf/PdfView2.tsx Fixed Show fixed Hide fixed
src/core/loading/Loader.tsx Fixed Show fixed Hide fixed
src/utils/layout/NodesContext.tsx Fixed Show fixed Hide fixed
src/utils/layout/NodesContext.tsx Fixed Show fixed Hide fixed
content = textLookup ? textLookup : defaultValue;
}

if (typeof content === 'object' || content === undefined || content === null) {

Check warning

Code scanning / CodeQL

Comparison between inconvertible types Warning

Variable 'content' cannot be of type null, but it is compared to
an expression
of type null.
@adamhaeger adamhaeger marked this pull request as ready for review September 18, 2024 08:16
Copy link
Contributor

@danielskovli danielskovli left a comment

Choose a reason for hiding this comment

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

Looks good to me! Not sure why the non-subform summary changes are in here, but the more the marrier 👍

src/features/formData/useFormDataQuery.tsx Outdated Show resolved Hide resolved
<PdfWrapping>
<PlainPage pageKey={pdfLayoutName} />
</PdfWrapping>
<DataLoaderStoreInit>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! I didn't really know what this branch of the PdfView2 component was used for, but wrapping this in the DataLoaderStoreInit seems like the right choice 🙂

Copy link

sonarcloud bot commented Sep 23, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
36.4% Coverage on New Code (required ≥ 65%)
7.5% Duplication on New Code (required ≤ 3%)
21.21% Condition Coverage on New Code (required ≥ 65%)

See analysis details on SonarCloud

@adamhaeger adamhaeger merged commit 82cab58 into feature/subform Sep 23, 2024
8 of 9 checks passed
@adamhaeger adamhaeger deleted the subform-pdf-summary branch September 23, 2024 12:48
bjosttveit added a commit that referenced this pull request Oct 3, 2024
* Feat/subform/url (#2206)

* feat: initial sub form scaffold

* feat: add subform and config.ts

* feat: scaffold for sub form

* Exposes `useNavigationParams.isSubFormPage` bool, English error msg

* Mostly functional "exit sub-form" method

* Default text and style for CustomButton with SubFormAction bindings

* Changes default button text from `add` to `done`

* Improves sub-form table layout

---------

Co-authored-by: Daniel Skovli <[email protected]>

* Feat/subform 08 07 ds (#2223)

* add queries

* add mutations for sub forms

* Rough implementation of add/remove functionality

* use app mutations instead of queries directly

* add error handling

* use empty object

---------

Co-authored-by: Daniel Skovli <[email protected]>

* Feature/subform jh.lek (#2225)

* use changeData instead of refetch

* add language files

* rm todos

* Makes `textResourceBindings.addButton` self contained, instead of concatenated with some standard text

* Adds edit button, updates error messages, simplifies error checking

* Implements dynamic headers/columns in subform table component

* Default table header+column if configuration omitted

* Disables table row buttons during delete process

* Disables `add` button during add process

* Removes incorrect TODO item

* Redefines SubFormAction as ClientAction

* Just return the result, makes more sense for the caller

* Only offer data query for sub-form table cells, static content doesn't make sense

* Trim trailing slash when calculating current page index

* Release UI effects when add/remove has finished/failed, navigate into newly created subform data instance

* Additional CustomButton props

* Marks new CustomButton props as optional

* Hides table header while there's no data to display

* Handles DataController reponse for MaxCount reached

* Sub-form min/max validations

* Updates validation wording and formatting

* Disallows FileUpload component in sub-forms

* Adds validation hooks to CustomButton actions

* Very early WIP summary component

* WIP summary

* Bugfixes

* Summary spacing

* Default value for cellContent

* Uses internal label wrapper and adjusts summary spacing

* Reuses data query code

* Lifts `taskStoreContext` out from `Summary2` and generalises implementaion

* Implements ComponentStructureWrapper to fix validation-not-displayed bug

* Splits Summary2StoreContext out to simple store only holding summary-node reference

* Fixes #2320

* Post-merge tweaks

* Removes DebugRouter

* Fixes CustomButton default behaviour for SubForm

* Changes SubForm to category: Form, fixes validation provider issue

* Housekeeping

* Disallows recursive sub-forms

* Add subform identifier in applogic (#2355)

* intermediate solution for assessing subform data type

* add subformvalidator

* add subform test

* cleanup

* rm user input validation as configuration error is handled

* Resolves TODO: removes unnecessary code

https://digdir.slack.com/archives/C076T2293CM/p1724928772871299

* Updates CustomButton->resetScrollPosition implementation

* Consolidates `getDataModelUrl` methods

* Enforces `subform` spelling over previous `sub-form`

* Enables focus back on the SubFormComponent after exiting a subform

* Bugfix: allow `exitSubForm` to circumvent `resetReturnToView`

Eg. preserve "back to summary" context after having clicked an edit button from a summary page

* Converts `DataQueryWithDefaultValue` to a React component

* Housekeeping: Replaces `sub_form` language keys with `subform`

* Improved error handling

* Move data model binding out of the SubForm component definition over to layout-sets.json

* translation work

* add layout set disciminated union, type guards (#2381)

* add layout set disciminated union, type guards

* fix todo

* update typeguard logic do not rely on tasks array being populated

* Adding data model type name to error message

* Not rendering out anything when lookup in subform finds incompatible values

* Adds necessary, removes unnecessary `key` props

* Fixes query exit subform param bugs

* Removing unused class

* Fixing typo

* Fixes subform expression test

* Avoiding using a hook in non-react code (this was warned against in the console)

* Reverts getDataModelUrl consolidation

* Enforces spelling `Subform` instead of `SubForm`

* rename files and folders

* Null checks before accessing `layoutset.tasks`

* Fixes `layoutSetIsDefault` check

* Tweaks `InvalidSubformLayoutError` page

* Bugfix: subform routing

* Typeguarding after merge

* Making the tasks array optional again

* fix import path after merge

* Hopefully fixing support for multiple subforms in DataModelsProvider.tsx

* Fixing loading of stale form data (happened because setInitialData was hindered). This should also work without unneccessary re-renders due to over-selection.

* Updates SubformValidator. Adds language support and checks for `disallowUserCreate` property

* add subform cypress tests (#2423)

* add subform cypress tests

* subform test app changed to require auth level 1

* add more tests

* Removes `validateSubform` action

* Subform pdf summary (#2447)

* Basic Summary2 component support without edit buttons (#2459)

---------

Co-authored-by: Daniel Skovli <[email protected]>
Co-authored-by: Ole Martin Handeland <[email protected]>

* WIP summary/pdf layout improvements

* Fixes empty-summary styling for Subform and Attachment

* Removes debug

woops

* Summary spacing

* Adds page-break before each subform in print context

* Removes (presumed) unnecessary TaskStoreProvider

* Avoids re-creating stores on each render

* Revert "Removes (presumed) unnecessary TaskStoreProvider"

This reverts commit 92a2f70.

* remove isFormDataLoading and clean up data element override

* Validate subform data in main form (#2479)

* basic subform validation

* set validation visibility when opening a subform marked with errors

* added subform validation test case

* trying a slightly more hacky approach to synchronizing AppRoutingContext with react-router-dom

* trying a slightly less hacky approach that avoids using flushSync

* back to basics

* finally some progess

* fix broken navigation and apparently inconsistent taskErrors??

* .

* Fixes after merge from main

* Removing undefined class

* fix type

* show subform rows with validation errors in summary

* fix code-ql warnings

---------

Co-authored-by: Daniel Skovli <[email protected]>
Co-authored-by: Ole Martin Handeland <[email protected]>
Co-authored-by: adamhaeger <[email protected]>
Co-authored-by: Bjørnar Østtveit <[email protected]>
Co-authored-by: Bjørnar Østtveit <[email protected]>
bjosttveit added a commit that referenced this pull request Oct 4, 2024
* Feat/subform/url (#2206)

* feat: initial sub form scaffold

* feat: add subform and config.ts

* feat: scaffold for sub form

* Exposes `useNavigationParams.isSubFormPage` bool, English error msg

* Mostly functional "exit sub-form" method

* Default text and style for CustomButton with SubFormAction bindings

* Changes default button text from `add` to `done`

* Improves sub-form table layout

---------

Co-authored-by: Daniel Skovli <[email protected]>

* Feat/subform 08 07 ds (#2223)

* add queries

* add mutations for sub forms

* Rough implementation of add/remove functionality

* use app mutations instead of queries directly

* add error handling

* use empty object

---------

Co-authored-by: Daniel Skovli <[email protected]>

* Feature/subform jh.lek (#2225)

* use changeData instead of refetch

* add language files

* rm todos

* Makes `textResourceBindings.addButton` self contained, instead of concatenated with some standard text

* Adds edit button, updates error messages, simplifies error checking

* Implements dynamic headers/columns in subform table component

* Default table header+column if configuration omitted

* Disables table row buttons during delete process

* Disables `add` button during add process

* Removes incorrect TODO item

* Redefines SubFormAction as ClientAction

* Just return the result, makes more sense for the caller

* Only offer data query for sub-form table cells, static content doesn't make sense

* Trim trailing slash when calculating current page index

* Release UI effects when add/remove has finished/failed, navigate into newly created subform data instance

* Additional CustomButton props

* Marks new CustomButton props as optional

* Hides table header while there's no data to display

* Handles DataController reponse for MaxCount reached

* Sub-form min/max validations

* Updates validation wording and formatting

* Disallows FileUpload component in sub-forms

* Adds validation hooks to CustomButton actions

* Very early WIP summary component

* WIP summary

* Bugfixes

* Summary spacing

* Default value for cellContent

* Uses internal label wrapper and adjusts summary spacing

* Reuses data query code

* Lifts `taskStoreContext` out from `Summary2` and generalises implementaion

* Implements ComponentStructureWrapper to fix validation-not-displayed bug

* Splits Summary2StoreContext out to simple store only holding summary-node reference

* Fixes #2320

* Post-merge tweaks

* Removes DebugRouter

* Fixes CustomButton default behaviour for SubForm

* Changes SubForm to category: Form, fixes validation provider issue

* Housekeeping

* Disallows recursive sub-forms

* Add subform identifier in applogic (#2355)

* intermediate solution for assessing subform data type

* add subformvalidator

* add subform test

* cleanup

* rm user input validation as configuration error is handled

* Resolves TODO: removes unnecessary code

https://digdir.slack.com/archives/C076T2293CM/p1724928772871299

* Updates CustomButton->resetScrollPosition implementation

* Consolidates `getDataModelUrl` methods

* Enforces `subform` spelling over previous `sub-form`

* Enables focus back on the SubFormComponent after exiting a subform

* Bugfix: allow `exitSubForm` to circumvent `resetReturnToView`

Eg. preserve "back to summary" context after having clicked an edit button from a summary page

* Converts `DataQueryWithDefaultValue` to a React component

* Housekeeping: Replaces `sub_form` language keys with `subform`

* Improved error handling

* Move data model binding out of the SubForm component definition over to layout-sets.json

* translation work

* add layout set disciminated union, type guards (#2381)

* add layout set disciminated union, type guards

* fix todo

* update typeguard logic do not rely on tasks array being populated

* Adding data model type name to error message

* Not rendering out anything when lookup in subform finds incompatible values

* Adds necessary, removes unnecessary `key` props

* Fixes query exit subform param bugs

* Removing unused class

* Fixing typo

* Fixes subform expression test

* Avoiding using a hook in non-react code (this was warned against in the console)

* Reverts getDataModelUrl consolidation

* Enforces spelling `Subform` instead of `SubForm`

* rename files and folders

* Null checks before accessing `layoutset.tasks`

* Fixes `layoutSetIsDefault` check

* Tweaks `InvalidSubformLayoutError` page

* Bugfix: subform routing

* Typeguarding after merge

* Making the tasks array optional again

* fix import path after merge

* Hopefully fixing support for multiple subforms in DataModelsProvider.tsx

* Fixing loading of stale form data (happened because setInitialData was hindered). This should also work without unneccessary re-renders due to over-selection.

* Updates SubformValidator. Adds language support and checks for `disallowUserCreate` property

* add subform cypress tests (#2423)

* add subform cypress tests

* subform test app changed to require auth level 1

* add more tests

* Removes `validateSubform` action

* Subform pdf summary (#2447)

* Basic Summary2 component support without edit buttons (#2459)

---------

Co-authored-by: Daniel Skovli <[email protected]>
Co-authored-by: Ole Martin Handeland <[email protected]>

* WIP summary/pdf layout improvements

* Fixes empty-summary styling for Subform and Attachment

* Removes debug

woops

* Summary spacing

* Adds page-break before each subform in print context

* Removes (presumed) unnecessary TaskStoreProvider

* Avoids re-creating stores on each render

* Revert "Removes (presumed) unnecessary TaskStoreProvider"

This reverts commit 92a2f70.

* remove isFormDataLoading and clean up data element override

* Validate subform data in main form (#2479)

* basic subform validation

* set validation visibility when opening a subform marked with errors

* added subform validation test case

* trying a slightly more hacky approach to synchronizing AppRoutingContext with react-router-dom

* trying a slightly less hacky approach that avoids using flushSync

* back to basics

* finally some progess

* fix broken navigation and apparently inconsistent taskErrors??

* .

* Fixes after merge from main

* Removing undefined class

* fix type

* show subform rows with validation errors in summary

* fix visibility broken by perf-PR, use noIncrementalUpdates, and improve showAllErrors

* validate onlyIncremental on initial validation

* less hacky method of refetching validations

* clean up in taskErrors

* fix performance issues with useTaskStore causing infinite loops because the selector returned new objects every time

* added unit tests for regression in performance PR

* (hopefully) got rid of waitForAnimationFrames when waiting for validations to process, these were causing problems in unit tests

* hopefully fix validations from process/next for old apps blocking submit

* make sure processed last gets updated regardless of deepEqual

* make sure showAllErrors is visible on components and not just the error report

* fix code-ql warnings

* remove snake_case

---------

Co-authored-by: Johannes Haukland <[email protected]>
Co-authored-by: Daniel Skovli <[email protected]>
Co-authored-by: HauklandJ <[email protected]>
Co-authored-by: Ole Martin Handeland <[email protected]>
Co-authored-by: adamhaeger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants