-
Notifications
You must be signed in to change notification settings - Fork 918
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
feat: Introduce registerCollapsibleNavHeader
to ChromeService
#5244
feat: Introduce registerCollapsibleNavHeader
to ChromeService
#5244
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5244 +/- ##
=======================================
Coverage 67.02% 67.02%
=======================================
Files 3294 3294
Lines 63298 63306 +8
Branches 10067 10069 +2
=======================================
+ Hits 42424 42431 +7
Misses 18431 18431
- Partials 2443 2444 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@ruanyl This approach seems reasonable to me. Two other alternatives you can look at here are:
Given the draw backs with both the other approaches, I think your solution here makes the most sense. The one drawback with your API though is that another plugin can override your registration. |
@ashwin-pc Thanks for the feedbacks! About this comment:
You're right, I'm actually aware of this. There could potentially two options:
However, I'm not sure which one will best suite the real use case, to avoid over-optimize at the early stage, I keep it like this for now as currently there is only one use case from workspace plugin. We can always come back to this later. |
cf82469
to
92d1251
Compare
Good to know that you thought of it :) Yeah i like your first option to add a check during registration to throw an error if registration is attempted twice. This way we can at least know when this happens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ae21637
to
de14bf0
Compare
@ashwin-pc I added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @ruanyl can you resolve the conflicts in the changelog ?
This commit introduces an enhancement to the ChromeService class within our core application. It adds a new method named `registerCollapsibleNavHeader`, allowing plugins to customize the rendering of the collapsible navigation header in the global chrome UI. With this new capability, plugins can now register their own rendering logic for the collapsible navigation header. This feature enhances the extensibility of our core system, empowering plugins to provide a more tailored and user-friendly navigation experience. Key changes in this commit include: 1. The addition of the `registerCollapsibleNavHeader` method to the ChromeService class. 2. Appropriate updates to tests and typings to support the newly introduced functionality. Signed-off-by: Yulong Ruan <[email protected]>
+ tests Signed-off-by: Yulong Ruan <[email protected]>
…ridden Signed-off-by: Yulong Ruan <[email protected]>
Signed-off-by: Yulong Ruan <[email protected]>
42a07de
to
e973515
Compare
@@ -941,4 +942,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | |||
|
|||
### 🔩 Tests | |||
|
|||
- Update caniuse to fix failed integration tests ([#2322](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2322)) | |||
- Update caniuse to fix failed integration tests ([#2322](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2322)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: unnecessary change on this line I suppose.
…eader Signed-off-by: Manasvini B Suryanarayana <[email protected]>
e2fc4d6
The backport to
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-5244-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5695f9b3407354333010c79330d6ddefa30dc65a
# Push it to GitHub
git push --set-upstream origin backport/backport-5244-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 |
…search-project#5244) * feat: Introduce `registerCollapsibleNavHeader` to ChromeService This commit introduces an enhancement to the ChromeService class within our core application. It adds a new method named `registerCollapsibleNavHeader`, allowing plugins to customize the rendering of the collapsible navigation header in the global chrome UI. With this new capability, plugins can now register their own rendering logic for the collapsible navigation header. This feature enhances the extensibility of our core system, empowering plugins to provide a more tailored and user-friendly navigation experience. Key changes in this commit include: 1. The addition of the `registerCollapsibleNavHeader` method to the ChromeService class. 2. Appropriate updates to tests and typings to support the newly introduced functionality. Signed-off-by: Yulong Ruan <[email protected]> * Add changelog for custom nav menu header register + tests Signed-off-by: Yulong Ruan <[email protected]> * Add a warning message to console when custom nav bar header been overridden Signed-off-by: Yulong Ruan <[email protected]> * Add tests for registerCollapsibleNavHeader warning console output Signed-off-by: Yulong Ruan <[email protected]> --------- Signed-off-by: Yulong Ruan <[email protected]> Signed-off-by: Manasvini B Suryanarayana <[email protected]> Co-authored-by: Manasvini B Suryanarayana <[email protected]>
Description
This commit introduces an enhancement to the ChromeService class within our core application. It adds a new method named
registerCollapsibleNavHeader
, allowing plugins to customize the rendering of the collapsible navigation header in the global chrome UI.With this new capability, plugins can now register their own rendering logic for the collapsible navigation header. This feature enhances the extensibility of our core system, empowering plugins to provide a more tailored and user-friendly navigation experience.
Key changes in this commit include:
registerCollapsibleNavHeader
method to the ChromeService class.Why introducing this change?
The upcoming workspace feature will bring noticeable change to the left navigation menu. One newly added component is the "Workspace Selector" component. This is a context menu on the top of the left navigation bar which enables easy navigation among workspaces. This PR tries to extend the chrome module with a generic method for plugins to customize the navigation bar's header.
I'm more seeking for suggestions/different opinions with this PR, please feel free to give feedback if you have different implementation ideas.
Issues Resolved
Partially resolved: #5091
Screenshot
Testing the changes
Check List
yarn test:jest
yarn test:jest_integration