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

[Workspace] Limit workspace colors #8607

Merged
merged 5 commits into from
Oct 17, 2024

Conversation

Kapian1234
Copy link
Contributor

@Kapian1234 Kapian1234 commented Oct 16, 2024

Description

Limit workspace colors to just those in color picker swatch.

Issues Resolved

Screenshot

Screenshot 2024-10-16 at 17 39 31
Screenshot 2024-10-16 at 17 40 11
Screenshot 2024-10-17 at 11 15 27

Testing the changes

Changelog

  • feat: Limit workspace colors

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@@ -129,6 +129,7 @@ export const WorkspaceDetailFormDetails = ({
error={formErrors.color?.message}
>
<EuiCompressedColorPicker
mode="swatch"
color={formData.color}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This still allow user to type whatever color they want

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we could add a rule for color validation when submitting like this: euiPaletteColorBlind().includes(color)

Copy link
Collaborator

Choose a reason for hiding this comment

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

should we use same component as create page? for now they are different.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I‘ve tried the validation and it works on both the create page and the detail page

@Hailong-am
Copy link
Collaborator

do we need to add validation at api side?

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.94%. Comparing base (47ae28b) to head (1ccebda).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8607      +/-   ##
==========================================
- Coverage   60.95%   60.94%   -0.01%     
==========================================
  Files        3790     3790              
  Lines       90296    90306      +10     
  Branches    14151    14154       +3     
==========================================
- Hits        55036    55034       -2     
- Misses      31804    31815      +11     
- Partials     3456     3457       +1     
Flag Coverage Δ
Linux_1 29.29% <100.00%> (-0.01%) ⬇️
Linux_2 56.39% <ø> (ø)
Linux_3 37.71% <ø> (-0.01%) ⬇️
Linux_4 29.91% <ø> (ø)
Windows_1 29.30% <100.00%> (-0.01%) ⬇️
Windows_2 56.34% <ø> (ø)
Windows_3 37.71% <ø> (-0.02%) ⬇️
Windows_4 29.91% <ø> (ø)

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

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

Signed-off-by: Kapian1234 <[email protected]>
@@ -335,11 +335,11 @@ export const validateWorkspaceForm = (
}),
};
}
if (color && !validateWorkspaceColor(color)) {
if (color && (!validateWorkspaceColor(color) || !euiPaletteColorBlind().includes(color))) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Since we have this !euiPaletteColorBlind().includes(color) check which inlcudes the logic for !validateWorkspaceColor(color), we can remove !validateWorkspaceColor(color).

@Hailong-am Hailong-am merged commit 2b3fbf0 into opensearch-project:main Oct 17, 2024
73 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 17, 2024
* Limit workspace color

Signed-off-by: Kapian1234 <[email protected]>

* Limit workspace color at detail page

Signed-off-by: Kapian1234 <[email protected]>

* Changeset file for PR #8607 created/updated

* Add validation

Signed-off-by: Kapian1234 <[email protected]>

---------

Signed-off-by: Kapian1234 <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 2b3fbf0)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Oct 17, 2024
* Limit workspace color



* Limit workspace color at detail page



* Changeset file for PR #8607 created/updated

* Add validation



---------



(cherry picked from commit 2b3fbf0)

Signed-off-by: Kapian1234 <[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>
amsiglan pushed a commit to amsiglan/OpenSearch-Dashboards that referenced this pull request Oct 19, 2024
* Limit workspace color

Signed-off-by: Kapian1234 <[email protected]>

* Limit workspace color at detail page

Signed-off-by: Kapian1234 <[email protected]>

* Changeset file for PR opensearch-project#8607 created/updated

* Add validation

Signed-off-by: Kapian1234 <[email protected]>

---------

Signed-off-by: Kapian1234 <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
sejli pushed a commit to sejli/OpenSearch-Dashboards that referenced this pull request Oct 21, 2024
* Limit workspace color

Signed-off-by: Kapian1234 <[email protected]>

* Limit workspace color at detail page

Signed-off-by: Kapian1234 <[email protected]>

* Changeset file for PR opensearch-project#8607 created/updated

* Add validation

Signed-off-by: Kapian1234 <[email protected]>

---------

Signed-off-by: Kapian1234 <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Qxisylolo pushed a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 30, 2024
* Limit workspace color

Signed-off-by: Kapian1234 <[email protected]>

* Limit workspace color at detail page

Signed-off-by: Kapian1234 <[email protected]>

* Changeset file for PR opensearch-project#8607 created/updated

* Add validation

Signed-off-by: Kapian1234 <[email protected]>

---------

Signed-off-by: Kapian1234 <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
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.

3 participants