import {Flex, Progress} from '@gravity-ui/uikit'; import {cn} from '../../utils/cn'; import {formatStorageMetricPair} from '../../utils/storageMetrics'; import {parseOptionalNonNegativeNumber} from '../../utils/utils'; import {pDiskInfoKeyset as i18n} from './i18n'; import './PDiskLogSize.scss'; const b = cn('ydb-pdisk-log-size'); export function PDiskLogSize({used, total}: {used?: string; total?: string}) { const usedSize = parseOptionalNonNegativeNumber(used); const totalSize = parseOptionalNonNegativeNumber(total); const percentage = usedSize !== undefined && totalSize !== undefined && totalSize > 0 ? Math.min(100, (usedSize / totalSize) * 100) : undefined; if (percentage === undefined) { return formatStorageMetricPair(usedSize, totalSize, 2); } return ( {formatStorageMetricPair(usedSize, totalSize, 2)} ); }