mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-21 21:26:16 +01:00
fix capacity sorting in smart table (#1551)
This commit is contained in:
@@ -99,6 +99,7 @@ export type DiskInfo = {
|
|||||||
device: string
|
device: string
|
||||||
model: string
|
model: string
|
||||||
capacity: string
|
capacity: string
|
||||||
|
capacityBytes: number
|
||||||
status: string
|
status: string
|
||||||
temperature: number
|
temperature: number
|
||||||
deviceType: string
|
deviceType: string
|
||||||
@@ -125,6 +126,7 @@ function convertSmartDeviceRecordToDiskInfo(records: SmartDeviceRecord[]): DiskI
|
|||||||
serialNumber: record.serial || unknown,
|
serialNumber: record.serial || unknown,
|
||||||
firmwareVersion: record.firmware || unknown,
|
firmwareVersion: record.firmware || unknown,
|
||||||
capacity: record.capacity ? formatCapacity(record.capacity) : unknown,
|
capacity: record.capacity ? formatCapacity(record.capacity) : unknown,
|
||||||
|
capacityBytes: record.capacity || 0,
|
||||||
status: record.state || unknown,
|
status: record.state || unknown,
|
||||||
temperature: record.temp || 0,
|
temperature: record.temp || 0,
|
||||||
deviceType: record.type || unknown,
|
deviceType: record.type || unknown,
|
||||||
@@ -175,6 +177,7 @@ export const columns: ColumnDef<DiskInfo>[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "capacity",
|
accessorKey: "capacity",
|
||||||
|
sortingFn: (a, b) => a.original.capacityBytes - b.original.capacityBytes,
|
||||||
header: ({ column }) => <HeaderButton column={column} name={t`Capacity`} Icon={BinaryIcon} />,
|
header: ({ column }) => <HeaderButton column={column} name={t`Capacity`} Icon={BinaryIcon} />,
|
||||||
cell: ({ getValue }) => <span className="ms-1.5">{getValue() as string}</span>,
|
cell: ({ getValue }) => <span className="ms-1.5">{getValue() as string}</span>,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user