builderBreadCrumbs.tsx 897 B

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