Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit relative quota in user menu to two decimals #9369

Merged
merged 1 commit into from
Jul 10, 2023
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
@@ -0,0 +1,7 @@
Bugfix: Relative user quota display limited to two decimals

If the relative user quota is being reported too precisely from the backend, there was a chance of small display issue.
This has been resolved by limiting the number of decimals that get displayed for the relative quota to two.

https://github.com/owncloud/web/issues/9259
https://github.com/owncloud/web/pull/9369
2 changes: 1 addition & 1 deletion packages/web-runtime/src/components/Topbar/UserMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export default defineComponent({
},
quotaUsagePercent() {
return this.useLegacyQuota
? this.quota.relative
? parseFloat(this.quota.relative.toFixed(2))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only parse this.quota.relative to float and then to a toFixed(2) on the result.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that initially but then quotaUsagePercent is string | number and it gets messy further down where we're calculating how much free quota is left to change the color of the OcProgress component.
The alternative was parseFloat(parseFloat(this.quota.relative).toFixed(2)) but that also didn't really feel right...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll go ahead as-is and can adapt (= add another parseFloat) if EOS/Reva requires it

: parseFloat(((this.quota.used / this.quota.total) * 100).toFixed(2))
},

Expand Down