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

Add navControlsPrimaryHeaderRight slot to header #9223

Conversation

wanglam
Copy link
Contributor

@wanglam wanglam commented Jan 20, 2025

Description

This PR is for adding a new nav control slot for the primary header when the new home experience is enabled. There are many existing right nav control slots in the page header, but currently, there is no existing slot to add components to the right side of the primary header, next to the breadcrumbs bar.

Here are some screenshots to explain the existing slots in different page headers:

  • Legacy page header (new home disabled):
    image

  • Application page header (new home enabled):
    image

  • Basic page header (new home enabled):
    image

With this PR, a new nav control slot has been introduced to allow components to be placed in the primary header, next to the breadcrumbs bar, when the new home experience is enabled. Here's how it will look:

  • Basic page header (new home enabled):
    image

  • Application page header (new home enabled):
    image

Changelog

  • feat: Add navControlsPrimaryHeaderRight slot to header

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: Lin Wang <wonglam@amazon.com>
Copy link

codecov bot commented Jan 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.67%. Comparing base (ca7c899) to head (6720a52).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9223   +/-   ##
=======================================
  Coverage   61.67%   61.67%           
=======================================
  Files        3817     3817           
  Lines       91719    91725    +6     
  Branches    14517    14517           
=======================================
+ Hits        56565    56569    +4     
- Misses      31524    31525    +1     
- Partials     3630     3631    +1     
Flag Coverage Δ
Linux_1 29.04% <0.00%> (-0.01%) ⬇️
Linux_2 56.46% <100.00%> (+0.01%) ⬆️
Linux_3 39.08% <0.00%> (-0.01%) ⬇️
Linux_4 28.98% <0.00%> (-0.01%) ⬇️
Windows_1 29.06% <0.00%> (-0.01%) ⬇️
Windows_2 56.41% <100.00%> (+0.01%) ⬆️
Windows_3 39.09% <0.00%> (-0.01%) ⬇️
Windows_4 28.98% <0.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.

Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
SuZhou-Joe
SuZhou-Joe previously approved these changes Jan 21, 2025
@@ -64,6 +64,8 @@ export interface ChromeNavControls {
registerCenter(navControl: ChromeNavControl): void;
/** Register a nav control to be presented on the left-bottom side of the left navigation. */
registerLeftBottom(navControl: ChromeNavControl): void;
/** Register a nav control to be presented on the right side of the new primary chrome header. */
Copy link
Member

Choose a reason for hiding this comment

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

what does the "new primary chrome header" refer to?

Copy link
Member

Choose a reason for hiding this comment

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

So we're trying to introduce an API to register a global control button which is available for all application headers and page headers. Can we simply call it registerHeaderRight?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm open to renaming it to registerHeaderRight. I just want to add some explanations for my naming convention. I added 'New' to distinguish it from the legacy header since this slot won't be displayed in that header. I added 'Primary' to distinguish it from the secondary header, as it's positioned on the right side of the primary header. Do you think this naming convention is reasonable? Using 'headerRight' is simpler, but I'm not sure if it might confuse others into thinking that the registered elements won't be displayed.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation! I got the point of "Primary" now :)
For "New", since legacy header is meant to be deprecated, so I don't feel necessary to distinguish it from the legacy one, imagine in the future, the legacy header was removed, then the "New" will sound a bit strange. what about calling it registerPrimaryHeaderRight?

Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
Signed-off-by: Lin Wang <wonglam@amazon.com>
@wanglam wanglam changed the title Add navControlsNewPrimaryHeaderRight slot to header Add navControlsPrimaryHeaderRight slot to header Jan 22, 2025
@SuZhou-Joe SuZhou-Joe merged commit 8ae1c71 into opensearch-project:main Jan 22, 2025
68 of 70 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 22, 2025
* Add navControlNewPrimaryRight slot to header

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Changeset file for PR #9223 created/updated

* Fix vertical align for header items

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Fix test coverage drop

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Fix failed UTs

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Fix bootstrap failed

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Update failed snapshots

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Remove left border

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Refactor with headerRight

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Renaming to primaryHeaderRight

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Changeset file for PR #9223 created/updated

---------

Signed-off-by: Lin Wang <wonglam@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 8ae1c71)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Jan 23, 2025
* Add navControlNewPrimaryRight slot to header



* Changeset file for PR #9223 created/updated

* Fix vertical align for header items



* Fix test coverage drop



* Fix failed UTs



* Fix bootstrap failed



* Update failed snapshots



* Remove left border



* Refactor with headerRight



* Renaming to primaryHeaderRight



* Changeset file for PR #9223 created/updated

---------



(cherry picked from commit 8ae1c71)

Signed-off-by: Lin Wang <wonglam@amazon.com>
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.

3 participants