Skip to content

Commit

Permalink
deals with floating point (#688)
Browse files Browse the repository at this point in the history
* deals with floating point format & wrong label name

---------

Signed-off-by: scures <scurescu@suse.com>
  • Loading branch information
scures authored Jan 22, 2024
1 parent f865934 commit 418c7d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/routes/volume/ExpansionVolumeSizeModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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' : ''
Expand Down
4 changes: 2 additions & 2 deletions src/routes/volume/UpdateSnapshotMaxSizeModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -70,7 +70,7 @@ const modal = ({
{...formItemLayout}
style={{ display: 'flex', flexDirection: 'column' }}
>
<FormItem label="Max Count">
<FormItem label="Max Size">
{getFieldDecorator('snapshotMaxSize', {
initialValue: minValue,
rules: [
Expand Down

0 comments on commit 418c7d6

Please sign in to comment.