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

fix: add validation to fileupload and fileuploadwithtag when editing component id #13445

Conversation

Jondyr
Copy link
Member

@Jondyr Jondyr commented Aug 29, 2024

Description

Added validation when editing component id for FileUpload and FileUploadWithTag component types in ux-editor. Also moved useAppMetadataQuery to app-shared, to avoid depending on app-development in the ux-editor package.
This should fix both issues linked below.

Related Issue(s)

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 29, 2024
@Jondyr Jondyr force-pushed the fix/check-for-duplicate-datamodel-id-when-renaming-fileupload-components branch from 8649808 to 1511731 Compare September 2, 2024 09:03
@github-actions github-actions bot added the area/process Area: Related to app process (e.g. signing, receipt, fill inn, payment, etc). label Sep 2, 2024
Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 98.96907% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.19%. Comparing base (348b198) to head (bd7a630).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...aEditorWithToolbar/TopToolbar/CreateNewWrapper.tsx 95.23% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13445      +/-   ##
==========================================
+ Coverage   95.17%   95.19%   +0.01%     
==========================================
  Files        1470     1471       +1     
  Lines       20223    20284      +61     
  Branches     2444     2453       +9     
==========================================
+ Hits        19248    19310      +62     
+ Misses        870      869       -1     
  Partials      105      105              

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

@Jondyr Jondyr marked this pull request as ready for review September 2, 2024 12:22
Copy link
Contributor

@mlqn mlqn left a comment

Choose a reason for hiding this comment

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

Great job! 🚀

I think we should also perform this check when creating or uploading a datamodel given that if a FileUpload already uses the name, it will override the FileUpload datatype in the application metadata. Here is an example :

datamodel-name.mov

Jondyr and others added 5 commits September 9, 2024 07:57
@github-actions github-actions bot added the area/data-modeling Area: Related to data models - e.g. create, edit, use data models. label Sep 9, 2024
@Jondyr Jondyr force-pushed the fix/check-for-duplicate-datamodel-id-when-renaming-fileupload-components branch from 22f66cb to feaee36 Compare September 9, 2024 11:55
@Jondyr Jondyr force-pushed the fix/check-for-duplicate-datamodel-id-when-renaming-fileupload-components branch from d28ffbd to 202159d Compare September 9, 2024 12:19
@Jondyr
Copy link
Member Author

Jondyr commented Sep 9, 2024

@mlqn I did some changes based on your feedback. Creating a new datamodel now validates by also checking if the name exists on datatypes in applicationmetadata. I did some refactoring of this popover, making the validation update on change and removing some unnecessary code.

@Jondyr Jondyr requested a review from mlqn September 9, 2024 12:20
Copy link
Contributor

@mlqn mlqn 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! 🚀

@Ildest
Copy link
Contributor

Ildest commented Sep 12, 2024

@Jondyr forslag til ny tekst:

  1. Navnet på datamodellen er ugyldig. Du kan bruke norske store og små bokstaver, tall, understrek, punktum og bindestrek.
  2. Navnet er ugyldig. Du kan bruke tall og store og små bokstaver fra det norske alfabetet, og understrek, punktum og bindestrek. (Her tenker jeg at de vet at de står på datamodellnavn, sli kat det er unødvendig å si, men det må du avgjøre).

Bare ta kontakt på Slack hvis du lurer på noe :-).

Co-authored-by: Gørild Døhl <gorild.dohl@digdir.no>
@Jondyr
Copy link
Member Author

Jondyr commented Sep 12, 2024

@Ildest Bra forslag, tekstnøklene er nå oppdatert 👍

Bilder av tekstene i studio

image
image

@mlqn
Copy link
Contributor

mlqn commented Sep 12, 2024

Jeg kan også nevne at det er flere andre problemer med dette feltet: #13364, men jeg vil foreslå å fikse det senere i en separat sak

Copy link
Contributor

@standeren standeren left a comment

Choose a reason for hiding this comment

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

Tested ok 🫡

@Jondyr Jondyr merged commit 288a5da into main Sep 18, 2024
8 checks passed
@Jondyr Jondyr deleted the fix/check-for-duplicate-datamodel-id-when-renaming-fileupload-components branch September 18, 2024 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/data-modeling Area: Related to data models - e.g. create, edit, use data models. area/process Area: Related to app process (e.g. signing, receipt, fill inn, payment, etc). 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
None yet
4 participants