-
Notifications
You must be signed in to change notification settings - Fork 906
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
[MD] Validate length of title to be no longer than 32 characters #6452
[MD] Validate length of title to be no longer than 32 characters #6452
Conversation
2868999
to
1c50e72
Compare
859d2b9
to
6b051f8
Compare
6b051f8
to
8f75470
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6452 +/- ##
===========================================
+ Coverage 49.55% 62.51% +12.95%
===========================================
Files 2670 2976 +306
Lines 54290 58663 +4373
Branches 8878 9553 +675
===========================================
+ Hits 26906 36672 +9766
+ Misses 25720 19891 -5829
- Partials 1664 2100 +436
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
src/plugins/data_source_management/public/components/validation/datasource_form_validation.ts
Outdated
Show resolved
Hide resolved
650c8e3
to
043f98c
Compare
@@ -50,8 +50,14 @@ export const isTitleValid = ( | |||
error: '', | |||
}; | |||
/* Title validation */ | |||
if (!title?.trim?.().length) { | |||
if (!title.trim().length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious whether title could be undefined
. If yes, then calling trim
function will throw exception. If no, then there is no concern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title will not be undefined, it's initialized with empty string
that's why in the function param, we didn't declare it to be optional param
Signed-off-by: Zhongnan Su <[email protected]>
043f98c
to
64ea71a
Compare
…6452) Signed-off-by: Zhongnan Su <[email protected]> (cherry picked from commit 236ec4e) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
…6452) Signed-off-by: Zhongnan Su <[email protected]> (cherry picked from commit 236ec4e) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
…6452) (#6476) Signed-off-by: Zhongnan Su <[email protected]> (cherry picked from commit 236ec4e) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Add validation for length of title to be no longer than 32 characters in create flow. Otherwise show inline error message, and disable the buttons. This applies to both create flow and edit flow
Issues Resolved
#6433
#6432
Screenshot
iShot_2024-04-14_23.51.32.mp4
Testing the changes
Check List
yarn test:jest
yarn test:jest_integration