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 create workspace page #6179

Merged

Conversation

wanglam
Copy link
Contributor

@wanglam wanglam commented Mar 18, 2024

Description

This PR is for adding workspace create page. All code changes are under workspace plugin folder. Will register a new workspace create application. This application allow user create workspace from the user interface.

Issues Resolved

closes #6181

Screenshot

image

Testing the changes

  • Clone the latest code and run yarn osd bootstrap
  • Modify config/opensearch_dashboards.yml add workspace.enabled: true
  • Run yarn start --no-base-path
  • Visit workspace create page
  • Input name, description, color and features
    image
  • Click Create workspace button
  • The workspace will be created, will redirect to http://localhost:5601/app/w/<workspace_id>/workspace_overview

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

Signed-off-by: Lin Wang <wonglam@amazon.com>
Copy link

codecov bot commented Mar 18, 2024

Codecov Report

Attention: Patch coverage is 92.57143% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 67.42%. Comparing base (4f1884b) to head (41e7201).

Files Patch % Lines
...ic/components/workspace_form/use_workspace_form.ts 90.38% 3 Missing and 2 partials ⚠️
...components/workspace_creator/workspace_creator.tsx 88.88% 0 Missing and 2 partials ⚠️
...components/workspace_form/workspace_bottom_bar.tsx 77.77% 0 Missing and 2 partials ⚠️
...ents/workspace_form/workspace_feature_selector.tsx 93.93% 1 Missing and 1 partial ⚠️
src/plugins/workspace/public/plugin.ts 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6179      +/-   ##
==========================================
+ Coverage   67.35%   67.42%   +0.07%     
==========================================
  Files        3353     3362       +9     
  Lines       65083    65258     +175     
  Branches    10483    10524      +41     
==========================================
+ Hits        43837    44001     +164     
- Misses      18695    18700       +5     
- Partials     2551     2557       +6     
Flag Coverage Δ
Linux_1 32.06% <92.57%> (+0.23%) ⬆️
Linux_2 55.57% <ø> (ø)
Linux_3 44.84% <ø> (+<0.01%) ⬆️
Linux_4 35.03% <ø> (ø)
Windows_1 32.08% <92.57%> (+0.23%) ⬆️
Windows_2 55.53% <ø> (ø)
Windows_3 44.84% <ø> (ø)
Windows_4 35.03% <ø> (ø)

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.

@wanglam wanglam changed the title [WORKSPACE]Add workspace create page [Workspace]Add workspace create page Mar 18, 2024
@wanglam wanglam marked this pull request as ready for review March 18, 2024 09:01
@wanglam wanglam changed the title [Workspace]Add workspace create page [Workspace]Add create workspace page Mar 18, 2024
Signed-off-by: Lin Wang <wonglam@amazon.com>
…eate-page

Signed-off-by: Lin Wang <wonglam@amazon.com>
export const WORKSPACE_LIST_APP_ID = 'workspace_list';
export const WORKSPACE_UPDATE_APP_ID = 'workspace_update';
export const WORKSPACE_OVERVIEW_APP_ID = 'workspace_overview';
// These features will be checked and disabled in checkbox on default.
Copy link
Member

Choose a reason for hiding this comment

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

Can you give more detail about comments here? I'm a little bit lost here based on the comment here. thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The user needs to select which features will be enabled when creating or updating workspace. The enabled features will be list on the left navigation. The workspace overview and workspace update should be selected by default which means every workspace should have these two pages.

try {
result = await workspaceClient.create(data);
} catch (error) {
notifications?.toasts.addDanger({
Copy link
Member

Choose a reason for hiding this comment

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

Can we add tests for cover error handling, such as server errors or unexpected responses here. thanks

};
}
if (!isValidNameOrDescription(formData.name)) {
currentFormErrors = {
Copy link
Member

Choose a reason for hiding this comment

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

Do we have test cover for not valid name or description with errors? Thanks

export const WORKSPACE_UPDATE_APP_ID = 'workspace_update';
export const WORKSPACE_OVERVIEW_APP_ID = 'workspace_overview';
// These features will be checked and disabled in checkbox on default.
export const DEFAULT_CHECKED_FEATURES_IDS = [WORKSPACE_UPDATE_APP_ID, WORKSPACE_OVERVIEW_APP_ID];
Copy link
Member

Choose a reason for hiding this comment

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

DEFAULT_CHECKED_FEATURES_IDS, I'm assuming that you want to mention here by selected, like DEFAULT_SELECTED_FEATURES_IDS, right? Thanks

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 think we can rename to it.

})}
onCancel={closeCancelModal}
onConfirm={() => application?.navigateToApp(WORKSPACE_LIST_APP_ID)}
cancelButtonText={i18n.translate('workspace.form.cancelButtonText.', {
Copy link
Member

Choose a reason for hiding this comment

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

Is workspace.form.cancelButtonText. or workspace.form.cancelButtonText?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should remove ., thank you.

wanglam and others added 4 commits March 22, 2024 14:49
Signed-off-by: Lin Wang <wonglam@amazon.com>
…eate-page

Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
SuZhou-Joe
SuZhou-Joe previously approved these changes Mar 25, 2024
Flyingliuhub
Flyingliuhub previously approved these changes Mar 25, 2024
…eate-page

Signed-off-by: Lin Wang <wonglam@amazon.com>
@wanglam wanglam dismissed stale reviews from Flyingliuhub and SuZhou-Joe via 41e7201 March 26, 2024 00:44
@SuZhou-Joe SuZhou-Joe merged commit f5896b8 into opensearch-project:main Mar 26, 2024
70 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 17, 2024
* Add workspace create page

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Add change log for create workspace

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Address PR comments

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Update annotation for default selected features ids

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Address PR comments

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Add unit tests for unselected single feature

Signed-off-by: Lin Wang <wonglam@amazon.com>

---------

Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
(cherry picked from commit f5896b8)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
SuZhou-Joe pushed a commit that referenced this pull request Apr 18, 2024
* Add workspace create page

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Add change log for create workspace

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Address PR comments

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Update annotation for default selected features ids

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Address PR comments

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Add unit tests for unselected single feature

Signed-off-by: Lin Wang <wonglam@amazon.com>

---------

Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
(cherry picked from commit f5896b8)
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>
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.

[Workspace] Add workspace creator
4 participants