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

[Workspaces]Add features in use case card and preselect first use case #7703

Merged

Conversation

wanglam
Copy link
Contributor

@wanglam wanglam commented Aug 14, 2024

Description

This PR is for adding features to workspace use case card in the workspace form and preselect the first use case in the workspace create page. They mainly includes below changes:

  1. Add feature titles to the workspace use case object
  2. Support display feature titles in the workspace use case card
  3. Assign first available use case as default name and features to workspace form
  4. Automatic update workspace name after use case changed if no manual input workspace name

Issues Resolved

#7705

Screenshot

image

Testing the changes

  • Clone branch code and run yarn osd bootstrap --single-version ignore
  • Add below configs in config/opensearch_dashboards.yml
savedObjects.permission.enabled: true
workspace.enabled: true
uiSettings:
  overrides:
    'home:useNewHomePage': true
  • Run yarn start --no-base-path
  • Login and visit workspace create page
  • Features will be displayed in the use case card, and it can be expand or collapse

Changelog

  • feat: [Workspaces]Add features in use case card and preselect first use case

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 14, 2024

Codecov Report

Attention: Patch coverage is 97.53086% with 2 lines in your changes missing coverage. Please review.

Project coverage is 63.82%. Comparing base (ba5fe50) to head (601c344).
Report is 172 commits behind head on main.

Files with missing lines Patch % Lines
...components/home_get_start_card/use_case_footer.tsx 0.00% 0 Missing and 1 partial ⚠️
...nts/workspace_form/use_form_available_use_cases.ts 96.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7703      +/-   ##
==========================================
+ Coverage   63.80%   63.82%   +0.02%     
==========================================
  Files        3656     3658       +2     
  Lines       81205    81263      +58     
  Branches    12949    12963      +14     
==========================================
+ Hits        51809    51866      +57     
- Misses      26215    26216       +1     
  Partials     3181     3181              
Flag Coverage Δ
Linux_1 30.14% <97.53%> (+0.06%) ⬆️
Linux_2 55.87% <ø> (ø)
Linux_3 40.42% <ø> (ø)
Linux_4 31.28% <ø> (ø)
Windows_1 30.16% <97.53%> (+0.06%) ⬆️
Windows_2 55.82% <ø> (ø)
Windows_3 40.42% <ø> (ø)
Windows_4 31.28% <ø> (ø)

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 [Workspaces]Add features in workspace use case card [Workspaces]Add features in workspace use case card and preselect first one Aug 14, 2024
@wanglam wanglam changed the title [Workspaces]Add features in workspace use case card and preselect first one [Workspaces]Add features in use case card and preselect first one Aug 14, 2024
@wanglam wanglam changed the title [Workspaces]Add features in use case card and preselect first one [Workspaces]Add features in use case card and preselect first use case Aug 14, 2024
SuZhou-Joe
SuZhou-Joe previously approved these changes Aug 19, 2024
SuZhou-Joe
SuZhou-Joe previously approved these changes Aug 20, 2024
ruanyl
ruanyl previously approved these changes Aug 20, 2024
Comment on lines 132 to 136
{application &&
savedObjects &&
// Default values only worked for component mount, should wait for isOnlyAllowEssential and availableUseCases loaded
isOnlyAllowEssential !== undefined &&
availableUseCases !== undefined && (
Copy link
Member

Choose a reason for hiding this comment

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

Maybe assign this to a readable name?

Suggested change
{application &&
savedObjects &&
// Default values only worked for component mount, should wait for isOnlyAllowEssential and availableUseCases loaded
isOnlyAllowEssential !== undefined &&
availableUseCases !== undefined && (
{application &&
savedObjects &&
// Default values only worked for component mount, should wait for isOnlyAllowEssential and availableUseCases loaded
isOnlyAllowEssential !== undefined &&
availableUseCases !== undefined && (

const result = await getIsOnlyAllowEssentialUseCase(savedObjects.client);
updateEssential(result);
} catch (e) {
// Set to false is failed to fetch is only allow essential use case
Copy link
Member

Choose a reason for hiding this comment

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

This comment doesn't sound correct.

Signed-off-by: Lin Wang <[email protected]>
@SuZhou-Joe SuZhou-Joe merged commit 446aa08 into opensearch-project:main Aug 22, 2024
67 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-7703-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 446aa08b9730ecd4bfcbbb13e796be932ad29e7a
# Push it to GitHub
git push --set-upstream origin backport/backport-7703-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-7703-to-2.x.

opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 26, 2024
#7703)

* Display features in workspace use case card

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

* Changeset file for PR #7703 created/updated

* Changeset file for PR #7703 created/updated

* Changeset file for PR #7703 created/updated

* Add more test cases

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

* Update snapshort of workspace list

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

* Address pr comments

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 446aa08)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-7703-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 446aa08b9730ecd4bfcbbb13e796be932ad29e7a
# Push it to GitHub
git push --set-upstream origin backport/backport-7703-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-7703-to-2.x.

SuZhou-Joe pushed a commit that referenced this pull request Aug 26, 2024
#7703) (#7838)

* Display features in workspace use case card



* Changeset file for PR #7703 created/updated

* Changeset file for PR #7703 created/updated

* Changeset file for PR #7703 created/updated

* Add more test cases



* Update snapshort of workspace list



* Address pr comments



---------



(cherry picked from commit 446aa08)

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