Replace checkbox with toggle button for ipv6

This commit is contained in:
Johannes Zellner
2022-02-09 16:48:38 +01:00
parent 23d34e59b2
commit 2afa13bd7c
2 changed files with 8 additions and 18 deletions

View File

@@ -58,35 +58,30 @@ angular.module('Application').controller('NetworkController', ['$scope', '$locat
$scope.ipv6Configure = {
busy: false,
success: false,
error: '',
currentState: false,
enabled: false,
isEnabled: false,
refresh: function () {
Client.getIPv6Config(function (error, enabled) {
if (error) return console.error(error);
$scope.ipv6Configure.currentState = enabled;
$scope.ipv6Configure.enabled = enabled;
$scope.ipv6Configure.isEnabled = enabled;
});
},
submit: function () {
setEnabled: function (enabled) {
$scope.ipv6Configure.busy = true;
$scope.ipv6Configure.success = false;
$scope.ipv6Configure.error = '';
Client.setIPv6Config($scope.ipv6Configure.enabled, function (error) {
Client.setIPv6Config(enabled, function (error) {
$scope.ipv6Configure.busy = false;
if (error) {
$scope.ipv6Configure.error = error.message;
$scope.ipv6Configure.enabled = !$scope.ipv6Configure.enabled; // restore old state
return;
}
$scope.ipv6Configure.currentState = $scope.ipv6Configure.enabled;
$scope.ipv6Configure.success = true;
$scope.ipv6Configure.isEnabled = enabled;
});
}
};