admin: Implement button to delete the entire FILES dir
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
nemunaire 2025-01-14 15:53:12 +01:00
parent 68dad00930
commit a14c151b04
3 changed files with 34 additions and 1 deletions

View file

@ -1358,6 +1358,7 @@ angular.module("FICApp")
$scope.files = File.query();
$scope.errfnd = null;
$scope.errzip = null;
$scope.clearFilesWIP = false;
$scope.fields = ["id", "path", "name", "size"];
$scope.clearFiles = function (id) {
@ -1366,6 +1367,21 @@ angular.module("FICApp")
$scope.files = [];
});
};
$scope.clearFilesDir = function () {
$scope.addToast('warning', 'Êtes-vous sûr de vouloir continuer ?', "Ceci va supprimer tout le contenu du dossier FILES. Il s'agit des fichiers ci-dessous, il faudra refaire une synchronisation ensuite.",
function () {
$scope.clearFilesWIP = true;
$http({
url: "api/files",
method: "DELETE"
}).then(function (response) {
$scope.clearFilesWIP = false;
}, function (response) {
$scope.clearFilesWIP = false;
$scope.addToast('danger', 'An error occurs when trying to clear files:', response.data.errmsg);
});
});
};
$scope.gunzipFile = function (f) {
f.gunzipWIP = true;
$http({