Skip to content

Commit

Permalink
Merge #131099
Browse files Browse the repository at this point in the history
131099: cluster-ui: add table sort to v2 db page r=xinhaoz a=xinhaoz

Add sort by table count now that the sort option
is available on the api. We've also deleted sort
options that don't apply for the db page.

Epic: CRDB-37558

Release note: None

Co-authored-by: Xin Hao Zhang <[email protected]>
  • Loading branch information
craig[bot] and xinhaoz committed Sep 20, 2024
2 parents e1ea227 + aba8ade commit 50cc596
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ export enum DatabaseSortOptions {
NAME = "name",
REPLICATION_SIZE = "replicationSize",
RANGES = "ranges",
LIVE_DATA = "liveData",
COLUMNS = "columns",
INDEXES = "indexes",
TABLE_COUNT = "tableCount",
LAST_UPDATED = "lastUpdated",
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/workspaces/cluster-ui/src/databasesV2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const COLUMNS: TableColumnProps<DatabaseRow>[] = [
},
{
title: DatabaseColName.TABLE_COUNT,
sorter: false,
sorter: true,
render: (db: DatabaseRow) => {
return db.tableCount;
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/ui/workspaces/cluster-ui/src/databasesV2/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const getSortKeyFromColTitle = (
case DatabaseColName.RANGE_COUNT:
return DatabaseSortOptions.RANGES;
case DatabaseColName.TABLE_COUNT:
return DatabaseSortOptions.LIVE_DATA;
return DatabaseSortOptions.TABLE_COUNT;
default:
throw new Error(`Unsupported sort column ${col}`);
}
Expand All @@ -43,7 +43,7 @@ export const getColTitleFromSortKey = (
return DatabaseColName.SIZE;
case DatabaseSortOptions.RANGES:
return DatabaseColName.RANGE_COUNT;
case DatabaseSortOptions.LIVE_DATA:
case DatabaseSortOptions.TABLE_COUNT:
return DatabaseColName.TABLE_COUNT;
default:
return DatabaseColName.NAME;
Expand Down

0 comments on commit 50cc596

Please sign in to comment.