settings: new option to postpone the activation of the given settings file

This commit is contained in:
nemunaire 2019-01-17 13:03:15 +01:00
parent 8e6b8829ea
commit 9be56fb9a2
5 changed files with 47 additions and 16 deletions

View file

@ -421,6 +421,7 @@ angular.module("FICApp")
$rootScope.settings.start = new Date(response.start);
$rootScope.settings.end = new Date(response.end);
$rootScope.settings.generation = new Date(response.generation);
$rootScope.settings.activateTime = new Date(response.activateTime);
})
$scope.configro = ROSettings.get();
$scope.duration = 240;
@ -430,11 +431,13 @@ angular.module("FICApp")
var nStart = this.config.start;
var nEnd = this.config.end;
var nGen = this.config.generation;
var aTime = this.config.activateTime;
this.config.$update(function() {
$rootScope.newBox('success', msg);
$rootScope.settings.start = new Date(nStart);
$rootScope.settings.end = new Date(nEnd);
$rootScope.settings.generation = new Date(nGen);
$rootScope.settings.activateTime = new Date(aTime);
}, function(response) {
$rootScope.newBox('danger', 'An error occurs when saving settings:', response.data.errmsg);
});
@ -456,6 +459,11 @@ angular.module("FICApp")
$scope.saveSettings();
});
}
$scope.updActivateTime = function() {
var ts = Date.now() - Date.now() % 60000;
var d = new Date(ts + 120000);
this.config.activateTime = d.toISOString();
}
$scope.reset = function(type) {
if (confirm("Êtes-vous sûr ?")) {
$http.post("/api/reset", {"type": type}).then(function(time) {