Replace checkbox with toggle button for ipv6
This commit is contained in:
@@ -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;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user