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]Add name and description characters limitation #7656

Conversation

wanglam
Copy link
Contributor

@wanglam wanglam commented Aug 8, 2024

Description

This PR mainly includes two changes:

  1. Add characters limitations for name and description field
  2. Update label and description for workspace color field

Issues Resolved

#7657

Screenshot

image

Testing the changes

  • Clone branch and run yarn osd bootstrap
  • Add below configs in config/opensearch_dashboards.yml
workspace.enabled: true
savedObjects.permission.enabled: true
uiSettings:
  overrides:
    'home:useNewHomePage': true
  • Run yarn start --no-base-path
  • Login with admin user and go to workspace create page
  • Type in name input, it will show a error tip and disable create button after input more than 40 characters
  • Type in description textarea, it will show a error tip and disable create button after input more than 200 characters.

Changelog

  • feat: [Workspace]Add name and description characters limitation

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

Copy link

codecov bot commented Aug 8, 2024

Codecov Report

Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Project coverage is 63.74%. Comparing base (265a176) to head (d53954d).
Report is 204 commits behind head on main.

Files with missing lines Patch % Lines
...s/workspace_form/workspace_create_action_panel.tsx 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7656   +/-   ##
=======================================
  Coverage   63.74%   63.74%           
=======================================
  Files        3637     3639    +2     
  Lines       80426    80442   +16     
  Branches    12786    12795    +9     
=======================================
+ Hits        51264    51279   +15     
  Misses      26030    26030           
- Partials     3132     3133    +1     
Flag Coverage Δ
Linux_1 29.85% <95.23%> (+0.01%) ⬆️
Linux_2 55.82% <ø> (ø)
Linux_3 40.37% <ø> (-0.01%) ⬇️
Linux_4 31.30% <ø> (ø)
Windows_1 29.87% <95.23%> (+0.01%) ⬆️
Windows_2 55.77% <ø> (ø)
Windows_3 40.37% <ø> (ø)
Windows_4 31.30% <ø> (ø)

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.

expect(onChangeMock).not.toHaveBeenCalled();
});

it('should render the correct number of characters left when value is falsy', () => {
Copy link
Member

Choose a reason for hiding this comment

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

When description is empty?

readOnly,
onChange,
}: WorkspaceNameFieldProps) => {
const handleChange = useCallback(
Copy link
Member

Choose a reason for hiding this comment

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

Shall we allow user to keep editing but display error message when exceed limit?

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'm open to this. Can be discuss with designer about that behavior.

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 updated this part according the latest feedback. Could you help me take a look?

Signed-off-by: Lin Wang <[email protected]>
ruanyl
ruanyl previously approved these changes Aug 12, 2024
@ruanyl ruanyl merged commit 7aef6e3 into opensearch-project:main Aug 15, 2024
68 of 69 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 15, 2024
* Add name and description characters limitation

Signed-off-by: Lin Wang <[email protected]>

* Changeset file for PR #7656 created/updated

* Add workspace name and description limitation in server side

Signed-off-by: Lin Wang <[email protected]>

* Add unit tests for workspace name and description field

Signed-off-by: Lin Wang <[email protected]>

* Update test case name

Signed-off-by: Lin Wang <[email protected]>

* Allow input text when exceed max length

Signed-off-by: Lin Wang <[email protected]>

---------

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 7aef6e3)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ruanyl pushed a commit that referenced this pull request Aug 15, 2024
)

* Add name and description characters limitation



* Changeset file for PR #7656 created/updated

* Add workspace name and description limitation in server side



* Add unit tests for workspace name and description field



* Update test case name



* Allow input text when exceed max length



---------



(cherry picked from commit 7aef6e3)

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>
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.

4 participants