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

[MD] Able to hide "Local Cluster" option #5827

Merged
merged 23 commits into from
Feb 15, 2024

Conversation

xinruiba
Copy link
Member

@xinruiba xinruiba commented Feb 7, 2024

Description

PR to enabled local cluster hidden with MD enabled. Please check #5754 for more context.

Issues Resolved

#5754

Screenshot

MD-RemoveLocalCluster.mov

Testing the changes

1. When MD turn off:

  • "Home Page" still able to add sample data
  • "Dev Tool Page" able to run queries on local cluster
  • "Index Pattern Page" able to create index pattern on local cluster
  • "Import Saved Object Page" able to import object into local cluster

2. When MD turn on and RemoveLocalCluster turn on:

  • Able to see Local Cluster Options on "Home Page", "Dev Tool" and "Import Saved Object" data picker
  • Able to make customer choose using default cluster or remote DS in "index pattern create page"

3. When MD turn on and RemoveLocalCluster turn off:

  • "Local cluster" option get hidden from dataSource picker in "Home Page", "Import Saved Object Page" and "Devtool page"
  • "Sample Data"'s add button get disabled when no datasource get chosen in Home page
  • "Dev Tool"'s "Send Request" button will be disabled and show toast message when no dataSource chosen
  • "Index Pattern Creation Page" will not support "Using default cluster" option

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: Xinrui Bai <xinruiba@amazon.com>
Copy link

codecov bot commented Feb 7, 2024

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (e08bf30) 66.98% compared to head (21b0b4e) 66.98%.

Files Patch % Lines
.../plugins/index_pattern_management/public/plugin.ts 0.00% 3 Missing ⚠️
...a/server/search/opensearch_search/decide_client.ts 66.66% 0 Missing and 1 partial ⚠️
...ch/opensearch_search/opensearch_search_strategy.ts 50.00% 1 Missing ⚠️
...c/components/cluster_selector/cluster_selector.tsx 75.00% 0 Missing and 1 partial ⚠️
.../plugins/saved_objects_management/public/plugin.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5827   +/-   ##
=======================================
  Coverage   66.98%   66.98%           
=======================================
  Files        3304     3304           
  Lines       63563    63572    +9     
  Branches    10149    10153    +4     
=======================================
+ Hits        42575    42583    +8     
- Misses      18520    18521    +1     
  Partials     2468     2468           
Flag Coverage Δ
Linux_1 35.21% <0.00%> (+<0.01%) ⬆️
Linux_2 55.11% <0.00%> (+<0.01%) ⬆️
Linux_3 43.53% <57.14%> (+<0.01%) ⬆️
Linux_4 35.20% <48.00%> (+<0.01%) ⬆️
Windows_1 35.24% <0.00%> (+<0.01%) ⬆️
Windows_2 55.08% <0.00%> (+<0.01%) ⬆️
Windows_3 43.55% <57.14%> (+<0.01%) ⬆️
Windows_4 35.20% <48.00%> (+<0.01%) ⬆️

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.

xinruiba and others added 11 commits February 9, 2024 23:31
…ected. 2. Add unit tests

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
… issue

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
…ultCluster to hideLocalCluster

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
…alCluster

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
…option removed and no datasource created

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
…nent

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
@BionIT
Copy link
Collaborator

BionIT commented Feb 15, 2024

@BionIT + @xinruiba -- Per #5790 (comment) -- should we update the data source selector UI text from "Data Source" to "Data connection" as the pre-pended label for all of these pickers?

Hi @kgcreative , yeah, I can change the prepend!

@seraphjiang
Copy link
Member

@BionIT + @xinruiba -- Per #5790 (comment) -- should we update the data source selector UI text from "Data Source" to "Data connection" as the pre-pended label for all of these pickers?
Hi @kgcreative , yeah, I can change the prepend!

hi all, could we address that in separate PR to keep scope of this issue clear 🥹

@xinruiba
Copy link
Member Author

xinruiba commented Feb 15, 2024

Thanks @xinruiba for answering my questions and showing the current behavior offline! I wonder why we need this feature flag if it is just to hide the option from the picker, while backend, dashboards is still using local cluster to store saved objects. If this is just a UI feature flag for the picker, then we need to go back to the decide client logic to use a new property to decide which opensearch client to use, currently, it uses this UI feature flag and errors out for dashboards created in local cluster which will be confusing to users since users can still see the dashboard created in local cluster, but not able to use it.

cc @kgcreative @zengyan-amazon

Thanks for @BionIT @bandinib-amzn @Flyingliuhub's feed back.

We have following action items:

  1. In this PR, remove server-side error handling logic before merge in since it will make dashboard not render correctly.

  2. Fix Bug: “when datasource id is empty the search returns 500 error instead of 400” depend on “opensearch.hosts: ["http://localhost:9200"]” config in a separate PR. (Github Issue Link)

…ncy on UI config

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
@Flyingliuhub Flyingliuhub merged commit 26fc902 into opensearch-project:main Feb 15, 2024
68 of 69 checks passed
@BionIT
Copy link
Collaborator

BionIT commented Feb 20, 2024

Do we need to backport this PR to 2.x? @xinruiba

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

@xinruiba
Copy link
Member Author

Do we need to backport this PR to 2.x? @xinruiba

Sure, thanks for the notice, taking a look~

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

xinruiba added a commit to xinruiba/OpenSearch-Dashboards that referenced this pull request Feb 20, 2024
* [LocalCluster] support in devtool and index pattern creation page

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>

* [LocalCluster] support default cluster in home tutorial page

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>

* [LocalCluster] support default cluster in object import page

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>

---------

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
(cherry picked from commit 26fc902)
Flyingliuhub pushed a commit that referenced this pull request Feb 20, 2024
* [MD] Able to hide "Local Cluster" option  (#5827)

* [LocalCluster] support in devtool and index pattern creation page

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>

* [LocalCluster] support default cluster in home tutorial page

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>

* [LocalCluster] support default cluster in object import page

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>

---------

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
(cherry picked from commit 26fc902)

* Remove unneeded changelog.md change

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>

---------

Signed-off-by: Xinrui Bai <xinruiba@amazon.com>
@xinruiba xinruiba deleted the xinrui_LocalCluster_UX branch February 28, 2024 01:10
@manasvinibs
Copy link
Member

Manual Backport #5904

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.

8 participants