Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 30df3dd

Browse files
committed
fix(plugins/plugin-kubectl): kubectl top nodes can present "NaN"
Fixes #4189
1 parent 92dd574 commit 30df3dd

File tree

1 file changed

+4
-2
lines changed
  • plugins/plugin-kubectl/view-utilization/src/lib

1 file changed

+4
-2
lines changed

plugins/plugin-kubectl/view-utilization/src/lib/parse.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 IBM Corporation
2+
* Copyright 2019-2020 IBM Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,7 +41,9 @@ export function memShare(str: string): number {
4141
let end = 2
4242
let unit = byte
4343

44-
if (/Ei$/.test(str)) {
44+
if (str === '0') {
45+
return 0
46+
} else if (/Ei$/.test(str)) {
4547
unit = exabytes
4648
} else if (/Pi$/.test(str)) {
4749
unit = petabytes

0 commit comments

Comments
 (0)