This is an automated email from the ASF dual-hosted git repository.

ccondit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-web.git


The following commit(s) were added to refs/heads/master by this push:
     new 81dd5ba  [YUNIKORN-1913] Fix unit display in web UI (#129)
81dd5ba is described below

commit 81dd5bae0299609f0c20f037a5f5f80a66c8a0bd
Author: Cliff Su <[email protected]>
AuthorDate: Thu Aug 24 13:36:50 2023 -0500

    [YUNIKORN-1913] Fix unit display in web UI (#129)
    
    SI standard for kilobytes is actually kB.
    
    Closes: #129
    
    Signed-off-by: Craig Condit <[email protected]>
---
 src/app/utils/common.util.spec.ts | 6 +++---
 src/app/utils/common.util.ts      | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/app/utils/common.util.spec.ts 
b/src/app/utils/common.util.spec.ts
index d892d76..ddf25eb 100644
--- a/src/app/utils/common.util.spec.ts
+++ b/src/app/utils/common.util.spec.ts
@@ -28,9 +28,9 @@ describe('CommonUtil', () => {
   });
 
   it('checking formatBytes method result', () => {
-    var inputs: number[] = [100, 1100, 1200000, 1300000000, 1400000000000, 
1500000000000000];
-    var expected: string[] = ['100.0 bytes', '1.1 KB', '1.2 MB', '1.3 GB', 
'1.4 TB', '1.5 PB'];
-    for (var index: number = 0, len = inputs.length; index < len; index = 
index + 1) {
+    const inputs: number[] = [100, 1100, 1200000, 1300000000, 1400000000000, 
1500000000000000];
+    const expected: string[] = ['100.0 bytes', '1.1 kB', '1.2 MB', '1.3 GB', 
'1.4 TB', '1.5 PB'];
+    for (let index = 0; index < inputs.length; index = index + 1) {
       expect(CommonUtil.formatBytes(inputs[index])).toEqual(expected[index]);
       
expect(CommonUtil.formatBytes(inputs[index].toString())).toEqual(expected[index]);
     }
diff --git a/src/app/utils/common.util.ts b/src/app/utils/common.util.ts
index 35674e1..fc1e094 100644
--- a/src/app/utils/common.util.ts
+++ b/src/app/utils/common.util.ts
@@ -31,10 +31,10 @@ export class CommonUtil {
   }
 
   static formatBytes(value: number | string): string {
-    const units: readonly string[] = ['KB', 'MB', 'GB', 'TB', 'PB'];
-    var unit: string = 'bytes';
+    const units: readonly string[] = ['kB', 'MB', 'GB', 'TB', 'PB'];
+    let unit: string = 'bytes';
     let toValue = +value
-    for (var i: number = 0, unitslen = units.length; toValue / 1000 >= 1 && i 
< unitslen;i = i + 1) {
+    for (let i = 0, unitslen = units.length; toValue / 1000 >= 1 && i < 
unitslen;i = i + 1) {
       toValue = toValue / 1000;
       unit = units[i];
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to