Unverified Commit 94e2a86b authored by Francesc Guasch's avatar Francesc Guasch Committed by GitHub
Browse files

fix(frontend): restored removed settings (#1477)

issue #1475
parent 4982fa18
......@@ -11,6 +11,7 @@ ravadaApp.directive("solShowMachine", swMach)
.controller("settings_node",settings_node)
.controller("settings_network",settings_network)
.controller("new_node", newNodeCtrl)
.controller("settings_global", settings_global_ctrl)
;
ravadaApp.directive('ipaddress', function() {
......@@ -777,4 +778,40 @@ ravadaApp.directive("solShowMachine", swMach)
});
};
};
function settings_global_ctrl($scope, $http) {
$scope.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
$scope.init = function() {
$http.get('/settings_global.json').then(function(response) {
$scope.settings = response.data;
var now = new Date();
if ($scope.settings.frontend.maintenance.value == 0 ) {
$scope.settings.frontend.maintenance_start.value
= new Date(now.getFullYear(), now.getMonth(), now.getDate()
, now.getHours(), now.getMinutes());
$scope.settings.frontend.maintenance_end.value
= new Date(now.getFullYear(), now.getMonth(), now.getDate()
, now.getHours(), now.getMinutes() + 15);
} else {
$scope.settings.frontend.maintenance_start.value
=new Date($scope.settings.frontend.maintenance_start.value);
$scope.settings.frontend.maintenance_end.value
=new Date($scope.settings.frontend.maintenance_end.value);
}
});
};
$scope.load_settings = function() {
$scope.init();
$scope.formSettings.$setPristine();
};
$scope.update_settings = function() {
$scope.formSettings.$setPristine();
$http.post('/settings_global'
,JSON.stringify($scope.settings)
).then(function(response) {
});
};
};
}());
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment