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

Displays validation error messages on control panel forms #5950

Merged
merged 3 commits into from
Aug 2, 2024

Conversation

wesleybl
Copy link
Member

@wesleybl wesleybl commented Apr 5, 2024

Fixes: #5274

Now the error is displayed:

download (13)

To works properly, it needs: plone/plone.restapi#1771

But it can be merged separately without any problems.

Copy link

netlify bot commented Apr 5, 2024

Deploy Preview for volto canceled.

Name Link
🔨 Latest commit 63a7238
🔍 Latest deploy log https://app.netlify.com/sites/volto/deploys/663155ebd8ef6100082af817

Copy link

netlify bot commented Apr 5, 2024

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit e250677
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/66ad230371592e0008c6ab50

Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

Could you resolve the merge conflict?

@wesleybl wesleybl force-pushed the controlpanel_validation branch from d465ffc to 5cca767 Compare April 30, 2024 16:01
@wesleybl
Copy link
Member Author

@ichim-david I ran into the error in the "As editor, I can unlock a locked page" test again. I remember you found a solution to the problem:

#5933 (comment)

Do you intend to make this fixe?

@wesleybl
Copy link
Member Author

Could you resolve the merge conflict?

@davisagli done.

@wesleybl wesleybl requested a review from davisagli April 30, 2024 20:51
@ichim-david
Copy link
Member

@ichim-david I ran into the error in the "As editor, I can unlock a locked page" test again. I remember you found a solution to the problem:

#5933 (comment)

Do you intend to make this fixe?

@wesleybl yup I do ... time to dust up the old pull request I didn't add, April was not a good month for Volto work unlike March :)

@ichim-david
Copy link
Member

@ichim-david I ran into the error in the "As editor, I can unlock a locked page" test again. I remember you found a solution to the problem:

#5933 (comment)

Do you intend to make this fixe?

@wesleybl only left it there for 1 month .. if you would like to test it locally the locking test here is the pull request where I made the changes necessary to avoid errors after running it 20 times in a row as I've given you the comment on how todo it
#5998

@wesleybl
Copy link
Member Author

@davisagli @sneridagh can you take a look please?

@sneridagh
Copy link
Member

@wesleybl what's left of this one?

@wesleybl wesleybl force-pushed the controlpanel_validation branch from 63a7238 to 0e627af Compare May 27, 2024 18:33
@wesleybl
Copy link
Member Author

@wesleybl what's left of this one?

@sneridagh I think it's ready to merge. There was a conflict but I resolved it.

nextProps.updateRequest.error?.response?.text ||
'';

const error =
Copy link
Member

Choose a reason for hiding this comment

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

@wesleybl is p.restapi returning html as error? Where? It's wrong, and should be fixed, at least file an issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

@sneridagh In fact, I only saw restapi return html when we used

debug-exceptions = on

in buildout. To see: plone/plone.restapi#1734

But perhaps this is an extreme case that is not even worth considering.

I just followed the way it is done when validating content forms:

const error =
new DOMParser().parseFromString(message, 'text/html')?.all[0]
?.textContent || message;

I also don't quite understand why this code is necessary. In my opinion it can be removed.

Perhaps @avoinea can explain why this is necessary, since he was the one who implemented the original code in:

0782a50#diff-0356a7af508f860d87802dfa2b06d502aaed9cd60b130e57740806bd956be87e

@wesleybl wesleybl force-pushed the controlpanel_validation branch from 0e627af to f81c3df Compare July 11, 2024 13:53
@wesleybl
Copy link
Member Author

@sneridagh I answered your questions. Can you take another look please?

Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

@wesleybl Thanks for your work on this -- and I'm sorry it took me so long to review it.

@davisagli davisagli merged commit a924714 into main Aug 2, 2024
70 checks passed
@davisagli davisagli deleted the controlpanel_validation branch August 2, 2024 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validation error messages are not shown in the controlpanel
5 participants