Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function DiskStateProgressBar({
}

if (!compact && diskAllocatedPercent >= 0) {
return <div className={b('title')}>{`${Math.round(diskAllocatedPercent)}%`}</div>;
return <div className={b('title')}>{`${Math.floor(diskAllocatedPercent)}%`}</div>;
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion src/components/MemoryViewer/MemoryViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function MemoryViewer({

const theme = useTheme();
let fillWidth =
Math.round((parseFloat(String(memoryUsage)) / parseFloat(String(capacity))) * 100) || 0;
Math.floor((parseFloat(String(memoryUsage)) / parseFloat(String(capacity))) * 100) || 0;
fillWidth = fillWidth > 100 ? 100 : fillWidth;
let valueText: number | string | undefined = memoryUsage,
capacityText: number | string | undefined = capacity,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProgressViewer/ProgressViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function ProgressViewer({
const theme = useTheme();

let fillWidth =
Math.round((parseFloat(String(value)) / parseFloat(String(capacity))) * 100) || 0;
Math.floor((parseFloat(String(value)) / parseFloat(String(capacity))) * 100) || 0;
fillWidth = fillWidth > 100 ? 100 : fillWidth;
let valueText: number | string | undefined = value,
capacityText: number | string | undefined = capacity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function DiskGroupsStats({stats, storageType}: GroupsStatsPopupContentPro
const convertedAllocatedSize = formatBytes({value: allocatedSize, size: sizeToConvert});
const convertedAvailableSize = formatBytes({value: availableSize, size: sizeToConvert});

const usage = Math.round((allocatedSize / (allocatedSize + availableSize)) * 100);
const usage = Math.floor((allocatedSize / (allocatedSize + availableSize)) * 100);

const info = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('prepareGroupsVDisk', () => {
AllocatedSize: 30943477760,
AvailableSize: 234461593600,
TotalSize: 265405071360,
AllocatedPercent: 12,
AllocatedPercent: 11,

Donors: undefined,

Expand Down Expand Up @@ -135,7 +135,7 @@ describe('prepareGroupsVDisk', () => {
AllocatedSize: 30943477760,
AvailableSize: 234461593600,
TotalSize: 265405071360,
AllocatedPercent: 12,
AllocatedPercent: 11,

PDisk: {
AllocatedPercent: NaN,
Expand Down Expand Up @@ -237,7 +237,7 @@ describe('prepareGroupsVDisk', () => {
AllocatedSize: 30943477760,
AvailableSize: 234461593600,
TotalSize: 265405071360,
AllocatedPercent: 12,
AllocatedPercent: 11,

Donors: undefined,

Expand Down
4 changes: 2 additions & 2 deletions src/utils/disks/__test__/prepareDisks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('prepareWhiteboardVDiskData', () => {
AvailableSize: 188523479040,
AllocatedSize: 8996782080,
TotalSize: 197520261120,
AllocatedPercent: 5,
AllocatedPercent: 4,
};

const preparedData = prepareWhiteboardVDiskData(data);
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('prepareWhiteboardPDiskData', () => {
AvailableSize: 3107979264000,
TotalSize: 3199556648960,
AllocatedSize: 91577384960,
AllocatedPercent: 3,
AllocatedPercent: 2,

ExpectedSlotCount: 16,
NumActiveSlots: 10,
Expand Down
4 changes: 2 additions & 2 deletions src/utils/disks/prepareDisks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function prepareVDiskSizeFields({
const available = Number(AvailableSize);
const allocated = Number(AllocatedSize);
const total = allocated + available;
const allocatedPercent = Math.round((allocated * 100) / total);
const allocatedPercent = Math.floor((allocated * 100) / total);

return {
AvailableSize: available,
Expand All @@ -145,7 +145,7 @@ export function preparePDiskSizeFields({
const available = Number(AvailableSize);
const total = Number(TotalSize);
const allocated = total - available;
const allocatedPercent = Math.round((allocated * 100) / total);
const allocatedPercent = Math.floor((allocated * 100) / total);

return {
AvailableSize: available,
Expand Down
Loading