From 89ce9c9937be04fcb83fe4da1373d9e0ace97539 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Tue, 23 Jul 2024 17:30:47 +0200 Subject: [PATCH] Address PR feedback --- static/app/components/gridEditable/index.tsx | 1 - static/app/utils/discover/fieldRenderers.tsx | 4 --- .../components/tables/screensTable.spec.tsx | 33 ++++++++++++++++++- .../common/components/tables/screensTable.tsx | 6 ++-- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/static/app/components/gridEditable/index.tsx b/static/app/components/gridEditable/index.tsx index 8bcc8815767bde..e301366dd19a62 100644 --- a/static/app/components/gridEditable/index.tsx +++ b/static/app/components/gridEditable/index.tsx @@ -45,7 +45,6 @@ export type GridColumn = { export type GridColumnHeader = GridColumn & { name: string; - tooltip?: string; }; export type GridColumnOrder = GridColumnHeader; diff --git a/static/app/utils/discover/fieldRenderers.tsx b/static/app/utils/discover/fieldRenderers.tsx index d75c91dc9717af..7ab9d686f0d33e 100644 --- a/static/app/utils/discover/fieldRenderers.tsx +++ b/static/app/utils/discover/fieldRenderers.tsx @@ -819,10 +819,6 @@ export function getSortField( return field; } - if (field.startsWith('division_if(')) { - return field; - } - for (const alias in AGGREGATIONS) { if (field.startsWith(alias)) { return AGGREGATIONS[alias].isSortable ? field : null; diff --git a/static/app/views/insights/mobile/common/components/tables/screensTable.spec.tsx b/static/app/views/insights/mobile/common/components/tables/screensTable.spec.tsx index 35d247adf015b0..5acf95be9e863b 100644 --- a/static/app/views/insights/mobile/common/components/tables/screensTable.spec.tsx +++ b/static/app/views/insights/mobile/common/components/tables/screensTable.spec.tsx @@ -1,4 +1,4 @@ -import {render, screen} from 'sentry-test/reactTestingLibrary'; +import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary'; import EventView from 'sentry/utils/discover/eventView'; import {MutableSearch} from 'sentry/utils/tokenizeSearch'; @@ -84,4 +84,35 @@ describe('ScreensTable', () => { expect(screen.getByText('Custom rendered Screen 1')).toBeInTheDocument(); expect(screen.getByText('non customized value')).toBeInTheDocument(); }); + + it('renders column header tooltips', async () => { + render( + + ); + + const columnHeader = screen.getByText('Screen Column'); + await userEvent.hover(columnHeader); + + expect(await screen.findByText('Screen Column Tooltip')).toBeInTheDocument(); + }); }); diff --git a/static/app/views/insights/mobile/common/components/tables/screensTable.tsx b/static/app/views/insights/mobile/common/components/tables/screensTable.tsx index b165aec32d871e..bba1999085b9e0 100644 --- a/static/app/views/insights/mobile/common/components/tables/screensTable.tsx +++ b/static/app/views/insights/mobile/common/components/tables/screensTable.tsx @@ -131,8 +131,9 @@ export function ScreensTable({ ); } - if (column.tooltip) { - return columnWithTooltip(column.tooltip); + const tooltip = columnTooltipMap ? columnTooltipMap[column.key] : undefined; + if (tooltip) { + return columnWithTooltip(tooltip); } return sortLink; } @@ -147,7 +148,6 @@ export function ScreensTable({ key: columnKey, name: columnNameMap[columnKey], width: COL_WIDTH_UNDEFINED, - toolTip: columnTooltipMap ? columnTooltipMap[columnKey] : undefined, }; })} columnSortBy={defaultSort}