feat: measure and display user quota (#72)

This commit is contained in:
Thomas Durieux
2021-09-06 14:53:42 +02:00
committed by GitHub
parent 91014fbae2
commit 20e8d533f4
9 changed files with 199 additions and 33 deletions

View File

@@ -406,6 +406,7 @@ angular
$http.get("/api/user").then(
(res) => {
if (res) $scope.user = res.data;
getQuota();
},
() => {
$scope.user = null;
@@ -425,6 +426,22 @@ angular
);
}
getOptions();
function getQuota() {
$http.get("/api/user/quota").then((res) => {
$scope.quota = res.data;
$scope.quota.storage.percent = $scope.quota.storage.total
? ($scope.quota.storage.used * 100) / $scope.quota.storage.total
: 100;
$scope.quota.file.percent = $scope.quota.file.total
? ($scope.quota.file.used * 100) / $scope.quota.file.total
: 100;
$scope.quota.repository.percent = $scope.quota.repository.total
? ($scope.quota.repository.used * 100) /
$scope.quota.repository.total
: 100;
}, console.error);
}
getQuota();
function getMessage() {
$http.get("/api/message").then(
@@ -605,13 +622,6 @@ angular
}
getRepositories();
function getQuota() {
$http.get("/api/user/quota").then((res) => {
$scope.quota = res.data;
}, console.error);
}
// getQuota();
$scope.removeRepository = (repo) => {
if (
confirm(