admin: display errmsg

This commit is contained in:
nemunaire 2018-12-06 00:11:31 +01:00
parent 2c5325c507
commit 485ffafc9a

View File

@ -436,7 +436,7 @@ angular.module("FICApp")
$rootScope.settings.end = new Date(nEnd); $rootScope.settings.end = new Date(nEnd);
$rootScope.settings.generation = new Date(nGen); $rootScope.settings.generation = new Date(nGen);
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when saving settings:', response.data); $rootScope.newBox('danger', 'An error occurs when saving settings:', response.data.errmsg);
}); });
} }
$scope.regenerate = function() { $scope.regenerate = function() {
@ -462,7 +462,7 @@ angular.module("FICApp")
$rootScope.newBox('success', type + 'reseted'); $rootScope.newBox('success', type + 'reseted');
$location.url("/"); $location.url("/");
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when reseting ' + type + ':', response.data); $rootScope.newBox('danger', 'An error occurs when reseting ' + type + ':', response.data.errmsg);
}); });
} }
}; };
@ -495,7 +495,7 @@ angular.module("FICApp")
$('#revokeModal').modal('hide'); $('#revokeModal').modal('hide');
$scope.certificates = Certificate.query(); $scope.certificates = Certificate.query();
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when trying to associate certificate:', response.data); $rootScope.newBox('danger', 'An error occurs when trying to associate certificate:', response.data.errmsg);
} }
); );
} }
@ -510,7 +510,7 @@ angular.module("FICApp")
$scope.certificates = Certificate.query(); $scope.certificates = Certificate.query();
$scope.selectedTeam = null; $scope.selectedTeam = null;
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when trying to associate certificate:', response.data); $rootScope.newBox('danger', 'An error occurs when trying to associate certificate:', response.data.errmsg);
} }
); );
}; };
@ -519,7 +519,7 @@ angular.module("FICApp")
$http.post("/api/ca/new").then(function() { $http.post("/api/ca/new").then(function() {
$scope.ca = CACertificate.get(); $scope.ca = CACertificate.get();
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when generating CA:', response.data); $rootScope.newBox('danger', 'An error occurs when generating CA:', response.data.errmsg);
}); });
}; };
@ -527,7 +527,7 @@ angular.module("FICApp")
$http.post("/api/certs").then(function() { $http.post("/api/certs").then(function() {
$scope.certificates = Certificate.query(); $scope.certificates = Certificate.query();
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when generating certificate:', response.data); $rootScope.newBox('danger', 'An error occurs when generating certificate:', response.data.errmsg);
}); });
}; };
}) })
@ -656,7 +656,7 @@ angular.module("FICApp")
prms.$promise.then(function() { prms.$promise.then(function() {
$rootScope.newBox('success', 'Scene successfully published!'); $rootScope.newBox('success', 'Scene successfully published!');
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when saving scene:', response.data); $rootScope.newBox('danger', 'An error occurs when saving scene:', response.data.errmsg);
}); });
}; };
$scope.addScene = function() { $scope.addScene = function() {
@ -918,7 +918,7 @@ angular.module("FICApp")
$rootScope.newBox('success', 'Synchronisation de la liste des thèmes terminée avec succès.'); $rootScope.newBox('success', 'Synchronisation de la liste des thèmes terminée avec succès.');
}, function(response) { }, function(response) {
$scope.inSync = false; $scope.inSync = false;
$rootScope.newBox('danger', 'An error occurs when synchronizing theme list:', response.data); $rootScope.newBox('danger', 'An error occurs when synchronizing theme list:', response.data.errmsg);
}); });
}; };
}) })
@ -1076,7 +1076,7 @@ angular.module("FICApp")
$rootScope.staticFilesNeedUpdate++; $rootScope.staticFilesNeedUpdate++;
$location.url("/themes/" + $routeParams.themeId); $location.url("/themes/" + $routeParams.themeId);
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when trying to delete exercice:', response.data); $rootScope.newBox('danger', 'An error occurs when trying to delete exercice:', response.data.errmsg);
}); });
} }
$scope.saveExercice = function() { $scope.saveExercice = function() {
@ -1156,7 +1156,7 @@ angular.module("FICApp")
$scope.hints.splice($scope.hints.indexOf(this.hint), 1); $scope.hints.splice($scope.hints.indexOf(this.hint), 1);
$rootScope.staticFilesNeedUpdate++; $rootScope.staticFilesNeedUpdate++;
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when trying to delete hint:', response.data); $rootScope.newBox('danger', 'An error occurs when trying to delete hint:', response.data.errmsg);
}); });
} }
$scope.saveHint = function() { $scope.saveHint = function() {
@ -1183,7 +1183,7 @@ angular.module("FICApp")
$rootScope.newBox('success', "Synchronisation de la liste d'indices terminée avec succès."); $rootScope.newBox('success', "Synchronisation de la liste d'indices terminée avec succès.");
}, function(response) { }, function(response) {
$scope.inSync = false; $scope.inSync = false;
$rootScope.newBox('danger', 'An error occurs when synchronizing hints list:', response.data); $rootScope.newBox('danger', 'An error occurs when synchronizing hints list:', response.data.errmsg);
}); });
}; };
}) })
@ -1199,7 +1199,7 @@ angular.module("FICApp")
$scope.flags.splice($scope.flags.indexOf(this.flag), 1); $scope.flags.splice($scope.flags.indexOf(this.flag), 1);
$rootScope.staticFilesNeedUpdate++; $rootScope.staticFilesNeedUpdate++;
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when trying to delete flag:', response.data); $rootScope.newBox('danger', 'An error occurs when trying to delete flag:', response.data.errmsg);
}); });
} }
$scope.saveFlag = function() { $scope.saveFlag = function() {
@ -1226,7 +1226,7 @@ angular.module("FICApp")
$rootScope.newBox('success', "Synchronisation de la liste de drapeaux terminée avec succès."); $rootScope.newBox('success', "Synchronisation de la liste de drapeaux terminée avec succès.");
}, function(response) { }, function(response) {
$scope.inSync = false; $scope.inSync = false;
$rootScope.newBox('danger', 'An error occurs when synchronizing flags list:', response.data); $rootScope.newBox('danger', 'An error occurs when synchronizing flags list:', response.data.errmsg);
}); });
}; };
}) })
@ -1242,7 +1242,7 @@ angular.module("FICApp")
$scope.quiz.splice($scope.quiz.indexOf(this.q), 1); $scope.quiz.splice($scope.quiz.indexOf(this.q), 1);
$rootScope.staticFilesNeedUpdate++; $rootScope.staticFilesNeedUpdate++;
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when trying to delete flag:', response.data); $rootScope.newBox('danger', 'An error occurs when trying to delete flag:', response.data.errmsg);
}); });
} }
$scope.saveQuiz = function() { $scope.saveQuiz = function() {
@ -1310,7 +1310,7 @@ angular.module("FICApp")
$scope.certificates = TeamCertificate.query({ teamId: $routeParams.teamId }); $scope.certificates = TeamCertificate.query({ teamId: $routeParams.teamId });
$rootScope.newBox('success', 'Certificate successfully dissociated!'); $rootScope.newBox('success', 'Certificate successfully dissociated!');
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when dissociating certiticate:', response.data); $rootScope.newBox('danger', 'An error occurs when dissociating certiticate:', response.data.errmsg);
}); });
} }
@ -1328,7 +1328,7 @@ angular.module("FICApp")
$scope.deleteTeam = function() { $scope.deleteTeam = function() {
backName = this.team.name; backName = this.team.name;
this.team.$remove(function() { $rootScope.newBox('success', 'Team ' + backName + ' successfully removed.'); $location.url("/teams/"); $rootScope.staticFilesNeedUpdate++; }, this.team.$remove(function() { $rootScope.newBox('success', 'Team ' + backName + ' successfully removed.'); $location.url("/teams/"); $rootScope.staticFilesNeedUpdate++; },
function(response) { $rootScope.newBox('danger', 'An error occurs during suppression of the team:', response.data); }); function(response) { $rootScope.newBox('danger', 'An error occurs during suppression of the team:', response.data.errmsg); });
} }
$scope.showStats = function() { $scope.showStats = function() {
$location.url("/teams/" + $scope.team.id + "/stats"); $location.url("/teams/" + $scope.team.id + "/stats");
@ -1345,7 +1345,7 @@ angular.module("FICApp")
$rootScope.staticFilesNeedUpdate++; $rootScope.staticFilesNeedUpdate++;
$scope.history = TeamHistory.query({ teamId: $routeParams.teamId }); $scope.history = TeamHistory.query({ teamId: $routeParams.teamId });
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when removing history item: ', response.data); $rootScope.newBox('danger', 'An error occurs when removing history item: ', response.data.errmsg);
}); });
} }
}) })