From c8a0e52a59b975c18cc2d173372a15f832c88e25 Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Thu, 12 May 2022 12:41:20 +0100 Subject: [PATCH] Search: Improve tab navigation (#48932) --- .../src/components/Table/TableCell.tsx | 4 +++- .../page/components/SearchResultsTable.tsx | 22 +++++-------------- .../search/page/components/columns.tsx | 13 +++++------ 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/packages/grafana-ui/src/components/Table/TableCell.tsx b/packages/grafana-ui/src/components/Table/TableCell.tsx index 9ba4ed6cc3a..2ebb78e89f5 100644 --- a/packages/grafana-ui/src/components/Table/TableCell.tsx +++ b/packages/grafana-ui/src/components/Table/TableCell.tsx @@ -10,9 +10,10 @@ export interface Props { onCellFilterAdded?: TableFilterActionCallback; columnIndex: number; columnCount: number; + userProps?: object; } -export const TableCell: FC = ({ cell, tableStyles, onCellFilterAdded, columnIndex, columnCount }) => { +export const TableCell: FC = ({ cell, tableStyles, onCellFilterAdded, columnIndex, columnCount, userProps }) => { const cellProps = cell.getCellProps(); const field = (cell.column as any as GrafanaTableColumn).field; @@ -38,5 +39,6 @@ export const TableCell: FC = ({ cell, tableStyles, onCellFilterAdded, col onCellFilterAdded, cellProps, innerWidth, + userProps, }) as React.ReactElement; }; diff --git a/public/app/features/search/page/components/SearchResultsTable.tsx b/public/app/features/search/page/components/SearchResultsTable.tsx index ce766448035..b6e3173f3c7 100644 --- a/public/app/features/search/page/components/SearchResultsTable.tsx +++ b/public/app/features/search/page/components/SearchResultsTable.tsx @@ -29,7 +29,6 @@ export type TableColumn = Column & { field?: Field; }; -const skipHREF = new Set(['column-checkbox', 'column-datasource', 'column-location']); const HEADER_HEIGHT = 36; // pixels export const SearchResultsTable = ({ @@ -78,28 +77,21 @@ export const SearchResultsTable = ({ return (
{row.cells.map((cell: Cell, index: number) => { - const body = ( + return ( ); - if (skipHREF.has(cell.column.id)) { - return body; - } - return ( - - {body} - - ); })}
); }, - [rows, prepareRow, response.view.fields.url?.values, styles.rowContainer, styles.cellWrapper, tableStyles] + [rows, prepareRow, response.view.fields.url?.values, styles.rowContainer, tableStyles] ); if (!rows.length) { @@ -171,11 +163,9 @@ const getStyles = (theme: GrafanaTheme2) => { align-items: center; `, cellWrapper: css` - div { - border-right: none; - &:hover { - box-shadow: none; - } + border-right: none; + &:hover { + box-shadow: none; } `, headerCell: css` diff --git a/public/app/features/search/page/components/columns.tsx b/public/app/features/search/page/components/columns.tsx index e5ea9f5ff79..52944030918 100644 --- a/public/app/features/search/page/components/columns.tsx +++ b/public/app/features/search/page/components/columns.tsx @@ -79,9 +79,9 @@ export const generateColumns = ( Cell: (p) => { const name = access.name.values.get(p.row.index); return ( -
+ {name} -
+ ); }, id: `column-name`, @@ -92,7 +92,7 @@ export const generateColumns = ( availableWidth -= width; width = TYPE_COLUMN_WIDTH; - columns.push(makeTypeColumn(access.kind, access.panel_type, width, styles.typeText, styles.typeIcon)); + columns.push(makeTypeColumn(access.kind, access.panel_type, width, styles)); availableWidth -= width; // Show datasources if we have any @@ -222,8 +222,7 @@ function makeTypeColumn( kindField: Field, typeField: Field, width: number, - typeTextClass: string, - iconClass: string + styles: Record ): TableColumn { return { Cell: DefaultCell, @@ -264,8 +263,8 @@ function makeTypeColumn( } } return ( -
- +
+ {txt}
);