Skip to content

Commit c0b6886

Browse files
fix: floor disk usage values
1 parent 5a9b4a0 commit c0b6886

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/components/DiskStateProgressBar/DiskStateProgressBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function DiskStateProgressBar({
5959
}
6060

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

6565
return null;

src/components/MemoryViewer/MemoryViewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function MemoryViewer({
5959

6060
const theme = useTheme();
6161
let fillWidth =
62-
Math.round((parseFloat(String(memoryUsage)) / parseFloat(String(capacity))) * 100) || 0;
62+
Math.floor((parseFloat(String(memoryUsage)) / parseFloat(String(capacity))) * 100) || 0;
6363
fillWidth = fillWidth > 100 ? 100 : fillWidth;
6464
let valueText: number | string | undefined = memoryUsage,
6565
capacityText: number | string | undefined = capacity,

src/components/ProgressViewer/ProgressViewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function ProgressViewer({
6767
const theme = useTheme();
6868

6969
let fillWidth =
70-
Math.round((parseFloat(String(value)) / parseFloat(String(capacity))) * 100) || 0;
70+
Math.floor((parseFloat(String(value)) / parseFloat(String(capacity))) * 100) || 0;
7171
fillWidth = fillWidth > 100 ? 100 : fillWidth;
7272
let valueText: number | string | undefined = value,
7373
capacityText: number | string | undefined = capacity,

src/containers/Cluster/ClusterInfo/components/DiskGroupsStatsBars/DiskGroupsStats.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function DiskGroupsStats({stats, storageType}: GroupsStatsPopupContentPro
3232
const convertedAllocatedSize = formatBytes({value: allocatedSize, size: sizeToConvert});
3333
const convertedAvailableSize = formatBytes({value: availableSize, size: sizeToConvert});
3434

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

3737
const info = [
3838
{

src/utils/disks/prepareDisks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function prepareVDiskSizeFields({
125125
const available = Number(AvailableSize);
126126
const allocated = Number(AllocatedSize);
127127
const total = allocated + available;
128-
const allocatedPercent = Math.round((allocated * 100) / total);
128+
const allocatedPercent = Math.floor((allocated * 100) / total);
129129

130130
return {
131131
AvailableSize: available,
@@ -145,7 +145,7 @@ export function preparePDiskSizeFields({
145145
const available = Number(AvailableSize);
146146
const total = Number(TotalSize);
147147
const allocated = total - available;
148-
const allocatedPercent = Math.round((allocated * 100) / total);
148+
const allocatedPercent = Math.floor((allocated * 100) / total);
149149

150150
return {
151151
AvailableSize: available,

0 commit comments

Comments
 (0)