Replace dyndns checkbox with toggle button
This commit is contained in:
@@ -27,31 +27,26 @@ angular.module('Application').controller('NetworkController', ['$scope', '$locat
|
||||
|
||||
$scope.dyndnsConfigure = {
|
||||
busy: false,
|
||||
success: false,
|
||||
error: '',
|
||||
currentState: false,
|
||||
enabled: false,
|
||||
isEnabled: false,
|
||||
|
||||
refresh: function () {
|
||||
Client.getDynamicDnsConfig(function (error, enabled) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.dyndnsConfigure.currentState = enabled;
|
||||
$scope.dyndnsConfigure.enabled = enabled;
|
||||
$scope.dyndnsConfigure.isEnabled = enabled;
|
||||
});
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
setEnabled: function (enabled) {
|
||||
$scope.dyndnsConfigure.busy = true;
|
||||
$scope.dyndnsConfigure.success = false;
|
||||
$scope.dyndnsConfigure.error = '';
|
||||
|
||||
Client.setDynamicDnsConfig($scope.dyndnsConfigure.enabled, function (error) {
|
||||
if (error) $scope.dyndnsConfigure.error = error.message;
|
||||
else $scope.dyndnsConfigure.currentState = $scope.dyndnsConfigure.enabled;
|
||||
|
||||
Client.setDynamicDnsConfig(enabled, function (error) {
|
||||
$scope.dyndnsConfigure.busy = false;
|
||||
$scope.dyndnsConfigure.success = true;
|
||||
|
||||
if (error) $scope.dyndnsConfigure.error = error.message;
|
||||
else $scope.dyndnsConfigure.isEnabled = enabled;
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -76,12 +71,8 @@ angular.module('Application').controller('NetworkController', ['$scope', '$locat
|
||||
Client.setIPv6Config(enabled, function (error) {
|
||||
$scope.ipv6Configure.busy = false;
|
||||
|
||||
if (error) {
|
||||
$scope.ipv6Configure.error = error.message;
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.ipv6Configure.isEnabled = enabled;
|
||||
if (error) $scope.ipv6Configure.error = error.message;
|
||||
else $scope.ipv6Configure.isEnabled = enabled;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user