Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/components/ShardsTable/ShardsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,34 @@ export interface ShardsTableProps
extends Omit<ResizeableDataTableProps<KeyValueRow>, 'columnsWidthLSKey' | 'columns'> {
columnsIds: TopShardsColumnId[];
database: string;
columns?: ShardsColumn[];
overrideColumns?: ShardsColumn[];
schemaPath?: string;
}

export function ShardsTable({
columnsIds,
schemaPath,
database,
columns: propsColumns,
overrideColumns = [],
...props
}: ShardsTableProps) {
const columns = React.useMemo(() => {
if (propsColumns) {
return propsColumns;
}

return columnsIds
.filter((id) => id in shardsColumnIdToGetColumn)
.map((id) => {
const overridedColumn = overrideColumns.find((column) => column.name === id);
if (overridedColumn) {
return overridedColumn;
}

const column = shardsColumnIdToGetColumn[id]({database, schemaPath});

return {
...column,
sortable: isSortableTopShardsColumn(column.name),
};
});
}, [columnsIds, database, propsColumns, schemaPath]);
}, [columnsIds, database, overrideColumns, schemaPath]);

return (
<ResizeableDataTable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {isQueryErrorResponse, parseQueryAPIResponse} from '../../../../utils/que
import {api} from '../../api';

function createShardQuery(path: string, database: string) {
const pathSelect = `CAST(SUBSTRING(CAST(Path AS String), ${database.length}) AS Utf8) AS Path`;
const pathSelect = `CAST(SUBSTRING(CAST(Path AS String), ${database.length}) AS Utf8) AS RelativePath`;
return `${QUERY_TECHNICAL_MARK}
SELECT
${pathSelect},
Expand Down
Loading