const BYTES_SIZE = 1024;
const BYTES_NAMES = ['Bytes', 'kB', 'MB', 'GB', 'TB'];

/**
 * Convert bytes size to human readable size.
 * @param  {int} size Bytes size
 * @param  {int} precision Decimal count
 * @return {string}   Human readable bytes size
 */
export const humanSize = (size, precision = 0, scale) => {
  let i = scale;
  if (!scale) {
    i = Math.floor(Math.log(size) / Math.log(BYTES_SIZE));
  }
  // eslint-disable-next-line no-restricted-properties
  return `${(size / Math.pow(BYTES_SIZE, i)).toFixed(precision)} ${BYTES_NAMES[i]}`;
};

/**
 * Compute CPU percentage of containers.
 * @param  {Object} stat Container's stat
 * @return {Number}      CPU percentage
 */
export const computeCpuPercentage = (stat) => {
  const cpuDelta = stat.cpu_stats.cpu_usage.total_usage - stat.precpu_stats.cpu_usage.total_usage;
  const systemDelta = stat.cpu_stats.system_cpu_usage - stat.precpu_stats.system_cpu_usage;
  const ratio = cpuDelta / systemDelta;
  const cpuCoeff = stat.cpu_stats.cpu_usage.percpu_usage.length * 100;

  return parseInt(ratio * cpuCoeff * 100, 10) / 100;
};

@@ -74,16 +74,212 @@
 'TB'%5D;%0A%0A
+/**%0A * Compute size scale of given size.%0A * @param  %7Bint%7D size Bytes size%0A * @return %7Bint%7D Size scale%0A */%0Aexport const humanSizeScale = size =%3E Math.floor(Math.log(size) / Math.log(BYTES_SIZE));%0A%0A
 /**%0A * C
@@ -394,16 +394,56 @@
 l count%0A
+ * @param  %7Bint%7D scale Human size scale%0A
  * @retu
@@ -549,104 +549,8 @@
 %3E %7B%0A
-  let i = scale;%0A  if (!scale) %7B%0A    i = Math.floor(Math.log(size) / Math.log(BYTES_SIZE));%0A  %7D%0A
   //
@@ -641,17 +641,45 @@
 S_SIZE, 
-i
+scale %7C%7C humanSizeScale(size)
 )).toFix

Update statHelper.js