Commit dd659ca9 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'mrincon/refactor-formatUsageSize-unit-format' into 'master'

Refactor formatUsageSize to use a simple function

See merge request gitlab-org/gitlab!83393
parents 6ecd8a55 d75a49fd
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';
export function usageRatioToThresholdLevel(currentUsageRatio) {
......@@ -22,9 +22,8 @@ export function usageRatioToThresholdLevel(currentUsageRatio) {
* @param {Number} size size in bytes
* @returns {String}
*/
export const formatUsageSize = (size) => {
const formatDecimalBytes = getFormatter(SUPPORTED_FORMATS.kibibytes);
return formatDecimalBytes(bytesToKiB(size), 1);
export const formatUsageSize = (sizeInBytes) => {
return kibibytes(bytesToKiB(sizeInBytes), 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