Fix unit of local storage

This commit is contained in:
Vincent Fiduccia 2016-12-07 12:20:23 -08:00
parent 911ed210ce
commit f4ace8b1cc
2 changed files with 3 additions and 3 deletions

View File

@ -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 */);
}
}),

View File

@ -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;