import {Fragment} from 'react'; import * as qs from 'query-string'; import GridEditable, { COL_WIDTH_UNDEFINED, GridColumnHeader, } from 'sentry/components/gridEditable'; import Link from 'sentry/components/links/link'; import Truncate from 'sentry/components/truncate'; import {formatPercentage} from 'sentry/utils/formatters'; import {useLocation} from 'sentry/utils/useLocation'; import DurationCell from 'sentry/views/starfish/components/tableCells/durationCell'; import ThroughputCell from 'sentry/views/starfish/components/tableCells/throughputCell'; import {TimeSpentCell} from 'sentry/views/starfish/components/tableCells/timeSpentCell'; import type {IndexedSpan} from 'sentry/views/starfish/queries/types'; import { SpanTransactionMetrics, useSpanTransactionMetrics, } from 'sentry/views/starfish/queries/useSpanTransactionMetrics'; import {DataTitles} from 'sentry/views/starfish/views/spans/types'; type Row = { metrics: SpanTransactionMetrics; transaction: string; }; type Props = { span: Pick; onClickTransaction?: (row: Row) => void; openSidebar?: boolean; }; export type Keys = | 'transaction' | 'p95(transaction.duration)' | 'time_spent_percentage(local)' | 'spm()'; export type TableColumnHeader = GridColumnHeader; export function SpanTransactionsTable({span, openSidebar, onClickTransaction}: Props) { const location = useLocation(); const {data: spanTransactionMetrics, isLoading} = useSpanTransactionMetrics(span); const spanTransactionsWithMetrics = spanTransactionMetrics.map(row => { return { transaction: row.transaction, metrics: row, }; }); const renderHeadCell = (column: TableColumnHeader) => { return {column.name}; }; const renderBodyCell = (column: TableColumnHeader, row: Row) => { return ( ); }; return ( ); } type CellProps = { column: TableColumnHeader; row: Row; span: Pick; onClickTransactionName?: (row: Row) => void; openSidebar?: boolean; }; function BodyCell({span, column, row, openSidebar, onClickTransactionName}: CellProps) { if (column.key === 'transaction') { return ( ); } if (column.key === 'p95(transaction.duration)') { return ; } if (column.key === 'spm()') { return ; } if (column.key === 'time_spent_percentage(local)') { return ( ); } return {row[column.key]}; } function TransactionCell({span, column, row}: CellProps) { return ( ); } const COLUMN_ORDER: TableColumnHeader[] = [ { key: 'transaction', name: 'In Endpoint', width: 500, }, { key: 'spm()', name: DataTitles.throughput, width: COL_WIDTH_UNDEFINED, }, { key: 'p95(transaction.duration)', name: DataTitles.p95, width: COL_WIDTH_UNDEFINED, }, { key: 'time_spent_percentage(local)', name: DataTitles.timeSpent, width: COL_WIDTH_UNDEFINED, }, ];