diff --git a/src/views/network.html b/src/views/network.html index 069819e69..32efcb09d 100644 --- a/src/views/network.html +++ b/src/views/network.html @@ -152,17 +152,14 @@

{{ 'network.ipv6.description' | tr }}

+


{{ ipv6Configure.error }}

-
- {{ ipv6Configure.error }} -
- -
- - +
+ +
@@ -176,21 +173,13 @@

{{ 'network.dyndns.description' | tr }}


{{ dyndnsConfigure.error }}

-
- -
-
- {{ 'network.dyndns.saved' | tr }} -
- -
- +
+ +
diff --git a/src/views/network.js b/src/views/network.js index cd4e5f6a6..2f79d9d30 100644 --- a/src/views/network.js +++ b/src/views/network.js @@ -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; }); } };