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

update space quota on upload, delete and restore #7415

Merged
merged 13 commits into from
Aug 10, 2022
Merged

update space quota on upload, delete and restore #7415

merged 13 commits into from
Aug 10, 2022

Conversation

AlexAndBear
Copy link
Contributor

@AlexAndBear AlexAndBear commented Aug 8, 2022

Description

Note: While uploading files with uppy we check the quota of the respective space, this is why we should keep spaces in sync

Tackling the following issues:

  • Uploading or deleting files doesn't update project spaces quota
  • Restoring files doesn't update project spaces or personal quota
  • Reload outside of the personal home doesn't show quota in the user menu

Related Issue

Motivation and Context

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • ...

@update-docs
Copy link

update-docs bot commented Aug 8, 2022

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@AlexAndBear AlexAndBear changed the title update space quota on upload and delete update space quota on upload, delete and restore Aug 8, 2022
@AlexAndBear AlexAndBear requested review from kulmann and fschade August 8, 2022 16:22
@AlexAndBear AlexAndBear marked this pull request as ready for review August 8, 2022 16:33
@@ -45,7 +45,7 @@ export default {
return filesize(this.spaceQuota.used)
},
quotaUsagePercent() {
return ((this.spaceQuota.used / this.spaceQuota.total) * 100).toFixed(1)
return parseFloat(((this.spaceQuota.used / this.spaceQuota.total) * 100).toFixed(2))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aligned to oc10 user quota view

Comment on lines -216 to -218
...(user.quota &&
user.quota.definition !== 'default' &&
user.quota.definition !== 'none' && { quota: user.quota })
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 don't get this conditions, we load the user quota on other places without those conditions

Copy link
Member

Choose a reason for hiding this comment

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

Me neither 😞

@sonarcloud
Copy link

sonarcloud bot commented Aug 9, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

42.0% 42.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

Setting the quota in spaces / non-spaces environments has quite some code duplication across the different files touched in this PR. Do you want to continue to work on that or keep it as is for now?

Comment on lines -216 to -218
...(user.quota &&
user.quota.definition !== 'default' &&
user.quota.definition !== 'none' && { quota: user.quota })
Copy link
Member

Choose a reason for hiding this comment

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

Me neither 😞

packages/web-runtime/src/store/user.ts Show resolved Hide resolved
@AlexAndBear
Copy link
Contributor Author

@kulmann If you can give me some tips, I can for sure remove some code duplication

@AlexAndBear AlexAndBear requested a review from kulmann August 10, 2022 09:01
@kulmann
Copy link
Member

kulmann commented Aug 10, 2022

@kulmann If you can give me some tips, I can for sure remove some code duplication

Nevermind. Just saw that the code duplication is in mixins. As we want to get rid of those it's not worth it I think.

Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@kulmann kulmann merged commit e5e0ac7 into master Aug 10, 2022
@delete-merged-branch delete-merged-branch bot deleted the issues/6930 branch August 10, 2022 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing quota exceeded messages Re-fetch quota when it makes sense
3 participants