|
@@ -1,4 +1,4 @@
|
|
|
-import {useCallback, useMemo} from 'react';
|
|
|
+import {Fragment, ReactNode, useCallback, useMemo} from 'react';
|
|
|
import type {Location} from 'history';
|
|
|
|
|
|
import renderSortableHeaderCell from 'sentry/components/feedback/table/renderSortableHeaderCell';
|
|
@@ -6,24 +6,26 @@ import useQueryBasedColumnResize from 'sentry/components/feedback/table/useQuery
|
|
|
import useQueryBasedSorting from 'sentry/components/feedback/table/useQueryBasedSorting';
|
|
|
import GridEditable, {GridColumnOrder} from 'sentry/components/gridEditable';
|
|
|
import Link from 'sentry/components/links/link';
|
|
|
+import TextOverflow from 'sentry/components/textOverflow';
|
|
|
import {Organization} from 'sentry/types';
|
|
|
import useOrganization from 'sentry/utils/useOrganization';
|
|
|
import {normalizeUrl} from 'sentry/utils/withDomainRequired';
|
|
|
-import {
|
|
|
- DeadRageSelectorItem,
|
|
|
- DeadRageSelectorQueryParams,
|
|
|
-} from 'sentry/views/replays/types';
|
|
|
+import {DeadRageSelectorItem} from 'sentry/views/replays/types';
|
|
|
|
|
|
-interface UrlState {
|
|
|
+export interface UrlState {
|
|
|
widths: string[];
|
|
|
}
|
|
|
|
|
|
interface Props {
|
|
|
clickCountColumn: {key: string; name: string};
|
|
|
+ clickCountSortable: boolean;
|
|
|
data: DeadRageSelectorItem[];
|
|
|
isError: boolean;
|
|
|
isLoading: boolean;
|
|
|
- location: Location<DeadRageSelectorQueryParams & UrlState>;
|
|
|
+ location: Location<any>;
|
|
|
+ customHandleResize?: () => void;
|
|
|
+ headerButtons?: ReactNode;
|
|
|
+ title?: string;
|
|
|
}
|
|
|
|
|
|
const BASE_COLUMNS: GridColumnOrder<string>[] = [
|
|
@@ -34,10 +36,14 @@ const BASE_COLUMNS: GridColumnOrder<string>[] = [
|
|
|
|
|
|
export default function SelectorTable({
|
|
|
clickCountColumn,
|
|
|
+ clickCountSortable,
|
|
|
+ data,
|
|
|
isError,
|
|
|
isLoading,
|
|
|
- data,
|
|
|
location,
|
|
|
+ title,
|
|
|
+ headerButtons,
|
|
|
+ customHandleResize,
|
|
|
}: Props) {
|
|
|
const organization = useOrganization();
|
|
|
|
|
@@ -58,9 +64,9 @@ export default function SelectorTable({
|
|
|
makeSortLinkGenerator,
|
|
|
onClick: () => {},
|
|
|
rightAlignedColumns: [],
|
|
|
- sortableColumns: [clickCountColumn],
|
|
|
+ sortableColumns: clickCountSortable ? [clickCountColumn] : [],
|
|
|
}),
|
|
|
- [clickCountColumn, currentSort, makeSortLinkGenerator]
|
|
|
+ [clickCountColumn, currentSort, makeSortLinkGenerator, clickCountSortable]
|
|
|
);
|
|
|
|
|
|
const renderBodyCell = useCallback(
|
|
@@ -70,9 +76,12 @@ export default function SelectorTable({
|
|
|
case 'dom_element':
|
|
|
return <SelectorLink organization={organization} value={value} />;
|
|
|
case 'element':
|
|
|
- return <code>{value}</code>;
|
|
|
case 'aria_label':
|
|
|
- return <code>{value}</code>;
|
|
|
+ return (
|
|
|
+ <code>
|
|
|
+ <TextOverflow>{value}</TextOverflow>
|
|
|
+ </code>
|
|
|
+ );
|
|
|
default:
|
|
|
return renderSimpleBodyCell<DeadRageSelectorItem>(column, dataRow);
|
|
|
}
|
|
@@ -81,20 +90,24 @@ export default function SelectorTable({
|
|
|
);
|
|
|
|
|
|
return (
|
|
|
- <GridEditable
|
|
|
- error={isError}
|
|
|
- isLoading={isLoading}
|
|
|
- data={data ?? []}
|
|
|
- columnOrder={columns}
|
|
|
- columnSortBy={[]}
|
|
|
- stickyHeader
|
|
|
- grid={{
|
|
|
- onResizeColumn: handleResizeColumn,
|
|
|
- renderHeadCell,
|
|
|
- renderBodyCell,
|
|
|
- }}
|
|
|
- location={location as Location<any>}
|
|
|
- />
|
|
|
+ <Fragment>
|
|
|
+ <GridEditable
|
|
|
+ error={isError}
|
|
|
+ isLoading={isLoading}
|
|
|
+ data={data ?? []}
|
|
|
+ columnOrder={columns}
|
|
|
+ columnSortBy={[]}
|
|
|
+ stickyHeader
|
|
|
+ grid={{
|
|
|
+ onResizeColumn: customHandleResize ?? handleResizeColumn,
|
|
|
+ renderHeadCell,
|
|
|
+ renderBodyCell,
|
|
|
+ }}
|
|
|
+ location={location as Location<any>}
|
|
|
+ title={title}
|
|
|
+ headerButtons={() => headerButtons}
|
|
|
+ />
|
|
|
+ </Fragment>
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -111,11 +124,11 @@ function SelectorLink({
|
|
|
pathname: normalizeUrl(`/organizations/${organization.slug}/replays/`),
|
|
|
}}
|
|
|
>
|
|
|
- {value}
|
|
|
+ <TextOverflow>{value}</TextOverflow>
|
|
|
</Link>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
function renderSimpleBodyCell<T>(column: GridColumnOrder<string>, dataRow: T) {
|
|
|
- return dataRow[column.key];
|
|
|
+ return <TextOverflow>{dataRow[column.key]}</TextOverflow>;
|
|
|
}
|