utils.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import {
  2. PlatformKey,
  3. withoutPerformanceSupport,
  4. withPerformanceOnboarding,
  5. } from 'sentry/data/platformCategories';
  6. import {PlatformIntegration, Project} from 'sentry/types';
  7. export function filterProjects(rawProjects: Project[]) {
  8. // filter on projects that have not sent a first transaction event
  9. const projectsWithoutFirstTransactionEvent = rawProjects.filter(
  10. p =>
  11. p.firstTransactionEvent === false &&
  12. (!p.platform || !withoutPerformanceSupport.has(p.platform))
  13. );
  14. // additionally filter on projects that have performance onboarding checklist support
  15. const projectsForOnboarding = projectsWithoutFirstTransactionEvent.filter(
  16. p => p.platform && withPerformanceOnboarding.has(p.platform)
  17. );
  18. return {
  19. projectsWithoutFirstTransactionEvent,
  20. projectsForOnboarding,
  21. };
  22. }
  23. export function generateDocKeys(platform: PlatformKey): string[] {
  24. return ['1-install', '2-configure', '3-verify'].map(
  25. key => `${platform}-performance-onboarding-${key}`
  26. );
  27. }
  28. export function isPlatformSupported(platform: undefined | PlatformIntegration) {
  29. if (!platform) {
  30. return false;
  31. }
  32. const hasPerformanceOnboarding = platform
  33. ? withPerformanceOnboarding.has(platform.id)
  34. : false;
  35. const doesNotSupportPerformance = platform
  36. ? withoutPerformanceSupport.has(platform.id)
  37. : false;
  38. return hasPerformanceOnboarding && !doesNotSupportPerformance;
  39. }