settings: new option to postpone the activation of the given settings file
This commit is contained in:
parent
8e6b8829ea
commit
9be56fb9a2
5 changed files with 47 additions and 16 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -83,6 +83,14 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col">
|
||||
<div class="input-group" style="margin-top: 5px;">
|
||||
<div class="input-group-prepend">
|
||||
<button ng-click="updActivateTime()" class="btn btn-sm btn-secondary" type="button"><span class="glyphicon glyphicon-record" aria-hidden="true"></span> Propager plus tard</button>
|
||||
</div>
|
||||
<input type="text" class="form-control form-control-sm" id="activateTime" ng-model="config.activateTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-save" aria-hidden="true"></span> Propager ces paramètres</button>
|
||||
</div>
|
||||
|
|
|
|||
Reference in a new issue