6
6
* Copyright Oxide Computer Company
7
7
*/
8
8
import { createColumnHelper } from '@tanstack/react-table'
9
+ import { filesize } from 'filesize'
9
10
import { useMemo } from 'react'
10
11
import { useNavigate , type LoaderFunctionArgs } from 'react-router-dom'
11
12
@@ -20,7 +21,6 @@ import { Instances16Icon, Instances24Icon } from '@oxide/design-system/icons/rea
20
21
import { DocsPopover } from '~/components/DocsPopover'
21
22
import { RefreshButton } from '~/components/RefreshButton'
22
23
import { getProjectSelector , useProjectSelector , useQuickActions } from '~/hooks'
23
- import { InstanceResourceCell } from '~/table/cells/InstanceResourceCell'
24
24
import { InstanceStatusCell } from '~/table/cells/InstanceStatusCell'
25
25
import { makeLinkCell } from '~/table/cells/LinkCell'
26
26
import { getActionsCol } from '~/table/columns/action-col'
@@ -99,21 +99,32 @@ export function InstancesPage() {
99
99
colHelper . accessor ( 'name' , {
100
100
cell : makeLinkCell ( ( instance ) => pb . instance ( { project, instance } ) ) ,
101
101
} ) ,
102
- colHelper . accessor ( ( i ) => ( { ncpus : i . ncpus , memory : i . memory } ) , {
103
- header : 'CPU, RAM' ,
104
- cell : ( info ) => < InstanceResourceCell value = { info . getValue ( ) } /> ,
102
+ colHelper . accessor ( 'ncpus' , {
103
+ header : 'CPU' ,
104
+ cell : ( info ) => (
105
+ < >
106
+ { info . getValue ( ) } < span className = "ml-1 text-quaternary" > vCPU</ span >
107
+ </ >
108
+ ) ,
109
+ } ) ,
110
+ colHelper . accessor ( 'memory' , {
111
+ header : 'Memory' ,
112
+ cell : ( info ) => {
113
+ const memory = filesize ( info . getValue ( ) , { output : 'object' , base : 2 } )
114
+ return (
115
+ < >
116
+ { memory . value } < span className = "ml-1 text-quaternary" > { memory . unit } </ span >
117
+ </ >
118
+ )
119
+ } ,
105
120
} ) ,
106
121
colHelper . accessor (
107
- ( i ) => ( {
108
- runState : i . runState ,
109
- timeRunStateUpdated : i . timeRunStateUpdated ,
110
- } ) ,
122
+ ( i ) => ( { runState : i . runState , timeRunStateUpdated : i . timeRunStateUpdated } ) ,
111
123
{
112
124
header : 'status' ,
113
125
cell : ( info ) => < InstanceStatusCell value = { info . getValue ( ) } /> ,
114
126
}
115
127
) ,
116
- colHelper . accessor ( 'hostname' , { } ) ,
117
128
colHelper . accessor ( 'timeCreated' , Columns . timeCreated ) ,
118
129
getActionsCol ( makeActions ) ,
119
130
] ,
@@ -137,7 +148,7 @@ export function InstancesPage() {
137
148
< RefreshButton onClick = { refetchInstances } />
138
149
< CreateLink to = { pb . instancesNew ( { project } ) } > New Instance</ CreateLink >
139
150
</ TableActions >
140
- < Table columns = { columns } emptyState = { < EmptyState /> } rowHeight = "large" />
151
+ < Table columns = { columns } emptyState = { < EmptyState /> } />
141
152
</ >
142
153
)
143
154
}
0 commit comments