mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
Fixed dns config section
This commit is contained in:
parent
b44e114316
commit
00bc383dfc
5 changed files with 44 additions and 55 deletions
|
|
@ -61,6 +61,28 @@ $juci.module("core")
|
|||
}
|
||||
};
|
||||
})
|
||||
.directive("luciConfigDetailLine", function(){
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
return {
|
||||
template: '<div><div class="row" style="margin-top: 10px;">'+
|
||||
'<div class="col-xs-5 col-xs-offset-1" style="transform: translateY(30%)">'+
|
||||
'<label style="font-size: 1em">{{title}}</label>'+
|
||||
'<p style="font-size: 12px">{{help}}</p>'+
|
||||
'</div>'+
|
||||
'<div class="col-xs-6">'+
|
||||
'<div class="{{pullClass}}" ng-transclude></div>'+
|
||||
'</div></div></div>',
|
||||
replace: true,
|
||||
scope: {
|
||||
title: "@",
|
||||
help: "@"
|
||||
},
|
||||
transclude: true,
|
||||
link: function (scope, element, attrs) {
|
||||
if(!("noPull" in attrs)) scope.pullClass = "pull-right";
|
||||
}
|
||||
};
|
||||
})
|
||||
.directive("luciConfigApply", function(){
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<div class="form-group" class="col-md-6">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-5" ng-show="{{label}}">
|
||||
<label class="detail-strong-input">{{label|translate}}</label>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="{{label?'col-md-7':'col-md-12'}}col-md-7">
|
||||
<div class="col-sm-2 no-side-padding col-sm-offset-1">
|
||||
<input type="text" class="form-control input-lg no-padding text-center" ng-model="data[0]" placeholder="..." maxlength="3" />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,25 +1,19 @@
|
|||
$juci.module("core")
|
||||
.directive("luciInputIpAddress", function (gettext, $log) {
|
||||
.directive("luciInputIpAddress", function () {
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
return {
|
||||
templateUrl: plugin_root + "/widgets/luci.input.ipaddress.html",
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
label: "@",
|
||||
label: "=",
|
||||
ngModel: "="
|
||||
},
|
||||
require: "^ngModel",
|
||||
link: function (scope, element, attrs, ctrl) {
|
||||
$log.debug("scope", scope);
|
||||
$log.debug("element", element);
|
||||
$log.debug("attrs", attrs);
|
||||
$log.debug("ctrl", ctrl);
|
||||
|
||||
scope.data = [];
|
||||
|
||||
console.log("MODEL VALUE: ", scope.ngModel);
|
||||
if(ctrl.ngModel && ctrl.ngModel.split){
|
||||
var parts = value.split(".");
|
||||
if(scope.ngModel && scope.ngModel.split){
|
||||
var parts = scope.ngModel.split(".");
|
||||
scope.data[0] = parts[0]||"";
|
||||
scope.data[1] = parts[1]||"";
|
||||
scope.data[2] = parts[2]||"";
|
||||
|
|
@ -27,9 +21,7 @@ $juci.module("core")
|
|||
}
|
||||
|
||||
scope.$watch("data", function() {
|
||||
$log.debug("data", scope.data);
|
||||
var ipAddress = scope.data.join('.');
|
||||
$log.debug('ip address', ipAddress);
|
||||
scope.ngModel = ipAddress;
|
||||
}, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,23 +9,15 @@
|
|||
<luci-input-radio ng-model="wan.peerdns" label="'automatically'" value="0" />
|
||||
</div>
|
||||
<div class="col-md-5 col-lg-offset-1">
|
||||
<luci-input-radio ng-model="wan.peerdns" label="'manually'" value="1" />
|
||||
<luci-input-radio ng-model="wan.peerdns" label="'manually'" value="1" />
|
||||
</div>
|
||||
</luci-config-line>
|
||||
<div ng-show="wan.peerdns.value == 1">
|
||||
<br/>
|
||||
<div class="col-md-12">
|
||||
<luci-input-ip-address ng-model="dns.primary" label="Domain Name Server (DNS) Address" />
|
||||
</div>
|
||||
<hr class="col-md-12"/>
|
||||
<div class="col-md-12">
|
||||
<luci-input-ip-address ng-model="dns.secondary" label="Secondary DNS Address (optional)" />
|
||||
</div>
|
||||
</div>
|
||||
</luci-config-lines>
|
||||
</luci-config-section>
|
||||
<luci-config-section>
|
||||
<luci-config-heading> </luci-config-heading> <!-- used as spacer -->
|
||||
<luci-config-detail-line title="{{'DNS address'|translate}}" ng-show="wan.peerdns.value == 1" ng-repeat="dns in wan.dns.value track by $index">
|
||||
<div class="col-md-12" >
|
||||
<luci-input-ip-address ng-model="wan.dns.value[$index]" />
|
||||
</div>
|
||||
</luci-config-detail-line>
|
||||
</luci-config-lines>
|
||||
</luci-config-section>
|
||||
<luci-config-section>
|
||||
<luci-config-heading>{{ 'DDNS (Dynamic DNS)' | translate }}</luci-config-heading>
|
||||
|
|
@ -49,7 +41,7 @@
|
|||
<ui-select-match placeholder="{{'Select provider'|translate}}">{{$select.selected}}</ui-select-match>
|
||||
<ui-select-choices repeat="provider in providers"
|
||||
refresh-delay="0">
|
||||
<div >{{provider}}</div>
|
||||
<div>{{provider}}</div>
|
||||
</ui-select-choices>
|
||||
</ui-select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,16 +3,15 @@ $juci.module("internet")
|
|||
|
||||
$scope.providers = ["dyndns.org"];
|
||||
|
||||
$scope.dns = {
|
||||
primary: "",
|
||||
secondary: ""
|
||||
};
|
||||
|
||||
$uci.sync("network")
|
||||
.done(function () {
|
||||
if ($uci.network && $uci.network.wan) {
|
||||
$log.info("wan", $uci.network.wan);
|
||||
$scope.wan = $uci.network.wan;
|
||||
$log.debug('$scope.wan.dns ', $scope.wan.dns);
|
||||
if ($scope.wan.dns && $scope.wan.dns.value.length == 0) {
|
||||
$scope.wan.dns.value = ["",""]; // by default there are 2 DNS addresses
|
||||
}
|
||||
} else {
|
||||
$log.error("wan network not available on box");
|
||||
// TODO show error message
|
||||
|
|
@ -32,27 +31,11 @@ $juci.module("internet")
|
|||
// $scope.$apply();
|
||||
// });
|
||||
|
||||
$scope.$watch("dns.primary", function(value){
|
||||
if(!$uci.network.wan) return;
|
||||
$log.debug("dns primary = " + value);
|
||||
$log.debug("$uci.network.wan.dns.value", $uci.network.wan.dns.value);
|
||||
if ($uci.network.wan.dns.value) {
|
||||
$uci.network.wan.dns.value = [value];
|
||||
} else {
|
||||
$uci.network.wan.dns.value = [value, ""];
|
||||
$scope.$watch("wan.dns.value", function(value){
|
||||
if (value) {
|
||||
$uci.network.wan.dns.value = value;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$watch("dns.secondary", function(value){
|
||||
if(!$uci.network.wan) return;
|
||||
$log.debug("dns secondary = " + value);
|
||||
$log.debug("$uci.network.wan.dns.value", $uci.network.wan.dns.value);
|
||||
if ($uci.network.wan.dns.value) {
|
||||
$uci.network.wan.dns.value[1] = [value];
|
||||
} else {
|
||||
$uci.network.wan.dns.value = ["", value];
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
|
||||
$scope.onApply = function () {
|
||||
$scope.busy = 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue