feat: handle repository download and remove using a job queue

This commit is contained in:
tdurieux
2021-09-08 15:00:15 +02:00
parent d82f882ba8
commit 9838891567
8 changed files with 1121 additions and 52 deletions
+32 -11
View File
@@ -634,11 +634,22 @@ angular
body: `The repository ${repo.repoId} is going to be removed.`,
};
$scope.toasts.push(toast);
$http.delete(`/api/repo/${repo.repoId}`).then(() => {
toast.title = `${repo.repoId} is removed.`;
toast.body = `The repository ${repo.repoId} is removed.`;
getRepositories();
});
$http.delete(`/api/repo/${repo.repoId}`).then(
() => {
setTimeout(() => {
toast.title = `${repo.repoId} is removed.`;
toast.body = `The repository ${repo.repoId} is removed.`;
getRepositories();
$scope.$apply();
}, 5000);
},
(error) => {
toast.title = `Error during the removal of ${repo.repoId}.`;
toast.body = error.body;
getRepositories();
}
);
}
};
@@ -646,16 +657,26 @@ angular
const toast = {
title: `Refreshing ${repo.repoId}...`,
date: new Date(),
body: `The repository ${repo.repoId} is going to be removed.`,
body: `The repository ${repo.repoId} is going to be refreshed.`,
};
$scope.toasts.push(toast);
$http.post(`/api/repo/${repo.repoId}/refresh`).then(() => {
toast.title = `${repo.repoId} is refreshed.`;
toast.body = `The repository ${repo.repoId} is refreshed.`;
$http.post(`/api/repo/${repo.repoId}/refresh`).then(
() => {
setTimeout(() => {
toast.title = `${repo.repoId} is refreshed.`;
toast.body = `The repository ${repo.repoId} is refreshed.`;
getRepositories();
$scope.$apply();
}, 5000);
},
(error) => {
toast.title = `Error during the refresh of ${repo.repoId}.`;
toast.body = error.body;
getRepositories();
});
getRepositories();
}
);
};
$scope.repoFiler = (repo) => {