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

feat(ui-editor): export form definition #13390

Merged
merged 20 commits into from
Sep 4, 2024

Conversation

nkylstad
Copy link
Member

@nkylstad nkylstad commented Aug 19, 2024

Description

  • Created utils methods for exporting a form definition.
    • In practice, this is a collection of the form layouts connected to a layout set. All referenced texts and codelists are inlined.
    • Some additional metadata, like order, is added.
  • Created a new endpoint to return all static codelists for an app
  • Added a button the the layout-sets "header" that triggers an export of the form.
    • This is hidden behind a feature flag.

Ref. discussion in daily, this is a feature that has been requested externally, and we are making it available behind a feature flag for now.

Skjermopptak.2024-08-19.kl.12.23.53.mov

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)

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

@github-actions github-actions bot added 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 Aug 19, 2024
Copy link

codecov bot commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 22 lines in your changes missing coverage. Please review.

Project coverage is 93.68%. Comparing base (b798641) to head (7577a2d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...s/ux-editor/src/components/Elements/ExportForm.tsx 44.00% 14 Missing ⚠️
...ontend/packages/ux-editor/src/utils/exportUtils.ts 90.16% 4 Missing and 2 partials ⚠️
...or/src/components/Elements/LayoutSetsContainer.tsx 66.66% 0 Missing and 1 partial ⚠️
...ux-editor/src/hooks/queries/useOptionListsQuery.ts 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13390      +/-   ##
==========================================
- Coverage   93.75%   93.68%   -0.07%     
==========================================
  Files        1448     1455       +7     
  Lines       20037    20168     +131     
  Branches     2430     2442      +12     
==========================================
+ Hits        18785    18894     +109     
- Misses       1004     1023      +19     
- Partials      248      251       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@framitdavid framitdavid self-requested a review August 23, 2024 06:53
Copy link
Collaborator

@framitdavid framitdavid left a comment

Choose a reason for hiding this comment

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

I reviewed the PR and it's great to see that you've managed to create a format for export—well done! 👏 🚀 I've added some comments and suggestions, but I didn't address every detail. My understanding is that "Forsvaret" will review this feature after merge and make any necessary changes and build this further?

Copy link
Collaborator

@framitdavid framitdavid left a comment

Choose a reason for hiding this comment

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

Nice work! By adding the refactoring you have done, the codebase become even more modular. 👏

@nkylstad
Copy link
Member Author

nkylstad commented Aug 29, 2024

For some reason, a test in SubexpressionValueSelector.test.tsx (it('Lets the user edit the value in edit mode'...) is failing. I've been able to isolate it to the fact that the component GatewayActionSelector, used within SubExpressionValueSelector, uses StudioNativeSelect and not NativeSelect directly from the design system.

Switching to NativeSelect causes the test to pass. Using StudioNativeSelect causes the test to fail.
I have not made any changes to this code, so I have no idea why this test is failing, but on the main branch the test passes just fine, so there must be something in my changes 🤔
@framitdavid any ideas?

UPDATE: Switching to a relative import (since we're in the same lib) over a package import also did the trick, but I don't really understand why my code caused this 🤔

@nkylstad nkylstad removed their assignment Aug 30, 2024
@Aalsaunet
Copy link

@nkylstad Seems like this PR still need some improved code coverage and a more semantic PR title to be mergable. Are you or anybody from your team able to look into this so we could get this one merged?

@nkylstad nkylstad changed the title Feat(ux editor)/export form definition Feat(ui-editor)/export form definition Sep 4, 2024
@nkylstad nkylstad changed the title Feat(ui-editor)/export form definition feat(ui-editor): export form definition Sep 4, 2024
@nkylstad
Copy link
Member Author

nkylstad commented Sep 4, 2024

@nkylstad Seems like this PR still need some improved code coverage and a more semantic PR title to be mergable. Are you or anybody from your team able to look into this so we could get this one merged?

@Aalsaunet We're ok with the code coverage, and PR title is fixed! @framitdavid has tested the change on his machine, and the feature is behind a feature flag. Merging now, and this commit will be deployed tomorrow.

To turn on the feature (with feature flag), add the url param featureFlags=exportForm to the url in the form editor ("Lage").

@nkylstad nkylstad merged commit 1bb09ba into main Sep 4, 2024
14 of 17 checks passed
@nkylstad nkylstad deleted the feat(ux-editor)/export-form-definition branch September 4, 2024 18:20
@Aalsaunet
Copy link

Great! Thank you so much for fixing it @nkylstad ! I'll make sure to test it out and starting looking into XML exports right away 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants