admin: Can gunzip files
This commit is contained in:
parent
c082ee43d0
commit
a0cd651dae
4 changed files with 83 additions and 3 deletions
|
|
@ -1350,7 +1350,8 @@ angular.module("FICApp")
|
|||
|
||||
.controller("FilesListController", function($scope, File, $location, $http, $rootScope) {
|
||||
$scope.files = File.query();
|
||||
$scope.errfnd = 0;
|
||||
$scope.errfnd = null;
|
||||
$scope.errzip = null;
|
||||
$scope.fields = ["id", "path", "name", "checksum", "size"];
|
||||
|
||||
$scope.clearFiles = function(id) {
|
||||
|
|
@ -1359,6 +1360,21 @@ angular.module("FICApp")
|
|||
$scope.files = [];
|
||||
});
|
||||
};
|
||||
$scope.gunzipFile = function(f) {
|
||||
f.gunzipWIP = true;
|
||||
$http({
|
||||
url: "api/files/" + f.id + "/gunzip",
|
||||
method: "POST"
|
||||
}).then(function(response) {
|
||||
f.gunzipWIP = false;
|
||||
f.err = true;
|
||||
}, function(response) {
|
||||
f.gunzipWIP = false;
|
||||
$scope.inSync = false;
|
||||
$scope.errzip += 1;
|
||||
f.err = response.data.errmsg;
|
||||
})
|
||||
};
|
||||
$scope.checksum = function(f) {
|
||||
$http({
|
||||
url: "api/files/" + f.id + "/check",
|
||||
|
|
@ -1372,10 +1388,18 @@ angular.module("FICApp")
|
|||
})
|
||||
};
|
||||
$scope.checksumAll = function() {
|
||||
$scope.errfnd = 0;
|
||||
$scope.errfnd = null;
|
||||
angular.forEach($scope.files, function(file) {
|
||||
$scope.checksum(file);
|
||||
});
|
||||
if ($scope.errfnd === null) $scope.errfnd = 0;
|
||||
};
|
||||
$scope.gunzipFiles = function() {
|
||||
$scope.errzip = null;
|
||||
angular.forEach($scope.files, function(file) {
|
||||
$scope.gunzipFile(file);
|
||||
});
|
||||
if ($scope.errzip === null) $scope.errzip = 0;
|
||||
};
|
||||
$scope.show = function(f) {
|
||||
$location.url("/exercices/" + f.idExercice);
|
||||
|
|
|
|||
Reference in a new issue