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: Validation when creating a new data model #14049

Merged

Conversation

ErlingHauan
Copy link
Contributor

@ErlingHauan ErlingHauan commented Nov 13, 2024

Description

  • Added a separate error message for empty name
  • Updated error message when not matching regex
  • Added a validation case for exceeding a max length of 100 characters (this length is up for discussion)
  • Added a validation case for C# reserved keywords
  • Removed and . as valid characters, as the backend does not allow them
  • Fixed bug where it was possible to create any data model name by pressing enter
  • Error message is now cleared when closing and reopening the popover
  • Moved the validation logic into a custom hook

Screenshot

bilde

Solves issues

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)

@ErlingHauan ErlingHauan linked an issue Nov 13, 2024 that may be closed by this pull request
@github-actions github-actions bot added area/data-modeling Area: Related to data models - e.g. create, edit, use data models. solution/studio/designer Issues related to the Altinn Studio Designer solution. frontend labels Nov 13, 2024
@github-actions github-actions bot added the area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. label Nov 13, 2024
Copy link

codecov bot commented Nov 13, 2024

Codecov Report

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

Project coverage is 95.50%. Comparing base (ea8ca6c) to head (a8cdd9a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...r/TopToolbar/CreateNewWrapper/CreateNewWrapper.tsx 97.36% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14049      +/-   ##
==========================================
+ Coverage   95.46%   95.50%   +0.04%     
==========================================
  Files        1806     1811       +5     
  Lines       23553    23579      +26     
  Branches     2731     2733       +2     
==========================================
+ Hits        22485    22520      +35     
+ Misses        813      805       -8     
+ Partials      255      254       -1     

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

@ErlingHauan ErlingHauan changed the title 13364 validation issues when creating a new model fix: Validation when creating a new data model Nov 13, 2024
@ErlingHauan ErlingHauan marked this pull request as ready for review November 14, 2024 08:43
@ErlingHauan ErlingHauan added text/content used for issues that need som text improvements, often by ux team/studio-domain1 labels Nov 14, 2024
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.

Nice work! ⭐
Some feedback only, mainly regarding the tests! 🤗

I also see that we have som inconsistency regarding the text key schema_editor. Looks like it is used a bit all over the solution 🤔 But that will be a different issue to solve!

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.

Will approve this now! Great improvements here! ⭐

I only have one small comment in the file structure. I see that you moved XSDUpload to the same level as TopToolBar, but actually it makes more sense having it in its own folder since the ideal structure would be if all the components used in TopToolBar was placed in its own folders CreateNewWrapper, XSDUpload, SchemaSelect, DeleteWrapper and GenerateModelsButton 😄

@ErlingHauan
Copy link
Contributor Author

Will approve this now! Great improvements here! ⭐

I only have one small comment in the file structure. I see that you moved XSDUpload to the same level as TopToolBar, but actually it makes more sense having it in its own folder since the ideal structure would be if all the components used in TopToolBar was placed in its own folders CreateNewWrapper, XSDUpload, SchemaSelect, DeleteWrapper and GenerateModelsButton 😄

Thanks 😄
Ok, I will fix those folders.

I see you suggested putting utils into features/dataModelling above. What do you think about putting the utils folder into the TopToolbar folder instead? Suggesting this because the validation utils only pertains to components in TopToolbar.

@standeren
Copy link
Contributor

Will approve this now! Great improvements here! ⭐
I only have one small comment in the file structure. I see that you moved XSDUpload to the same level as TopToolBar, but actually it makes more sense having it in its own folder since the ideal structure would be if all the components used in TopToolBar was placed in its own folders CreateNewWrapper, XSDUpload, SchemaSelect, DeleteWrapper and GenerateModelsButton 😄

Thanks 😄 Ok, I will fix those folders.

I see you suggested putting utils into features/dataModelling above. What do you think about putting the utils folder into the TopToolbar folder instead? Suggesting this because the validation utils only pertains to components in TopToolbar.

Go for it 💯

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.

Nice ⭐ Bare et lite forslag til tekst og test 🤗

frontend/language/src/nb.json Outdated Show resolved Hide resolved
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.

Perfect 🥳

@JamalAlabdullah JamalAlabdullah merged commit 38d8646 into main Dec 5, 2024
10 checks passed
@JamalAlabdullah JamalAlabdullah deleted the 13364-validation-issues-when-creating-a-new-model branch December 5, 2024 07:41
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/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. frontend solution/studio/designer Issues related to the Altinn Studio Designer solution. team/studio-domain1 text/content used for issues that need som text improvements, often by ux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't see the confirmation dialog when deleting a data model Validation issues when creating a new model
5 participants