allTransactionsView.tsx 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import {canUseMetricsData} from 'sentry/utils/performance/contexts/metricsEnhancedSetting';
  2. import {usePageAlert} from 'sentry/utils/performance/contexts/pageAlert';
  3. import {PerformanceDisplayProvider} from 'sentry/utils/performance/contexts/performanceDisplayContext';
  4. import useOrganization from 'sentry/utils/useOrganization';
  5. import Table from '../../table';
  6. import {ProjectPerformanceType} from '../../utils';
  7. import {DoubleChartRow, TripleChartRow} from '../widgets/components/widgetChartRow';
  8. import {PerformanceWidgetSetting} from '../widgets/widgetDefinitions';
  9. import type {BasePerformanceViewProps} from './types';
  10. export function AllTransactionsView(props: BasePerformanceViewProps) {
  11. const {setPageError} = usePageAlert();
  12. const doubleChartRowCharts: PerformanceWidgetSetting[] = [];
  13. const organization = useOrganization();
  14. let allowedCharts = [
  15. PerformanceWidgetSetting.USER_MISERY_AREA,
  16. PerformanceWidgetSetting.TPM_AREA,
  17. PerformanceWidgetSetting.FAILURE_RATE_AREA,
  18. PerformanceWidgetSetting.APDEX_AREA,
  19. PerformanceWidgetSetting.P50_DURATION_AREA,
  20. PerformanceWidgetSetting.P75_DURATION_AREA,
  21. PerformanceWidgetSetting.P95_DURATION_AREA,
  22. PerformanceWidgetSetting.P99_DURATION_AREA,
  23. ];
  24. const hasTransactionSummaryCleanupFlag = organization.features.includes(
  25. 'performance-transaction-summary-cleanup'
  26. );
  27. if (hasTransactionSummaryCleanupFlag) {
  28. allowedCharts = [
  29. PerformanceWidgetSetting.TPM_AREA,
  30. PerformanceWidgetSetting.FAILURE_RATE_AREA,
  31. PerformanceWidgetSetting.P50_DURATION_AREA,
  32. PerformanceWidgetSetting.P75_DURATION_AREA,
  33. PerformanceWidgetSetting.P95_DURATION_AREA,
  34. PerformanceWidgetSetting.P99_DURATION_AREA,
  35. ];
  36. }
  37. if (
  38. props.organization.features.includes('performance-new-trends') &&
  39. canUseMetricsData(props.organization)
  40. ) {
  41. if (props.organization.features.includes('insights-initial-modules')) {
  42. doubleChartRowCharts.unshift(PerformanceWidgetSetting.MOST_RELATED_ISSUES);
  43. doubleChartRowCharts.unshift(PerformanceWidgetSetting.MOST_CHANGED);
  44. doubleChartRowCharts.unshift(PerformanceWidgetSetting.MOST_TIME_CONSUMING_DOMAINS);
  45. doubleChartRowCharts.unshift(PerformanceWidgetSetting.MOST_TIME_SPENT_DB_QUERIES);
  46. } else {
  47. doubleChartRowCharts.unshift(PerformanceWidgetSetting.MOST_CHANGED);
  48. doubleChartRowCharts.unshift(PerformanceWidgetSetting.MOST_RELATED_ISSUES);
  49. }
  50. if (props.organization.features.includes('starfish-browser-webvitals')) {
  51. doubleChartRowCharts.unshift(PerformanceWidgetSetting.OVERALL_PERFORMANCE_SCORE);
  52. }
  53. } else {
  54. doubleChartRowCharts.unshift(PerformanceWidgetSetting.MOST_REGRESSED);
  55. doubleChartRowCharts.push(PerformanceWidgetSetting.MOST_IMPROVED);
  56. }
  57. return (
  58. <PerformanceDisplayProvider value={{performanceType: ProjectPerformanceType.ANY}}>
  59. <div data-test-id="all-transactions-view">
  60. <DoubleChartRow {...props} allowedCharts={doubleChartRowCharts} />
  61. <TripleChartRow {...props} allowedCharts={allowedCharts} />
  62. <Table {...props} setError={setPageError} />
  63. </div>
  64. </PerformanceDisplayProvider>
  65. );
  66. }