Fixed ddns page

This commit is contained in:
Martin Schröder 2015-05-25 16:14:11 +02:00 committed by Martin Schröder
parent 872a024bd0
commit 1105e6080e
2 changed files with 10 additions and 6 deletions

View file

@ -13,8 +13,8 @@
</div>
</luci-config-line>
<luci-config-line title="{{'DNS Servers'|translate}} #{{$index}}" ng-show="wan.peerdns.value == 1" >
<div ng-repeat="dns in wan.dns.value track by $index" class="form-group">
<input type="text" class="form-control" ng-model="wan.dns.value[$index]" placeholder="{{'DNS Server'|translate}} #{{$index}}"/>
<div ng-repeat="dns in dnsServers track by $index" class="form-group">
<input type="text" class="form-control" ng-model="dns.value" ng-blur="onDNSBlur()" placeholder="{{'DNS Server'|translate}} #{{$index}}"/>
</div>
</luci-config-line>
</luci-config-lines>

View file

@ -4,10 +4,14 @@ JUCI.app
$log.info("uci", $uci);
$uci.sync(["network","ddns"]).done(function () {
if ($uci.network && $uci.network.wan) {
$scope.wan = $uci.network.wan;
if ($scope.wan.dns){
while($scope.wan.dns.value.length < 2) $scope.wan.dns.value.push("");
}
var wan = $uci.network.wan;
while(wan.dns.value.length < 2) wan.dns.value.push("");
$scope.dnsServers = wan.dns.value.map(function(x){ return { value: x }; });
$scope.onDNSBlur = function(){
wan.dns.value = $scope.dnsServers.map(function(x) { return x.value; });
};
$scope.wan = wan;
$scope.$apply();
} else {
// TODO: this should be a dynamic name (wan will not always be called wan in the future)
$scope.$emit("Could not find WAN network on this device");