settings: Can disable all submission button for maintenance

This commit is contained in:
nemunaire 2022-06-08 04:39:20 +02:00
parent 329bd246c7
commit e9dd35f8ac
9 changed files with 41 additions and 10 deletions

View file

@ -529,6 +529,7 @@ angular.module("FICApp")
$scope.config[k] = ns.values[k];
});
$scope.config.enableExerciceDepend = $scope.config.unlockedChallengeDepth >= 0;
$scope.config.disabledsubmitbutton = $scope.config.disablesubmitbutton && $scope.config.disablesubmitbutton.length > 0;
}
$scope.deleteNextSettings = function(ns) {
ns.$delete().then(function() {
@ -542,6 +543,7 @@ angular.module("FICApp")
$scope.config.$promise.then(function(response) {
$scope.dist_config = Object.assign({}, response);
response.enableExerciceDepend = response.unlockedChallengeDepth >= 0;
response.disabledsubmitbutton = response.disablesubmitbutton && response.disablesubmitbutton.length > 0;
$rootScope.settings.start = new Date(response.start);
$rootScope.settings.end = new Date(response.end);
$rootScope.settings.generation = new Date(response.generation);
@ -562,6 +564,13 @@ angular.module("FICApp")
$scope.config.unlockedChallengeDepth = -1;
};
$scope.submitButtonStateChange = function() {
if ($scope.config.disabledsubmitbutton)
$scope.config.disablesubmitbutton = "Mise à jour en cours...";
else
$scope.config.disablesubmitbutton = "";
};
$scope.saveChallengeInfo = function() {
this.challenge.duration = $scope.duration;
this.challenge.$update(function(response) {
@ -577,6 +586,7 @@ angular.module("FICApp")
var nGen = this.config.generation;
var state = this.config.enableExerciceDepend;
this.config.unlockedChallengeDepth = (this.config.enableExerciceDepend?this.config.unlockedChallengeDepth:-1)
this.config.disablesubmitbutton = (this.config.disabledsubmitbutton?this.config.disablesubmitbutton:'')
var updateQuery = {};
if (this.activateTime && this.activateTime != '0001-01-01T00:00:00Z') {
updateQuery['t'] = this.activateTime;
@ -590,6 +600,7 @@ angular.module("FICApp")
$scope.addToast('success', msg);
$scope.nextsettings = NextSettings.query();
response.enableExerciceDepend = response.unlockedChallengeDepth >= 0;
response.disabledsubmitbutton = response.disablesubmitbutton && response.disablesubmitbutton.length > 0;
$rootScope.settings.start = new Date(nStart);
$rootScope.settings.end = new Date(nEnd);
$rootScope.settings.generation = new Date(nGen);