|
@@ -8,6 +8,7 @@ import Duration from 'sentry/components/duration';
|
|
|
import GridEditable, {
|
|
|
COL_WIDTH_UNDEFINED,
|
|
|
GridColumn,
|
|
|
+ GridColumnHeader,
|
|
|
} from 'sentry/components/gridEditable';
|
|
|
import SortLink, {Alignments} from 'sentry/components/gridEditable/sortLink';
|
|
|
import Link from 'sentry/components/links/link';
|
|
@@ -50,6 +51,10 @@ type Props = {
|
|
|
setError: (msg: string | undefined) => void;
|
|
|
};
|
|
|
|
|
|
+export type TableColumnHeader = GridColumnHeader<keyof TableDataRow> & {
|
|
|
+ column?: TableColumn<keyof TableDataRow>['column']; // TODO - remove this once gridEditable is properly typed
|
|
|
+};
|
|
|
+
|
|
|
function EndpointList({eventView, location, organization, setError}: Props) {
|
|
|
const [widths, setWidths] = useState<number[]>([]);
|
|
|
const [_eventView, setEventView] = useState<EventView>(eventView);
|
|
@@ -66,7 +71,7 @@ function EndpointList({eventView, location, organization, setError}: Props) {
|
|
|
|
|
|
function renderBodyCell(
|
|
|
tableData: TableData | null,
|
|
|
- column: TableColumn<keyof TableDataRow>,
|
|
|
+ column: TableColumnHeader,
|
|
|
dataRow: TableDataRow,
|
|
|
_deltaColumnMap: Record<string, string>
|
|
|
): React.ReactNode {
|
|
@@ -170,15 +175,13 @@ function EndpointList({eventView, location, organization, setError}: Props) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- return (
|
|
|
- column: TableColumn<keyof TableDataRow>,
|
|
|
- dataRow: TableDataRow
|
|
|
- ): React.ReactNode => renderBodyCell(tableData, column, dataRow, deltaColumnMap);
|
|
|
+ return (column: TableColumnHeader, dataRow: TableDataRow): React.ReactNode =>
|
|
|
+ renderBodyCell(tableData, column, dataRow, deltaColumnMap);
|
|
|
}
|
|
|
|
|
|
function renderHeadCell(
|
|
|
tableMeta: TableData['meta'],
|
|
|
- column: TableColumn<keyof TableDataRow>,
|
|
|
+ column: TableColumnHeader,
|
|
|
title: React.ReactNode
|
|
|
): React.ReactNode {
|
|
|
let align: Alignments = 'right';
|
|
@@ -186,7 +189,7 @@ function EndpointList({eventView, location, organization, setError}: Props) {
|
|
|
align = 'left';
|
|
|
}
|
|
|
const field = {
|
|
|
- field: column.column.kind === 'equation' ? (column.key as string) : column.name,
|
|
|
+ field: column.column?.kind === 'equation' ? (column.key as string) : column.name,
|
|
|
width: column.width,
|
|
|
};
|
|
|
|
|
@@ -237,7 +240,7 @@ function EndpointList({eventView, location, organization, setError}: Props) {
|
|
|
|
|
|
function renderHeadCellWithMeta(tableMeta: TableData['meta']) {
|
|
|
const newColumnTitles = COLUMN_TITLES;
|
|
|
- return (column: TableColumn<keyof TableDataRow>, index: number): React.ReactNode =>
|
|
|
+ return (column: TableColumnHeader, index: number): React.ReactNode =>
|
|
|
renderHeadCell(tableMeta, column, newColumnTitles[index]);
|
|
|
}
|
|
|
|
|
@@ -300,8 +303,8 @@ function EndpointList({eventView, location, organization, setError}: Props) {
|
|
|
columnSortBy={columnSortBy}
|
|
|
grid={{
|
|
|
onResizeColumn: handleResizeColumn,
|
|
|
- renderHeadCell: renderHeadCellWithMeta(tableData?.meta) as any,
|
|
|
- renderBodyCell: renderBodyCellWithData(tableData) as any,
|
|
|
+ renderHeadCell: renderHeadCellWithMeta(tableData?.meta),
|
|
|
+ renderBodyCell: renderBodyCellWithData(tableData),
|
|
|
}}
|
|
|
location={location}
|
|
|
/>
|