Skip to content
Merged
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
47 changes: 23 additions & 24 deletions src/routes/components/ServerPartsGrid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,6 @@
let gridApi: GridApi | undefined = $state()

const columnDefs: ColDef[] = [
{ field: 'brand' },
{
field: 'capacityGb',
headerName: 'Capacity',
valueFormatter: ({ data }: { data: ServerPartsRecord }) => {
if (!Number.isFinite(data.capacityGb)) return 'NaN'
if (data.capacityGb >= 1000) {
const terabytes = data.capacityGb / 1000
if (terabytes % 1 !== 0) return `${terabytes.toFixed(2)} TB`
return `${terabytes} TB`
}
return `${data.capacityGb} GB`
},
},
{ field: 'condition' },
{ field: 'formFactor' },
{ field: 'type' },
{
colId: 'pricePerCapacity',
headerName: 'Price / Capacity',
Expand All @@ -50,15 +33,17 @@
return `$${data.priceUsd.toFixed(2)}`
},
},
{ field: 'sku' },
{ field: 'interface' },
{
field: 'interfaceSpeed',
headerName: 'Interface Speed',
field: 'capacityGb',
headerName: 'Capacity',
valueFormatter: ({ data }: { data: ServerPartsRecord }) => {
if (!Number.isFinite(data.interfaceSpeedGbPerSecond)) return `NaN`

return `${data.interfaceSpeedGbPerSecond} GB/s`
if (!Number.isFinite(data.capacityGb)) return 'NaN'
if (data.capacityGb >= 1000) {
const terabytes = data.capacityGb / 1000
if (terabytes % 1 !== 0) return `${terabytes.toFixed(2)} TB`
return `${terabytes} TB`
}
return `${data.capacityGb} GB`
},
},
{
Expand All @@ -80,6 +65,20 @@
return text ? text : '0 Days'
},
},
{ field: 'interface' },
{ field: 'formFactor' },
{ field: 'condition' },
{ field: 'type' },
{
field: 'interfaceSpeed',
headerName: 'Interface Speed',
valueFormatter: ({ data }: { data: ServerPartsRecord }) => {
if (!Number.isFinite(data.interfaceSpeedGbPerSecond)) return `NaN`

return `${data.interfaceSpeedGbPerSecond} GB/s`
},
},
{ field: 'brand' },
{
field: 'link',
headerName: '',
Expand Down