import {Fragment} from 'react'; import {Link} from 'react-router'; import GridEditable, { COL_WIDTH_UNDEFINED, GridColumnHeader, GridColumnOrder, } from 'sentry/components/gridEditable'; import {RateUnits} from 'sentry/utils/discover/fields'; import {useLocation} from 'sentry/utils/useLocation'; import {useParams} from 'sentry/utils/useParams'; import {useResourcePagesQuery} from 'sentry/views/performance/browser/resources/utils/useResourcePageQuery'; import {useResourceSummarySort} from 'sentry/views/performance/browser/resources/utils/useResourceSummarySort'; import {DurationCell} from 'sentry/views/starfish/components/tableCells/durationCell'; import {renderHeadCell} from 'sentry/views/starfish/components/tableCells/renderHeadCell'; import {ThroughputCell} from 'sentry/views/starfish/components/tableCells/throughputCell'; type Row = { 'avg(http.response_content_length)': number; 'avg(span.self_time)': number; 'spm()': number; transaction: string; }; type Column = GridColumnHeader; function ResourceSummaryTable() { const location = useLocation(); const {groupId} = useParams(); const sort = useResourceSummarySort(); const {data, isLoading} = useResourcePagesQuery(groupId, {sort}); const columnOrder: GridColumnOrder[] = [ {key: 'transaction', width: COL_WIDTH_UNDEFINED, name: 'Found on page'}, { key: 'spm()', width: COL_WIDTH_UNDEFINED, name: 'Throughput', }, { key: 'avg(span.self_time)', width: COL_WIDTH_UNDEFINED, name: 'Avg Duration', }, { key: 'avg(http.response_content_length)', width: COL_WIDTH_UNDEFINED, name: 'Avg Resource Size', }, ]; const renderBodyCell = (col: Column, row: Row) => { const {key} = col; if (key === 'spm()') { return ; } if (key === 'avg(span.self_time)') { return ; } if (key === 'transaction') { return ( {row[key]} ); } return {row[key]}; }; return ( renderHeadCell({ column, location, sort, }), renderBodyCell, }} location={location} /> ); } export const getActionName = (transactionOp: string) => { switch (transactionOp) { case 'ui.action.click': return 'Click'; default: return transactionOp; } }; export default ResourceSummaryTable;