builderBreadCrumbs.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import type {Crumb, CrumbDropdown} from 'sentry/components/breadcrumbs';
  2. import Breadcrumbs from 'sentry/components/breadcrumbs';
  3. import {t} from 'sentry/locale';
  4. import type {Organization} from 'sentry/types/organization';
  5. import {makeAlertsPathname} from 'sentry/views/alerts/pathnames';
  6. interface Props {
  7. organization: Organization;
  8. projectSlug: string;
  9. title: string;
  10. alertName?: string;
  11. }
  12. function BuilderBreadCrumbs({title, alertName, projectSlug, organization}: Props) {
  13. const crumbs: Array<Crumb | CrumbDropdown> = [
  14. {
  15. to: makeAlertsPathname({
  16. path: '/rules/',
  17. organization,
  18. }),
  19. label: t('Alerts'),
  20. preservePageFilters: true,
  21. },
  22. {
  23. label: title,
  24. ...(alertName
  25. ? {
  26. to: makeAlertsPathname({
  27. path: `/${projectSlug}/wizard/`,
  28. organization,
  29. }),
  30. preservePageFilters: true,
  31. }
  32. : {}),
  33. },
  34. ];
  35. if (alertName) {
  36. crumbs.push({label: alertName});
  37. }
  38. return <Breadcrumbs crumbs={crumbs} />;
  39. }
  40. export default BuilderBreadCrumbs;