Skip to content

fix: fix top shards path column and better overriding for advisor #2197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025
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