Skip to content

Commit

Permalink
fix(machines): Allow sorting by disks and storage (3.6 backport) (#5578)
Browse files Browse the repository at this point in the history
- Added `total_storage` and `physical_disk_count` as valid fetch group keys
- Added `onClick` handlers to disks and storage column headers to update the sort key

Resolves [LP#2092299](https://bugs.launchpad.net/maas-ui/+bug/2092299)
  • Loading branch information
ndv99 authored Jan 14, 2025
1 parent b8bddd9 commit 3f4c30e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ export const MachineListTable = ({
<TableHeader
currentSort={currentSort}
data-testid="disks-header"
// TODO: enable sorting by "physical_disk_count" when the API supports it:
// https://github.com/canonical/app-tribe/issues/1268
onClick={() => updateSort(FetchGroupKey.PhysicalDiskCount)}
sortKey={FetchGroupKey.PhysicalDiskCount}
>
{columnLabels[MachineColumns.DISKS]}
</TableHeader>
Expand All @@ -355,8 +355,8 @@ export const MachineListTable = ({
<TableHeader
currentSort={currentSort}
data-testid="storage-header"
// TODO: enable sorting by "storage" when the API supports it:
// https://github.com/canonical/app-tribe/issues/1268
onClick={() => updateSort(FetchGroupKey.TotalStorage)}
sortKey={FetchGroupKey.TotalStorage}
>
{columnLabels[MachineColumns.STORAGE]}
</TableHeader>
Expand Down
2 changes: 2 additions & 0 deletions src/app/store/machine/types/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ export enum FetchGroupKey {
Ownerdata = "ownerdata",
Parent = "parent",
ParentId = "parent_id",
PhysicalDiskCount = "physical_disk_count",
Podhints = "podhints",
Pod = "pod",
PodType = "pod_type",
Expand Down Expand Up @@ -430,6 +431,7 @@ export enum FetchGroupKey {
SyncInterval = "sync_interval",
SystemId = "system_id",
Tags = "tags",
TotalStorage = "total_storage",
Updated = "updated",
Url = "url",
Virtualmachine = "virtualmachine",
Expand Down

0 comments on commit 3f4c30e

Please sign in to comment.