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

[Navigation-next] Enrich breadcrumbs by workspace and use case #7360

Merged
merged 4 commits into from
Jul 23, 2024

Conversation

Hailong-am
Copy link
Collaborator

@Hailong-am Hailong-am commented Jul 22, 2024

Description

  1. when workspace is not enabled, enrich breadcrumbs with current nav group
  2. when workspace is enabled, enrich breadcrumbs with workspace and its use case

Issues Resolved

#7359

Screenshot

in workspace
image

workspace with all use case
image

workspace disabled
image

Testing the changes

Changelog

  • feat: Enrich breadcrumbs by workspace and use case

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: Hailong Cui <ihailong@amazon.com>
Signed-off-by: Hailong Cui <ihailong@amazon.com>
opensearch-changeset-bot bot and others added 2 commits July 22, 2024 10:33
Copy link

codecov bot commented Jul 22, 2024

Codecov Report

Attention: Patch coverage is 80.30303% with 13 lines in your changes missing coverage. Please review.

Project coverage is 67.72%. Comparing base (e64de15) to head (f793f0e).
Report is 12 commits behind head on main.

Files Patch % Lines
src/plugins/workspace/public/utils.ts 72.00% 5 Missing and 2 partials ⚠️
.../core/public/chrome/nav_group/nav_group_service.ts 86.20% 3 Missing and 1 partial ⚠️
src/core/public/chrome/chrome_service.tsx 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7360      +/-   ##
==========================================
+ Coverage   67.70%   67.72%   +0.01%     
==========================================
  Files        3520     3520              
  Lines       69700    69752      +52     
  Branches    11376    11388      +12     
==========================================
+ Hits        47189    47237      +48     
- Misses      19716    19719       +3     
- Partials     2795     2796       +1     
Flag Coverage Δ
Linux_1 33.18% <28.78%> (+<0.01%) ⬆️
Linux_2 55.51% <85.00%> (+0.04%) ⬆️
Linux_3 43.27% <0.00%> (-0.05%) ⬇️
Linux_4 34.68% <0.00%> (-0.03%) ⬇️
Windows_1 33.21% <28.78%> (+<0.01%) ⬆️
Windows_2 55.46% <85.00%> (+0.04%) ⬆️
Windows_3 43.29% <0.00%> (-0.04%) ⬇️
Windows_4 34.69% <0.00%> (-0.02%) ⬇️

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.

const appTitle = useObservable(appTitle$, 'OpenSearch Dashboards');
const breadcrumbs = useObservable(breadcrumbs$, []);
const [breadcrumbEnricher, setBreadcrumbEnricher] = useState<
Copy link
Member

Choose a reason for hiding this comment

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

useObservable should be good enough give the enriched value.

Copy link
Collaborator Author

@Hailong-am Hailong-am Jul 23, 2024

Choose a reason for hiding this comment

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

as the enricher is a function, setBreadcrumbEnricher will call/execute the function automatically, that's why to use useEffect + useState and change default behavior to below. cc @wanglam

 const sub = breadcrumbsEnricher$.subscribe((enricher) => {
      setBreadcrumbEnricher(() => enricher);
    });

Copy link
Member

@ruanyl ruanyl Jul 23, 2024

Choose a reason for hiding this comment

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

Can't we just do useObservable(breadcrumbsEnricher$)?

@ruanyl ruanyl merged commit 7ff8544 into opensearch-project:main Jul 23, 2024
75 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 23, 2024
* breadcrumbs for workspace

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* add unit test

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* Changeset file for PR #7360 created/updated

* add unit test

Signed-off-by: Hailong Cui <ihailong@amazon.com>

---------

Signed-off-by: Hailong Cui <ihailong@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 7ff8544)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 23, 2024
* breadcrumbs for workspace

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* add unit test

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* Changeset file for PR #7360 created/updated

* add unit test

Signed-off-by: Hailong Cui <ihailong@amazon.com>

---------

Signed-off-by: Hailong Cui <ihailong@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 7ff8544)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ruanyl pushed a commit that referenced this pull request Jul 23, 2024
#7392)

* breadcrumbs for workspace



* add unit test



* Changeset file for PR #7360 created/updated

* add unit test



---------



(cherry picked from commit 7ff8544)

Signed-off-by: Hailong Cui <ihailong@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>
ruanyl pushed a commit that referenced this pull request Jul 23, 2024
#7393)

* breadcrumbs for workspace



* add unit test



* Changeset file for PR #7360 created/updated

* add unit test



---------



(cherry picked from commit 7ff8544)

Signed-off-by: Hailong Cui <ihailong@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