-
Notifications
You must be signed in to change notification settings - Fork 890
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
[Workspace]Fix page crash caused by invalid workspace color #7671
[Workspace]Fix page crash caused by invalid workspace color #7671
Conversation
b480aa6
to
c1d5d3d
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7671 +/- ##
=======================================
Coverage 63.69% 63.69%
=======================================
Files 3633 3634 +1
Lines 80126 80140 +14
Branches 12695 12702 +7
=======================================
+ Hits 51034 51043 +9
- Misses 25984 25987 +3
- Partials 3108 3110 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
37b85d9
to
6a4944f
Compare
Signed-off-by: Lin Wang <[email protected]>
5b68990
to
ec91b97
Compare
// Reference https://github.com/opensearch-project/oui/blob/main/src/services/color/is_valid_hex.ts | ||
export const validateWorkspaceColor = (color?: string) => | ||
!!color && /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color); |
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.
can we replace it with import { is_valid_hex } from '@opensearch-project/oui/lib/services/color';
?
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.
That not works fine in my local. Seems can't import from @opensearch-project/oui/lib/services/color
;
I've tried import { isValidHex } from '@elastic/eui';
, but it not works for server side.
* Add validation for workspace color Signed-off-by: Lin Wang <[email protected]> * Changeset file for PR #7671 created/updated --------- Signed-off-by: Lin Wang <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit 248c8ff) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…7681) * Add validation for workspace color * Changeset file for PR #7671 created/updated --------- (cherry picked from commit 248c8ff) Signed-off-by: Lin Wang <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Description
This PR for fixing page crashed after invalid color be assigned to avatar component in the Workspace Menu component.
Issues Resolved
#7672
Screenshot
Testing the changes
1.Go to 'Create workspace' page
2.Fill workspace name and select use case, input a invalid color.
3.Click on 'Create workspace' button
4.Workspace should not be created with invalid color, it should show form error
Changelog
Check List
yarn test:jest
yarn test:jest_integration