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

Display min/max limits with field description #15424

Merged
merged 19 commits into from Jan 24, 2023

Conversation

jhoward1994
Copy link
Contributor

@jhoward1994 jhoward1994 commented Jan 12, 2023

Screenshot 2023-01-12 at 15 13 26

What does it do?

Adds the min and max constraints to field descriptions

How to test it?

  • Tests added for description util packages/core/helper-plugin/lib/src/hooks/useFieldHint/tests/useFieldHint.test.js

@jhoward1994 jhoward1994 added source: core:content-manager Source is core/content-manager package pr: feature This PR adds a new feature labels Jan 12, 2023
@jhoward1994 jhoward1994 self-assigned this Jan 12, 2023
@codecov
Copy link

codecov bot commented Jan 12, 2023

Codecov Report

Base: 61.27% // Head: 61.28% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (ea95c70) compared to base (a7df094).
Patch coverage: 57.14% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15424   +/-   ##
=======================================
  Coverage   61.27%   61.28%           
=======================================
  Files        1355     1355           
  Lines       33499    33491    -8     
  Branches     6455     6449    -6     
=======================================
- Hits        20528    20526    -2     
+ Misses      11144    11142    -2     
+ Partials     1827     1823    -4     
Flag Coverage Δ
back 50.62% <0.00%> (-0.01%) ⬇️
front 66.14% <100.00%> (+0.01%) ⬆️
unit_back 50.62% <0.00%> (-0.01%) ⬇️
unit_front 66.14% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...r/server/services/utils/configuration/metadatas.js 9.80% <0.00%> (-0.20%) ⬇️
...admin/src/content-manager/components/Hint/index.js 81.81% <100.00%> (+0.56%) ⬆️
...n/src/content-manager/components/InputUID/index.js 72.56% <100.00%> (+0.15%) ⬆️
...in/src/content-manager/components/Wysiwyg/index.js 90.32% <100.00%> (ø)
...ntent-manager/pages/EditView/Informations/index.js
...ager/pages/EditView/Informations/utils/getUnits.js
...ontent-manager/pages/EditView/Information/index.js 100.00% <0.00%> (ø)
...nager/pages/EditView/Information/utils/getUnits.js 77.77% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jhoward1994 jhoward1994 marked this pull request as ready for review January 12, 2023 16:30
@joshuaellis
Copy link
Member

Your padding between the two lines & font weight on the character count don't look correct looking at the image you've shared. Would you be able to double check and revisit? At the moment it looks a bit lost.

feat(content-manager): construct min/max description separately from main description
@jhoward1994
Copy link
Contributor Author

Your padding between the two lines & font weight on the character count don't look correct looking at the image you've shared. Would you be able to double check and revisit? At the moment it looks a bit lost.

Yeah I know what you mean. We had agreed as a first step to implement it like this (see CONTENT-863) but I agree it looks a bit strange.

WDYT @gu-stav ?

@joshuaellis
Copy link
Member

Yeah I know what you mean. We had agreed as a first step to implement it like this (see CONTENT-863) but I agree it looks a bit strange.

Ah i didn't see that this was agreed on. In that case leave it if @maevalienard is happy.

@maevalienard
Copy link

Well I'd rather see the min/max as semibold but it was easier as such :)

Copy link
Member

@joshuaellis joshuaellis left a comment

Choose a reason for hiding this comment

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

Some feedback on your hook, i'd want to avoid disabling eslint rules for hooks where possible, i'd double check my comments before just committing them, i didn't double check what i wrote!

fix(helper-plugin): useFieldHint dependencies array
joshuaellis
joshuaellis previously approved these changes Jan 18, 2023
Copy link
Member

@joshuaellis joshuaellis left a comment

Choose a reason for hiding this comment

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

LGTM ⭐

Copy link
Contributor

@gu-stav gu-stav left a comment

Choose a reason for hiding this comment

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

It looks much better - good work! 🚀 I think there is only one tricky question left about this can be translated by the community, but maybe I just don't see the whole idea yet :)

A few notes/ questions from a functional test:

  • if I add the min (e.g. 10) validation to a field and leave the field empty while saving there is no validation error. This means the BE does not validate this constraint at the moment. Should we track this in a follow-up bug (max validation seems to work)?
  • there is no validation in case the "default value" entered in the CTB is longer than the allowed maximum, which might be a ux problem? Again: follow-up task?
  • for richtext fields currently these constraints are not displayed. I guess this is intentional?
  • integer / decimal fields display constraints, while biginteger fields do not. I guess you haven't touched that - should we track this in a follow-up issue?

test(helper-plugin): getFieldUnits

feat(I18n): add en.json translations for min/max descriptions

feat(content-manager): support min/max descriptions in Wysiwyg and BIGINT inputs

test(content-manager): getMinMax
@jhoward1994
Copy link
Contributor Author

It looks much better - good work! 🚀 I think there is only one tricky question left about this can be translated by the community, but maybe I just don't see the whole idea yet :)

A few notes/ questions from a functional test:

  • if I add the min (e.g. 10) validation to a field and leave the field empty while saving there is no validation error. This means the BE does not validate this constraint at the moment. Should we track this in a follow-up bug (max validation seems to work)?
  • there is no validation in case the "default value" entered in the CTB is longer than the allowed maximum, which might be a ux problem? Again: follow-up task?
  • for richtext fields currently these constraints are not displayed. I guess this is intentional?
  • integer / decimal fields display constraints, while biginteger fields do not. I guess you haven't touched that - should we track this in a follow-up issue?

Thanks for the review @gu-stav 🙏🏻, I've addressed your comments in the latest commits.

The only outstanding things are the validation issues you spotted. I agree these should be tracked in separate issues, I can make the JIRA tickets.

gu-stav
gu-stav previously approved these changes Jan 23, 2023
Copy link
Contributor

@gu-stav gu-stav left a comment

Choose a reason for hiding this comment

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

This looks good to me now! 🚀 Thank you!

Copy link
Member

@joshuaellis joshuaellis left a comment

Choose a reason for hiding this comment

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

It's been a journey, but really great work 👍🏼

@jhoward1994 jhoward1994 added this to the 4.6.0 milestone Jan 24, 2023
@jhoward1994 jhoward1994 merged commit 2153d4d into main Jan 24, 2023
@jhoward1994 jhoward1994 deleted the feature/min-max-description branch January 24, 2023 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: feature This PR adds a new feature source: core:content-manager Source is core/content-manager package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants