breadcrumbs.tsx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import SvgIcon from 'sentry/icons/svgIcon';
  2. import {Color} from 'sentry/utils/theme';
  3. export type IconProps = React.ComponentProps<typeof SvgIcon>;
  4. export enum BreadcrumbLevelType {
  5. FATAL = 'fatal',
  6. ERROR = 'error',
  7. WARNING = 'warning',
  8. INFO = 'info',
  9. DEBUG = 'debug',
  10. UNDEFINED = 'undefined',
  11. }
  12. export enum BreadcrumbType {
  13. INFO = 'info',
  14. DEBUG = 'debug',
  15. MESSAGE = 'message',
  16. QUERY = 'query',
  17. UI = 'ui',
  18. USER = 'user',
  19. EXCEPTION = 'exception',
  20. WARNING = 'warning',
  21. ERROR = 'error',
  22. DEFAULT = 'default',
  23. HTTP = 'http',
  24. NAVIGATION = 'navigation',
  25. SYSTEM = 'system',
  26. SESSION = 'session',
  27. TRANSACTION = 'transaction',
  28. }
  29. type BreadcrumbTypeBase = {
  30. level: BreadcrumbLevelType;
  31. // it's recommended
  32. category?: string | null;
  33. event_id?: string;
  34. message?: string;
  35. timestamp?: string;
  36. };
  37. export type BreadcrumbTypeSystem = {
  38. action: string;
  39. extras: Record<string, any>;
  40. type: BreadcrumbType.SYSTEM;
  41. } & BreadcrumbTypeBase;
  42. export type BreadcrumbTypeSession = {
  43. action: string;
  44. extras: Record<string, any>;
  45. type: BreadcrumbType.SESSION;
  46. } & BreadcrumbTypeBase;
  47. export type BreadcrumbTypeNavigation = {
  48. type: BreadcrumbType.NAVIGATION;
  49. data?: {
  50. from?: string;
  51. to?: string;
  52. };
  53. } & BreadcrumbTypeBase;
  54. export type BreadcrumbTypeHTTP = {
  55. type: BreadcrumbType.HTTP;
  56. data?: {
  57. method?:
  58. | 'POST'
  59. | 'PUT'
  60. | 'GET'
  61. | 'HEAD'
  62. | 'DELETE'
  63. | 'CONNECT'
  64. | 'OPTIONS'
  65. | 'TRACE'
  66. | 'PATCH';
  67. reason?: string;
  68. status_code?: number;
  69. url?: string;
  70. };
  71. } & BreadcrumbTypeBase;
  72. export type BreadcrumbTypeDefault = {
  73. type:
  74. | BreadcrumbType.INFO
  75. | BreadcrumbType.DEBUG
  76. | BreadcrumbType.QUERY
  77. | BreadcrumbType.UI
  78. | BreadcrumbType.USER
  79. | BreadcrumbType.EXCEPTION
  80. | BreadcrumbType.WARNING
  81. | BreadcrumbType.ERROR
  82. | BreadcrumbType.DEFAULT
  83. | BreadcrumbType.SESSION
  84. | BreadcrumbType.SYSTEM
  85. | BreadcrumbType.SESSION
  86. | BreadcrumbType.TRANSACTION;
  87. data?: Record<string, any>;
  88. } & BreadcrumbTypeBase;
  89. export type RawCrumb =
  90. | BreadcrumbTypeNavigation
  91. | BreadcrumbTypeHTTP
  92. | BreadcrumbTypeDefault;
  93. export type Crumb = RawCrumb & {
  94. color: Color;
  95. description: string;
  96. id: number;
  97. };