profilingTable.tsx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import {Location} from 'history';
  2. import GridEditable, {COL_WIDTH_UNDEFINED} from 'sentry/components/gridEditable';
  3. import {t} from 'sentry/locale';
  4. import {Trace} from 'sentry/types/profiling/core';
  5. import {ProfilingTableCell} from './profilingTableCell';
  6. import {TableColumn, TableColumnKey, TableColumnOrders, TableDataRow} from './types';
  7. interface ProfilingTableProps {
  8. error: string | null;
  9. isLoading: boolean;
  10. location: Location;
  11. traces: Trace[];
  12. }
  13. function ProfilingTable({error, isLoading, location, traces}: ProfilingTableProps) {
  14. return (
  15. <GridEditable
  16. isLoading={isLoading}
  17. error={error}
  18. data={traces}
  19. columnOrder={COLUMN_ORDER.map(key => COLUMNS[key])}
  20. columnSortBy={[]}
  21. grid={{renderBodyCell: renderProfilingTableCell}}
  22. location={location}
  23. />
  24. );
  25. }
  26. function renderProfilingTableCell(
  27. column: TableColumn,
  28. dataRow: TableDataRow,
  29. rowIndex: number,
  30. columnIndex: number
  31. ) {
  32. return (
  33. <ProfilingTableCell
  34. column={column}
  35. dataRow={dataRow}
  36. rowIndex={rowIndex}
  37. columnIndex={columnIndex}
  38. />
  39. );
  40. }
  41. const COLUMN_ORDER: TableColumnKey[] = [
  42. 'id',
  43. 'failed',
  44. 'app_version',
  45. 'interaction_name',
  46. 'start_time_unix',
  47. 'trace_duration_ms',
  48. 'device_model',
  49. 'device_class',
  50. ];
  51. const COLUMNS: TableColumnOrders = {
  52. id: {
  53. key: 'id',
  54. name: t('Flamegraph'),
  55. width: COL_WIDTH_UNDEFINED,
  56. },
  57. failed: {
  58. key: 'failed',
  59. name: t('Status'),
  60. width: COL_WIDTH_UNDEFINED,
  61. },
  62. app_version: {
  63. key: 'app_version',
  64. name: t('Version'),
  65. width: COL_WIDTH_UNDEFINED,
  66. },
  67. interaction_name: {
  68. key: 'interaction_name',
  69. name: t('Interaction Name'),
  70. width: COL_WIDTH_UNDEFINED,
  71. },
  72. start_time_unix: {
  73. key: 'start_time_unix',
  74. name: t('Timestamp'),
  75. width: COL_WIDTH_UNDEFINED,
  76. },
  77. trace_duration_ms: {
  78. key: 'trace_duration_ms',
  79. name: t('Duration'),
  80. width: COL_WIDTH_UNDEFINED,
  81. },
  82. device_model: {
  83. key: 'device_model',
  84. name: t('Device Model'),
  85. width: COL_WIDTH_UNDEFINED,
  86. },
  87. device_class: {
  88. key: 'device_class',
  89. name: t('Device Class'),
  90. width: COL_WIDTH_UNDEFINED,
  91. },
  92. };
  93. export {ProfilingTable};