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 User level setting #7953

Merged
merged 32 commits into from
Sep 6, 2024

Conversation

Hailong-am
Copy link
Collaborator

@Hailong-am Hailong-am commented Sep 2, 2024

Description

This PR includes

  1. user settings page
  2. ui_setting_client changes to support user personal settings
  3. UserUISettingsClientWrapper to translate user id placeholder to real user id

Issues Resolved

#7821

#7909

Screenshot

user_settings.mov

Testing the changes

  1. Run OSD enabled yarn start --no-base-path --workspace.enabled=true
  2. make sure security is enabled
  3. open http://localhost:5601, and then go to dev tools
  4. Run kibana search to make sure global setting been created
GET .kibana/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "type": "config"
          }
        }
      ]
    }
  }
  1. Run command to add user setting, after that run kibana query again to verify
    a config doc with id config:admin been indexed and it has defaultWorkspace as "ABC"
curl --request POST \
  --url http://localhost:5601/api/opensearch-dashboards/settings \
  --header 'Authorization: Basic YWRtaW46YWRtaW4=' \
  --header 'Content-Type: application/json' \
  --header 'osd-xsrf: osd-fetch' \
  --data '{
 "changes": {
  "defaultIndex": "logstash-*",
  "defaultWorkspace": "ABC"
 }
}'

Changelog

  • feat: [Workspace] Support user personal settings

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
Contributor

github-actions bot commented Sep 2, 2024

❌ Empty Changelog Section

The Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section.

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 67.48971% with 79 lines in your changes missing coverage. Please review.

Project coverage is 60.59%. Comparing base (d22b68b) to head (5e83f3f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/plugins/workspace/server/utils.ts 5.55% 17 Missing ⚠️
src/core/server/ui_settings/ui_settings_client.ts 77.55% 4 Missing and 7 partials ⚠️
...rkspace/public/components/workspace_list/index.tsx 80.39% 7 Missing and 3 partials ⚠️
src/plugins/advanced_settings/public/plugin.ts 43.75% 8 Missing and 1 partial ⚠️
...d_settings/public/management_app/user_settings.tsx 64.28% 4 Missing and 1 partial ⚠️
src/plugins/workspace/server/routes/index.ts 0.00% 5 Missing ⚠️
...ntent_management/public/components/page_render.tsx 55.55% 2 Missing and 2 partials ⚠️
src/plugins/workspace/public/plugin.ts 50.00% 3 Missing and 1 partial ⚠️
...r/saved_objects/user_ui_settings_client_wrapper.ts 91.89% 1 Missing and 2 partials ⚠️
...ade_saved_config/create_or_upgrade_saved_config.ts 66.66% 1 Missing and 1 partial ⚠️
... and 6 more
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #7953    +/-   ##
========================================
  Coverage   60.58%   60.59%            
========================================
  Files        3732     3738     +6     
  Lines       88431    88636   +205     
  Branches    13702    13763    +61     
========================================
+ Hits        53579    53709   +130     
- Misses      31592    31650    +58     
- Partials     3260     3277    +17     
Flag Coverage Δ
Linux_1 28.76% <34.91%> (+<0.01%) ⬆️
Linux_2 56.27% <70.58%> (+<0.01%) ⬆️
Linux_3 37.50% <43.42%> (+0.06%) ⬆️
Linux_4 29.61% <8.33%> (-0.04%) ⬇️
Windows_1 28.78% <34.91%> (+<0.01%) ⬆️
Windows_2 56.22% <70.58%> (+<0.01%) ⬆️
Windows_3 37.51% <43.42%> (+0.06%) ⬆️
Windows_4 29.61% <8.33%> (-0.04%) ⬇️

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: Hailong Cui <[email protected]>
Signed-off-by: Hailong Cui <[email protected]>
Signed-off-by: Hailong Cui <[email protected]>
@ruanyl ruanyl merged commit 569b70d into opensearch-project:main Sep 6, 2024
66 of 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-7953-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 569b70d885cec37ac83d133ef6d8ce0f6c03a02f
# Push it to GitHub
git push --set-upstream origin backport/backport-7953-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-7953-to-2.x.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.17 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.17 2.17
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.17
# Create a new branch
git switch --create backport/backport-7953-to-2.17
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 569b70d885cec37ac83d133ef6d8ce0f6c03a02f
# Push it to GitHub
git push --set-upstream origin backport/backport-7953-to-2.17
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.17

Then, create a pull request where the base branch is 2.17 and the compare/head branch is backport/backport-7953-to-2.17.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.17 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.17 2.17
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.17
# Create a new branch
git switch --create backport/backport-7953-to-2.17
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 569b70d885cec37ac83d133ef6d8ce0f6c03a02f
# Push it to GitHub
git push --set-upstream origin backport/backport-7953-to-2.17
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.17

Then, create a pull request where the base branch is 2.17 and the compare/head branch is backport/backport-7953-to-2.17.

@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-7953-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 569b70d885cec37ac83d133ef6d8ce0f6c03a02f
# Push it to GitHub
git push --set-upstream origin backport/backport-7953-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-7953-to-2.x.

@Hailong-am
Copy link
Collaborator Author

i will do manual backport due to

 const enableUserControl = core.uiSettings.get('theme:enableUserControl');
    if (enableUserControl) {
      setupTopNavThemeButton(core, core.uiSettings.get('home:useNewHomePage'));
    }

not available in 2.x

Hailong-am added a commit to Hailong-am/OpenSearch-Dashboards that referenced this pull request Sep 6, 2024
Hailong-am added a commit to Hailong-am/OpenSearch-Dashboards that referenced this pull request Sep 6, 2024
(cherry picked from commit 569b70d)
Signed-off-by: Hailong Cui <[email protected]>
Hailong-am added a commit to Hailong-am/OpenSearch-Dashboards that referenced this pull request Sep 6, 2024
Hailong-am added a commit to Hailong-am/OpenSearch-Dashboards that referenced this pull request Sep 6, 2024
(cherry picked from commit 569b70d)
Signed-off-by: Hailong Cui <[email protected]>
SuZhou-Joe pushed a commit that referenced this pull request Sep 7, 2024
* [Workspace] Add User level setting (#7953)

(cherry picked from commit 569b70d)
Signed-off-by: Hailong Cui <[email protected]>

* add experimental to user personal settings and support i18n

Signed-off-by: Hailong Cui <[email protected]>

---------

Signed-off-by: Hailong Cui <[email protected]>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 7, 2024
* [Workspace] Add User level setting (#7953)

(cherry picked from commit 569b70d)
Signed-off-by: Hailong Cui <[email protected]>

* add experimental to user personal settings and support i18n

Signed-off-by: Hailong Cui <[email protected]>

---------

Signed-off-by: Hailong Cui <[email protected]>
(cherry picked from commit eccf54f)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit to SuZhou-Joe/OpenSearch-Dashboards that referenced this pull request Sep 8, 2024
ruanyl pushed a commit that referenced this pull request Sep 9, 2024
* [Workspace] Add User level setting (#7953)

(cherry picked from commit 569b70d)


* add experimental to user personal settings and support i18n



---------


(cherry picked from commit eccf54f)

Signed-off-by: Hailong Cui <[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>
SuZhou-Joe pushed a commit to SuZhou-Joe/OpenSearch-Dashboards that referenced this pull request Sep 10, 2024
@AMoo-Miki
Copy link
Collaborator

Manually backported to 2.x with #8057

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.

5 participants