Skip to content

Commit ea3d06a

Browse files
shwstpprdhslove
authored andcommitted
ui: fix NAN% used memory for vm (apache#11307)
1 parent 9be8115 commit ea3d06a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ui/src/config/section/compute.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ export default {
5454
const metricsFields = ['cpunumber', 'cputotal', 'cpuused', 'memorytotal',
5555
{
5656
memoryused: (record) => {
57-
return record.memorykbs && record.memoryintusablekbs ? parseFloat(100.0 * (record.memorykbs - record.memoryintusablekbs) / record.memorykbs).toFixed(2) + '%' : '0.0%'
57+
if (!record.memoryintfreekbs || record.memoryintfreekbs <= 0 || record.memorykbs <= 0) {
58+
return ''
59+
}
60+
return parseFloat(100.0 * (record.memorykbs - record.memoryintfreekbs) / record.memorykbs).toFixed(2) + '%'
5861
}
5962
},
6063
'networkread', 'networkwrite', 'diskread', 'diskwrite', 'diskiopstotal']

0 commit comments

Comments
 (0)