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]Read hideLocalCluster setting from yml and set in data source selector and data source menu #6361

Merged
merged 2 commits into from
Apr 8, 2024

Conversation

zhongnansu
Copy link
Member

@zhongnansu zhongnansu commented Apr 7, 2024

Description

  • Read data_source.hideLocalCluster setting from opensearch_dashboards.yml, and always use this value to decide if to hide local cluster in DataSourceSelector and DataSourceMenu. This is expected behaviour because hide/show local cluster in data source visual components should be consistent across anywhere that consumes those components.
  • make hideLocalHost an optional property of DataSourceSelector and DataSourceMenu
  • Update related unit tests

Issues Resolved

#6336

Screenshot

iShot_2024-04-08_00.34.05.mp4

Testing the changes

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
Collaborator

@BionIT BionIT left a comment

Choose a reason for hiding this comment

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

Added comments, in the recording, we can also show the local cluster should not be an option any more in the drop down when hidelocalcluster prop is set true

</EuiHeaderLinks>
</MountPointPortal>
);
}
return <DataSourceMenu {...props} />;
return <DataSourceMenu {...props} hideLocalCluster={hideLocalCluster} />;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like we missed adding the uiSettings option here in 726fb0e, could you help to add uiSettings here, to test, please use the example plugin for top nav menu https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/examples/multiple_data_source_examples/public/components/data_source_via_top_nav_menu.tsx

Copy link
Member Author

@zhongnansu zhongnansu Apr 8, 2024

Choose a reason for hiding this comment

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

Added. However when I tried to test it by using DataSourceSelectable for top nav menu, it doesn't show "default" label for any options, Here's the recording.

iShot_2024-04-08_00.11.24.mp4

I think the issue is with that in top_nav_menu.tsx, DataSourceMenu is not obtained by calling the dataSourceManagement.ui.getDataSourceMenu<DataSourceSelectableConfig>();, but through a direct import as below code suggests.

import { DataSourceMenu, DataSourceMenuProps } from '../../../data_source_management/public';

Therefore, even I added the uiSetting to createDataSourceMenu(), it makes no difference for top nav menu use case, because ui.getDataSourceMenu API is never called, and uiSetting is never being passed through.

To solve this, we may want to make change to retrieve DataSourceMenu through the ui.getDataSourceMenu in top_nav_menu.tsx. This also brings up another issue with dev_tool and tutorial plugin, should they also change the way how they consume data source selector, to have consistent behavior? @BionIT What do you think? I can file an issue if it makes sense

Copy link
Collaborator

Choose a reason for hiding this comment

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

Right, yeah, could you help to cut an issue for that?

Copy link
Member Author

@zhongnansu zhongnansu Apr 8, 2024

Choose a reason for hiding this comment

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

created issue #6368 and #6369

@zhongnansu
Copy link
Member Author

Added comments, in the recording, we can also show the local cluster should not be an option any more in the drop down when hidelocalcluster prop is set true

sure, updated the recording

…ector and data source menu

Signed-off-by: Zhongnan Su <szhongna@amazon.com>
Copy link

codecov bot commented Apr 8, 2024

Codecov Report

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

Project coverage is 54.53%. Comparing base (a0eaf84) to head (9e04be8).

❗ Current head 9e04be8 differs from pull request most recent head af54941. Consider uploading reports for the commit af54941 to get more accurate results

Files Patch % Lines
...rc/plugins/data_source_management/public/plugin.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #6361       +/-   ##
===========================================
- Coverage   67.56%   54.53%   -13.04%     
===========================================
  Files        3379     2271     -1108     
  Lines       65894    44499    -21395     
  Branches    10660     8276     -2384     
===========================================
- Hits        44522    24268    -20254     
+ Misses      18774    18469      -305     
+ Partials     2598     1762      -836     
Flag Coverage Δ
Linux_1 ?
Linux_2 ?
Linux_3 45.01% <88.88%> (+<0.01%) ⬆️
Linux_4 34.98% <0.00%> (-0.01%) ⬇️
Windows_1 ?
Windows_2 ?
Windows_3 ?
Windows_4 ?

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.

BionIT
BionIT previously approved these changes Apr 8, 2024
Copy link
Contributor

@yujin-emma yujin-emma left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Zhongnan Su <szhongna@amazon.com>
@BionIT BionIT merged commit b4130aa into opensearch-project:main Apr 8, 2024
66 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 8, 2024
…ector and data source menu (#6361)

* [MD]Read hideLocalCluster setting from yml and set in data source selector and data source menu

Signed-off-by: Zhongnan Su <szhongna@amazon.com>

* improve naming

Signed-off-by: Zhongnan Su <szhongna@amazon.com>

---------

Signed-off-by: Zhongnan Su <szhongna@amazon.com>
(cherry picked from commit b4130aa)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
BionIT pushed a commit that referenced this pull request Apr 9, 2024
…ector and data source menu (#6361) (#6374)

* [MD]Read hideLocalCluster setting from yml and set in data source selector and data source menu

Signed-off-by: Zhongnan Su <szhongna@amazon.com>

* improve naming

Signed-off-by: Zhongnan Su <szhongna@amazon.com>

---------

Signed-off-by: Zhongnan Su <szhongna@amazon.com>
(cherry picked from commit b4130aa)
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>
@zhongnansu zhongnansu mentioned this pull request Apr 16, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants