Commit d75a49fd authored by Miguel Rincon's avatar Miguel Rincon

Refactor formatUsageSize to use a simple function

parent 3dbb300d
import { numberToHumanSize, bytesToKiB } from '~/lib/utils/number_utils'; import { numberToHumanSize, bytesToKiB } from '~/lib/utils/number_utils';
import { getFormatter, SUPPORTED_FORMATS } from '~/lib/utils/unit_format'; import { kibibytes } from '~/lib/utils/unit_format';
import { PROJECT_STORAGE_TYPES, STORAGE_USAGE_THRESHOLDS } from './constants'; import { PROJECT_STORAGE_TYPES, STORAGE_USAGE_THRESHOLDS } from './constants';
export function usageRatioToThresholdLevel(currentUsageRatio) { export function usageRatioToThresholdLevel(currentUsageRatio) {
...@@ -22,9 +22,8 @@ export function usageRatioToThresholdLevel(currentUsageRatio) { ...@@ -22,9 +22,8 @@ export function usageRatioToThresholdLevel(currentUsageRatio) {
* @param {Number} size size in bytes * @param {Number} size size in bytes
* @returns {String} * @returns {String}
*/ */
export const formatUsageSize = (size) => { export const formatUsageSize = (sizeInBytes) => {
const formatDecimalBytes = getFormatter(SUPPORTED_FORMATS.kibibytes); return kibibytes(bytesToKiB(sizeInBytes), 1);
return formatDecimalBytes(bytesToKiB(size), 1);
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment