utils.tsx 1003 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import {Query} from 'history';
  2. import {SpanSlug} from 'sentry/utils/performance/suspectSpans/types';
  3. export function generateSpanDetailsRoute({
  4. orgSlug,
  5. spanSlug,
  6. }: {
  7. orgSlug: string;
  8. spanSlug: SpanSlug;
  9. }): string {
  10. const spanComponent = `${encodeURIComponent(spanSlug.op)}:${spanSlug.group}`;
  11. return `/organizations/${orgSlug}/performance/summary/spans/${spanComponent}/`;
  12. }
  13. export function spanDetailsRouteWithQuery({
  14. orgSlug,
  15. transaction,
  16. query,
  17. spanSlug,
  18. projectID,
  19. }: {
  20. orgSlug: string;
  21. query: Query;
  22. spanSlug: SpanSlug;
  23. transaction: string;
  24. projectID?: string | string[];
  25. }) {
  26. const pathname = generateSpanDetailsRoute({
  27. orgSlug,
  28. spanSlug,
  29. });
  30. return {
  31. pathname,
  32. query: {
  33. transaction,
  34. project: projectID,
  35. environment: query.environment,
  36. statsPeriod: query.statsPeriod,
  37. start: query.start,
  38. end: query.end,
  39. query: query.query,
  40. },
  41. };
  42. }
  43. export enum ZoomKeys {
  44. MIN = 'min',
  45. MAX = 'max',
  46. }