From 418c7d6997ff8cded38a76e8ce7aba5af6c5a3d2 Mon Sep 17 00:00:00 2001 From: Sorin Date: Mon, 22 Jan 2024 12:38:43 +0100 Subject: [PATCH] deals with floating point (#688) * deals with floating point format & wrong label name --------- Signed-off-by: scures --- src/routes/volume/ExpansionVolumeSizeModal.js | 6 ++++-- src/routes/volume/UpdateSnapshotMaxSizeModal.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/routes/volume/ExpansionVolumeSizeModal.js b/src/routes/volume/ExpansionVolumeSizeModal.js index 733b2620..b2dded30 100644 --- a/src/routes/volume/ExpansionVolumeSizeModal.js +++ b/src/routes/volume/ExpansionVolumeSizeModal.js @@ -52,7 +52,9 @@ const modal = ({ if (selected && selected.size) { let sizeMi = parseInt(selected.size, 10) / (1024 * 1024) - return getFieldsValue().unit === 'Gi' ? sizeMi / 1024 : parseInt(sizeMi, 10) + return getFieldsValue().unit === 'Gi' + ? (sizeMi / 1024).toFixed(2) + : parseInt(sizeMi, 10) } return 0 } @@ -67,7 +69,7 @@ const modal = ({ } else { currentSize *= 1024 } - setFieldsValue({ size: currentSize, unit: value }) + setFieldsValue({ size: currentSize.toFixed(2), unit: value }) } const messageDisableFrontend = selected && selected.disableFrontend ? 'Longhorn will not expand the filesystem for the volume in maintenance mode. There is no available frontend for filesystem expansion' : '' diff --git a/src/routes/volume/UpdateSnapshotMaxSizeModal.js b/src/routes/volume/UpdateSnapshotMaxSizeModal.js index fb70da13..d1893a7d 100644 --- a/src/routes/volume/UpdateSnapshotMaxSizeModal.js +++ b/src/routes/volume/UpdateSnapshotMaxSizeModal.js @@ -37,7 +37,7 @@ const modal = ({ let sizeMi = parseInt(item?.snapshotMaxSize, 10) / (1024 * 1024) return getFieldsValue().unit === 'Gi' - ? sizeMi / 1024 + ? (sizeMi / 1024).toFixed(2) : parseInt(sizeMi, 10) } return 0 @@ -70,7 +70,7 @@ const modal = ({ {...formItemLayout} style={{ display: 'flex', flexDirection: 'column' }} > - + {getFieldDecorator('snapshotMaxSize', { initialValue: minValue, rules: [