Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
markushi committed Jul 23, 2024
1 parent c914283 commit 89ce9c9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
1 change: 0 additions & 1 deletion static/app/components/gridEditable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export type GridColumn<K = ObjectKey> = {

export type GridColumnHeader<K = ObjectKey> = GridColumn<K> & {
name: string;
tooltip?: string;
};

export type GridColumnOrder<K = ObjectKey> = GridColumnHeader<K>;
Expand Down
4 changes: 0 additions & 4 deletions static/app/utils/discover/fieldRenderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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(
<ScreensTable
columnNameMap={{
transaction: 'Screen Column',
}}
columnTooltipMap={{
transaction: 'Screen Column Tooltip',
}}
columnOrder={['transaction', 'non-custom']}
data={{
data: [
{id: '1', transaction: 'Screen 1', 'non-custom': 'non customized value'},
],
meta: {fields: {transaction: 'string'}},
}}
defaultSort={[]}
eventView={getMockEventView({
fields: [{field: 'transaction'}, {field: 'non-custom'}],
})}
isLoading={false}
pageLinks={undefined}
/>
);

const columnHeader = screen.getByText('Screen Column');
await userEvent.hover(columnHeader);

expect(await screen.findByText('Screen Column Tooltip')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -147,7 +148,6 @@ export function ScreensTable({
key: columnKey,
name: columnNameMap[columnKey],
width: COL_WIDTH_UNDEFINED,
toolTip: columnTooltipMap ? columnTooltipMap[columnKey] : undefined,
};
})}
columnSortBy={defaultSort}
Expand Down

0 comments on commit 89ce9c9

Please sign in to comment.