diff --git a/app/models/host.js b/app/models/host.js index 7e70af349..5956c05fb 100644 --- a/app/models/host.js +++ b/app/models/host.js @@ -145,7 +145,7 @@ var Host = Resource.extend({ localStorageBlurb: Ember.computed('localStorageMb', function() { if (this.get('localStorageMb')) { - return formatSi(this.get('localStorageMb'), 1024, 'iB', 'B'); + return formatSi(this.get('localStorageMb'), 1024, 'iB', 'B', 2 /*start at 1024^2==MB */); } }), diff --git a/app/utils/util.js b/app/utils/util.js index 4e52c2cf3..3d9a5dd4a 100644 --- a/app/utils/util.js +++ b/app/utils/util.js @@ -242,11 +242,11 @@ export function formatKbps(value) { return formatSi(value*1000, 1000, "bps", "Bps"); } -export function formatSi(inValue, increment=1000, suffix="", firstSuffix=null) +export function formatSi(inValue, increment=1000, suffix="", firstSuffix=null, startingExponent=0) { var units = ['B','K','M','G','T','P']; var val = inValue; - var exp = 0; + var exp = startingExponent; while ( val >= increment && exp+1 < units.length ) { val = val/increment;