Skip to content

Commit 57df88b

Browse files
authored
fix: fix top shards path column and better overriding for advisor (#2197)
1 parent c2bcf49 commit 57df88b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/components/ShardsTable/ShardsTable.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,34 @@ export interface ShardsTableProps
1313
extends Omit<ResizeableDataTableProps<KeyValueRow>, 'columnsWidthLSKey' | 'columns'> {
1414
columnsIds: TopShardsColumnId[];
1515
database: string;
16-
columns?: ShardsColumn[];
16+
overrideColumns?: ShardsColumn[];
1717
schemaPath?: string;
1818
}
1919

2020
export function ShardsTable({
2121
columnsIds,
2222
schemaPath,
2323
database,
24-
columns: propsColumns,
24+
overrideColumns = [],
2525
...props
2626
}: ShardsTableProps) {
2727
const columns = React.useMemo(() => {
28-
if (propsColumns) {
29-
return propsColumns;
30-
}
31-
3228
return columnsIds
3329
.filter((id) => id in shardsColumnIdToGetColumn)
3430
.map((id) => {
31+
const overridedColumn = overrideColumns.find((column) => column.name === id);
32+
if (overridedColumn) {
33+
return overridedColumn;
34+
}
35+
3536
const column = shardsColumnIdToGetColumn[id]({database, schemaPath});
3637

3738
return {
3839
...column,
3940
sortable: isSortableTopShardsColumn(column.name),
4041
};
4142
});
42-
}, [columnsIds, database, propsColumns, schemaPath]);
43+
}, [columnsIds, database, overrideColumns, schemaPath]);
4344

4445
return (
4546
<ResizeableDataTable

src/store/reducers/tenantOverview/topShards/tenantOverviewTopShards.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {isQueryErrorResponse, parseQueryAPIResponse} from '../../../../utils/que
33
import {api} from '../../api';
44

55
function createShardQuery(path: string, database: string) {
6-
const pathSelect = `CAST(SUBSTRING(CAST(Path AS String), ${database.length}) AS Utf8) AS Path`;
6+
const pathSelect = `CAST(SUBSTRING(CAST(Path AS String), ${database.length}) AS Utf8) AS RelativePath`;
77
return `${QUERY_TECHNICAL_MARK}
88
SELECT
99
${pathSelect},

0 commit comments

Comments
 (0)