Merge quota requests into folders request

This commit is contained in:
djmaze 2021-11-01 16:26:07 +01:00
parent 20eb01de08
commit 8d3bcdc2f2
9 changed files with 45 additions and 51 deletions

View file

@ -27,6 +27,9 @@ export const FolderUserStore = new class {
listStatusSupported: false,
// sortMode: '',
quotaLimit: 0,
quotaUsage: 0,
sentFolder: '',
draftFolder: '',
spamFolder: '',
@ -103,6 +106,11 @@ export const FolderUserStore = new class {
trashFolder: fSetSystemFolderType(FolderType.Trash),
archiveFolder: fSetSystemFolderType(FolderType.Archive)
});
this.quotaPercentage = ko.computed(() => {
const quota = this.quotaLimit(), usage = this.quotaUsage();
return 0 < quota ? Math.ceil((usage / quota) * 100) : 0;
});
}
/**

View file

@ -1,24 +0,0 @@
import ko from 'ko';
export const QuotaUserStore = new class {
constructor() {
this.quota = ko.observable(0);
this.usage = ko.observable(0);
this.percentage = ko.computed(() => {
const quota = this.quota(),
usage = this.usage();
return 0 < quota ? Math.ceil((usage / quota) * 100) : 0;
});
}
/**
* @param {number} quota
* @param {number} usage
*/
populateData(quota, usage) {
this.quota(quota * 1024);
this.usage(usage * 1024);
}
};