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

Refactor observability plugin breadcrumbs #102290

Merged
merged 5 commits into from
Jun 17, 2021
Merged

Conversation

smith
Copy link
Contributor

@smith smith commented Jun 16, 2021

Previously the observability plugin set the page title and breadcrumbs in the main app rendering component based on the breadcrumb property of the current route.

In addition, there's a useBreadcrumb hook used by the UX app, exploratory view, and cases.

The conflict between these was creating situations where neither would work and the breadcrumbs would just show "Kibana".

Remove the breadcrumb properties from the routes and the main app breadcrumb handling and just use useBreadcrumb on all pages.

Fixes #102131.

Previously the observability plugin set the page title and breadcrumbs in the main app rendering component based on the `breadcrumb` property of the current route.

In addition, there's a `useBreadcrumb` hook used by the UX app, exploratory view, and cases.

The conflict between these was creating situations where neither would work and the breadcrumbs would just show "Kibana".

Remove the breadcrumb properties from the routes and the main app breadcrumb handling and just use `useBreadcrumb` on all pages.

Fixes elastic#102131.
@smith smith added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:Observability Team label for Observability Team (for things that are handled across all of observability) v7.14.0 auto-backport Deprecated - use backport:version if exact versions are needed Theme: rac label obsolete labels Jun 16, 2021
@smith smith requested review from shahzad31, stephmilovic and a team June 16, 2021 04:55
@@ -6,30 +6,25 @@
*/

import { i18n } from '@kbn/i18n';
import React, { MouseEvent, useEffect } from 'react';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorting imports here.

@@ -17262,7 +17262,6 @@
"xpack.monitoring.updateLicenseButtonLabel": "ライセンスを更新",
"xpack.monitoring.updateLicenseTitle": "ライセンスの更新",
"xpack.monitoring.useAvailableLicenseDescription": "すでに新しいライセンスがある場合は、今すぐアップロードしてください。",
"xpack.observability.alerts.breadcrumb": "アラート",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Bamieh most of these still exist but have been replaced by keys that more closely match Kibana i18n guidelines.

href,
};
};
export const casesBreadcrumbs = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These were moved into pages/cases/links.ts.

expect(setTitle).toHaveBeenCalledWith(['Two', 'One', 'Observability']);
});
});
});
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 adding tests!

defaultMessage: 'Alerts',
}),
},
]);
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a good way to set breadcrumbs. Should we do something similar for APM?

Btw. I'm wondering if Kibana should provide something like this. Seems odd that every plugin reinvents the wheel.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, if this can be moved up the hierarchy, we had this hook originally in uptime, and we moved it here, to be used in UX app and other places.

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 think we can use this mostly as-is in APM or other places (it's currently used in UX as Shahzad mentioned.)

There's ongoing discussion in elastic/observability-design#53.

Copy link
Member

@sorenlouv sorenlouv left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

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

Looks Good !!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
observability 451.3KB 450.9KB -463.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
observability 52.7KB 52.5KB -280.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@stephmilovic
Copy link
Contributor

I'm still seeing the bug where the breadcrumbs go to "Kibana" on the first navigation click within Cases. The second time behaves as expected:
bcbug

@smith
Copy link
Contributor Author

smith commented Jun 16, 2021

@stephmilovic you're right wtf? I'll check it out.

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

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

Sure enough, the bug was my fault 😆 Got it fixed here: #102429

Thanks for your help with this @smith, LGTM!

@smith smith merged commit 6113520 into elastic:master Jun 17, 2021
@smith smith deleted the nls/obs-bread branch June 17, 2021 05:27
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 17, 2021
Previously the observability plugin set the page title and breadcrumbs in the main app rendering component based on the `breadcrumb` property of the current route.

In addition, there's a `useBreadcrumb` hook used by the UX app, exploratory view, and cases.

The conflict between these was creating situations where neither would work and the breadcrumbs would just show "Kibana".

Remove the breadcrumb properties from the routes and the main app breadcrumb handling and just use `useBreadcrumb` on all pages.

Fixes elastic#102131.
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Jun 17, 2021
Previously the observability plugin set the page title and breadcrumbs in the main app rendering component based on the `breadcrumb` property of the current route.

In addition, there's a `useBreadcrumb` hook used by the UX app, exploratory view, and cases.

The conflict between these was creating situations where neither would work and the breadcrumbs would just show "Kibana".

Remove the breadcrumb properties from the routes and the main app breadcrumb handling and just use `useBreadcrumb` on all pages.

Fixes #102131.

Co-authored-by: Nathan L Smith <nathan.smith@elastic.co>
jloleysens added a commit to jloleysens/kibana that referenced this pull request Jun 17, 2021
…egrations-to-global-search

* 'master' of github.com:elastic/kibana: (46 commits)
  [Lens] Add some more documentation for dynamic coloring (elastic#101369)
  hide not searchable results when no term (elastic#102401)
  [Lens] Fix Formula functional test with multiple suggestions (elastic#102378)
  Fix trusted apps modified by field displayed as a date field (elastic#102377)
  [Lens] Docs for time shift (elastic#102048)
  update readme of logs-metrics-ui (elastic#101968)
  Refactor observability plugin breadcrumbs (elastic#102290)
  [Index Patterns] Move rollup config to index pattern management v2 (elastic#102285)
  [Security Solution][Endpoint] Isolate Action should only be available to Platinum+ licenses (elastic#102374)
  [build] Updates Ironbank templates (elastic#102407)
  Update security best practices document (elastic#100814)
  [Enterprise Search] Set up initial KibanaPageTemplate  (elastic#102170)
  [Reporting/Docs] Add section to troubleshooting guide to explain the StatusCodeError logs (elastic#102278)
  [DOCS] Updating Elastic Security Overview topic  (elastic#101922)
  [Uptime] refactor Synthetics Integration package UI (elastic#102080)
  [Task Manager] Log at different levels based on the state (elastic#101751)
  [APM] Fixing time comparison types (elastic#101423)
  [RAC] Update alert documents in lifecycle rule type helper (elastic#101598)
  [ML] Functional tests - fix and re-activate alerting flyout test (elastic#102368)
  [Reporting] remove unused reference to path.data config (elastic#102267)
  ...

# Conflicts:
#	x-pack/plugins/fleet/kibana.json
majagrubic pushed a commit to majagrubic/kibana that referenced this pull request Jun 18, 2021
Previously the observability plugin set the page title and breadcrumbs in the main app rendering component based on the `breadcrumb` property of the current route.

In addition, there's a `useBreadcrumb` hook used by the UX app, exploratory view, and cases.

The conflict between these was creating situations where neither would work and the breadcrumbs would just show "Kibana".

Remove the breadcrumb properties from the routes and the main app breadcrumb handling and just use `useBreadcrumb` on all pages.

Fixes elastic#102131.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:Observability Team label for Observability Team (for things that are handled across all of observability) Theme: rac label obsolete v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken breadcrumbs in observability
5 participants