@@ -8,7 +8,15 @@ import { useResourceSlotsDetails } from '../hooks/backendai';
8
8
import BAIProgressWithLabel from './BAIProgressWithLabel' ;
9
9
import Flex from './Flex' ;
10
10
import { SessionUsageMonitorFragment$key } from './__generated__/SessionUsageMonitorFragment.graphql' ;
11
- import { ProgressProps , Tooltip , Typography , theme , Row , Col } from 'antd' ;
11
+ import {
12
+ ProgressProps ,
13
+ Tooltip ,
14
+ Typography ,
15
+ theme ,
16
+ Row ,
17
+ Col ,
18
+ Progress ,
19
+ } from 'antd' ;
12
20
import graphql from 'babel-plugin-relay/macro' ;
13
21
import _ from 'lodash' ;
14
22
import { useMemo } from 'react' ;
@@ -47,17 +55,18 @@ const SessionUtilItem: React.FC<SessionUtilItemProps> = ({
47
55
{ description && (
48
56
< Typography . Text
49
57
type = "secondary"
50
- style = { { fontSize : token . fontSizeSM } }
58
+ // style={{ fontSize: token.fontSizeSM }}
51
59
>
52
60
{ description }
53
61
</ Typography . Text >
54
62
) }
55
63
</ Flex >
56
- < BAIProgressWithLabel
64
+ < Progress
65
+ strokeColor = { token . colorTextQuaternary }
66
+ strokeLinecap = "butt"
57
67
percent = { _ . toNumber ( percent ) }
58
- valueLabel = { percentLabel }
59
- strokeColor = "#BFBFBF"
60
- progressStyle = { { border : 'none' } }
68
+ showInfo = { false }
69
+ style = { { lineHeight : '8px' } }
61
70
/>
62
71
</ >
63
72
) ;
@@ -151,9 +160,17 @@ const SessionUsageMonitor: React.FC<SessionUsageMonitorProps> = ({
151
160
capacity : string ,
152
161
decimalSize : number = 2 ,
153
162
) => {
154
- return `${ convertBinarySizeUnit ( current , 'g' , decimalSize ) ?. numberFixed ?? '-' } / ${
155
- convertBinarySizeUnit ( capacity , 'g' , decimalSize ) ?. numberFixed ?? '-'
156
- } GiB`;
163
+ return (
164
+ < >
165
+ < Typography . Text >
166
+ { convertBinarySizeUnit ( current , 'g' , decimalSize ) ?. numberFixed ?? '-' } { ' ' }
167
+ </ Typography . Text > { ' ' }
168
+ /
169
+ { convertBinarySizeUnit ( capacity , 'g' , decimalSize ) ?. numberFixed ??
170
+ '-' } { ' ' }
171
+ GiB
172
+ </ >
173
+ ) ;
157
174
} ;
158
175
159
176
const utilItems = filterEmptyItem ( [
@@ -163,6 +180,14 @@ const SessionUsageMonitor: React.FC<SessionUsageMonitorProps> = ({
163
180
size = { size }
164
181
title = { mergedResourceSlots ?. [ 'cpu' ] ?. human_readable_name }
165
182
percent = { sortedLiveStat ?. cpu_util ?. pct || 0 }
183
+ description = {
184
+ < >
185
+ < Typography . Text >
186
+ { sortedLiveStat ?. cpu_util ?. pct || 0 }
187
+ </ Typography . Text >
188
+ %
189
+ </ >
190
+ }
166
191
/>
167
192
) ,
168
193
sortedLiveStat ?. mem && (
@@ -206,17 +231,19 @@ const SessionUsageMonitor: React.FC<SessionUsageMonitorProps> = ({
206
231
title = {
207
232
< >
208
233
{ mergedResourceSlots ?. [ deviceKey ] ?. human_readable_name }
209
- < Typography . Text type = "secondary" >
210
- { _ . includes ( key , 'util' ) && ' (util)' }
211
- { _ . includes ( key , 'mem' ) && ' (mem)' }
212
- </ Typography . Text >
234
+ { _ . includes ( key , 'util' ) && ' (util)' }
235
+ { _ . includes ( key , 'mem' ) && ' (mem)' }
213
236
</ >
214
237
}
215
238
percent = { value . pct || 0 }
216
239
description = {
217
- _ . includes ( key , 'mem' )
218
- ? displayMemoryUsage ( value ?. current , value ?. capacity )
219
- : undefined
240
+ _ . includes ( key , 'mem' ) ? (
241
+ displayMemoryUsage ( value ?. current , value ?. capacity )
242
+ ) : _ . includes ( key , 'util' ) ? (
243
+ < >
244
+ < Typography . Text > { value . pct || 0 } </ Typography . Text > %
245
+ </ >
246
+ ) : undefined
220
247
}
221
248
tooltipTitle = {
222
249
< Flex direction = "column" align = "stretch" >
@@ -254,9 +281,7 @@ const SessionUsageMonitor: React.FC<SessionUsageMonitorProps> = ({
254
281
{ size === 'default' && (
255
282
< Col span = { 24 } >
256
283
< Flex justify = "end" >
257
- < Typography . Text >
258
- { `I/O Read: ${ convertDecimalSizeUnit ( sortedLiveStat ?. io_read ?. current , 'm' ) ?. numberUnit ?? '-' } B / Write: ${ convertDecimalSizeUnit ( sortedLiveStat ?. io_write ?. current , 'm' ) ?. numberUnit ?? '-' } B` }
259
- </ Typography . Text >
284
+ { `I/O: Read ${ convertDecimalSizeUnit ( sortedLiveStat ?. io_read ?. current , 'm' ) ?. numberFixed ?? '-' } MB, Write ${ convertDecimalSizeUnit ( sortedLiveStat ?. io_write ?. current , 'm' ) ?. numberFixed ?? '-' } MB` }
260
285
</ Flex >
261
286
</ Col >
262
287
) }
0 commit comments