mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
dns config
This commit is contained in:
parent
657005830b
commit
55048d20ed
7 changed files with 136 additions and 72 deletions
|
|
@ -260,18 +260,26 @@
|
|||
"macfilter": { dvalue: false, type: Boolean },
|
||||
"maclist": { dvalue: [], type: Array, match_each: /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/ }
|
||||
}
|
||||
},
|
||||
},
|
||||
"network": {
|
||||
"ineterface": {
|
||||
"is_lan": { dvalue: 1, type: Number },
|
||||
"ifname": { dvalue: "", type: String },
|
||||
"proto": { dvalue: "dhcp", type: String },
|
||||
"ipaddr": { dvalue: "", type: String },
|
||||
"netmask": { dvalue: "", type: String },
|
||||
"peerdns": { dvalue: false, type: String },
|
||||
"dns": { dvalue: [], type: Array }
|
||||
}
|
||||
},
|
||||
"interface": {
|
||||
"is_lan": {dvalue: 1, type: Number},
|
||||
"ifname": {dvalue: "", type: String},
|
||||
"proto": {dvalue: "dhcp", type: String},
|
||||
"ipaddr": {dvalue: "", type: String},
|
||||
"netmask": {dvalue: "", type: String},
|
||||
"peerdns": {dvalue: false, type: String},
|
||||
"dns": {dvalue: [], type: Array}
|
||||
}
|
||||
},
|
||||
//"ddns": {
|
||||
// "interface": { dvalue: "", type: String },
|
||||
// "enabled": { dvalue: 0, type: Number },
|
||||
// "service_name": { dvalue: "", type: String },
|
||||
// "domain": { dvalue: "", type: String },
|
||||
// "username": { dvalue: "", type: String },
|
||||
// "password": { dvalue: "", type: String }
|
||||
//},
|
||||
"unknown": {
|
||||
"host": {
|
||||
"hostname": { dvalue: "", type: String, required: true},
|
||||
|
|
@ -603,7 +611,7 @@
|
|||
var self = this;
|
||||
$rpc.uci.configs().done(function(response){
|
||||
var cfigs = response.configs;
|
||||
if(!cfigs) { next("could not retreive list of configs!"); return; }
|
||||
if(!cfigs) { next("could not retrieve list of configs!"); return; }
|
||||
cfigs.map(function(k){
|
||||
if(!(k in self)){
|
||||
//console.log("Adding new config "+k);
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
<div class="form-group" class="col-md-6" ng-class="{ 'field-error': model.error }" data-toggle="tooltip" data-placement="top" title="{{model.error}}">
|
||||
<div class="form-group" class="col-md-6" ng-class="{ 'field-error': ngModel.error }" data-toggle="tooltip" data-placement="top" title="{{ngModel.error}}">
|
||||
<div class="col-md-5">
|
||||
<label class="{{labelClass}}">{{label|translate}}</label>
|
||||
</div>
|
||||
<div class="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.field_1" placeholder="..." maxlength="3" />
|
||||
<input type="text" class="form-control input-lg no-padding text-center" ng-model="data[0]" placeholder="..." maxlength="3" />
|
||||
</div>
|
||||
<div class="col-xs-1 no-side-padding text-center input-lg">
|
||||
<strong>.</strong>
|
||||
</div>
|
||||
<div class="col-sm-2 no-side-padding">
|
||||
<input type="text" class="form-control input-lg no-padding text-center" ng-model="data.field_2" placeholder="..." maxlength="3" />
|
||||
<input type="text" class="form-control input-lg no-padding text-center" ng-model="data[1]" placeholder="..." maxlength="3" />
|
||||
</div>
|
||||
<div class="col-xs-1 no-side-padding text-center input-lg">
|
||||
<strong>.</strong>
|
||||
</div>
|
||||
<div class="col-sm-2 no-side-padding">
|
||||
<input type="text" class="form-control input-lg no-padding text-center" ng-model="data.field_3" placeholder="..." maxlength="3" />
|
||||
<input type="text" class="form-control input-lg no-padding text-center" ng-model="data[2]" placeholder="..." maxlength="3" />
|
||||
</div>
|
||||
<div class="col-xs-1 no-side-padding text-center input-lg">
|
||||
<strong>.</strong>
|
||||
</div>
|
||||
<div class="col-sm-2 no-side-padding">
|
||||
<input type="text" class="form-control input-lg no-padding text-center" ng-model="data.field_4" placeholder="..." maxlength="3" />
|
||||
<input type="text" class="form-control input-lg no-padding text-center" ng-model="data[3]" placeholder="..." maxlength="3" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -8,17 +8,33 @@ $juci.module("core")
|
|||
scope: {
|
||||
id: "@",
|
||||
label: "@",
|
||||
model: "=",
|
||||
ngModel: "=",
|
||||
labelClass: "@"
|
||||
}
|
||||
//controller: "luciInputIpAddressController"
|
||||
},
|
||||
require: "ngModel",
|
||||
controller: "luciInputIpAddressController"
|
||||
};
|
||||
})
|
||||
.controller("luciInputIpAddressController", function($scope, $log) {
|
||||
//$scope.data = "";
|
||||
//$scope.$watch("data", function(){
|
||||
// $log.debug('model', $scope.model);
|
||||
// $log.debug('data', $scope.data);
|
||||
// if ($scope.model) $scope.model.value = $scope.data;
|
||||
//}, true);
|
||||
$scope.data = [];
|
||||
$scope.ipAddress = "";
|
||||
|
||||
$scope.$watch("ngModel", function(value){
|
||||
if(value && value.split){
|
||||
var parts = value.split(".");
|
||||
$scope.data[0] = parts[0]||"";
|
||||
$scope.data[1] = parts[1]||"";
|
||||
$scope.data[2] = parts[2]||"";
|
||||
$scope.data[3] = parts[3]||"";
|
||||
} else {
|
||||
$scope.ipAddress = value;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$watch("data", function(){
|
||||
$log.debug('data', $scope.data);
|
||||
var ipAddress = $scope.data.join('.');
|
||||
$log.debug('ip address', ipAddress);
|
||||
if ($scope.ngModel) $scope.ngModel = ipAddress;
|
||||
}, true);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div class="radio radio-info">
|
||||
<input id="{{id}}" name="{{name}}" type="radio" ng-model="model" ng-value="value"/>
|
||||
<input id="{{id}}" type="radio" ng-model="ngModel.value" value="{{value}}"/>
|
||||
<label for="{{id}}" class="{{labelClass}}" translate>{{label}}</label>
|
||||
</div>
|
||||
|
|
|
|||
17
luciexpress/htdocs/plugins/core/widgets/luci.input.radio.js
Normal file
17
luciexpress/htdocs/plugins/core/widgets/luci.input.radio.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
$juci.module("core")
|
||||
.directive("luciInputRadio", function () {
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
return {
|
||||
templateUrl: plugin_root + "/widgets/luci.input.radio.html",
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
scope: {
|
||||
id: "=",
|
||||
label: "=",
|
||||
labelClass: "=",
|
||||
value: "=",
|
||||
ngModel: "=",
|
||||
inline: "="
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
@ -6,20 +6,20 @@
|
|||
<luci-config-lines>
|
||||
<luci-config-line title="{{'DNS configuration'|translate}}">
|
||||
<div class="col-md-6">
|
||||
<luci-input-radio id="auto" name="auto" value="0" model="$parent.$parent.manualDns" label="'automatically'" label-class="detail-strong-input" inline="true"/>
|
||||
<luci-input-radio id="autoDns" value="0" ng-model="wan.peerdns" label="'automatically'" label-class="detail-strong-input" inline="true" />
|
||||
</div>
|
||||
<div class="col-md-5 col-lg-offset-1">
|
||||
<luci-input-radio id="manual" name="manual" value="1" model="$parent.$parent.manualDns" label="'manually'" label-class="detail-strong-input" inline="true"/>
|
||||
<luci-input-radio id="manualDns" value="1" ng-model="wan.peerdns" label="'manually'" label-class="detail-strong-input" inline="true"/>
|
||||
</div>
|
||||
</luci-config-line>
|
||||
<div ng-show="manualDns">
|
||||
<div ng-show="wan.peerdns.value == 1">
|
||||
<br/>
|
||||
<div class="col-md-12">
|
||||
<luci-input-ip-address id="firstDNSAddress" label="Domain Name Server (DNS) Address" label-class="detail-strong-input" />
|
||||
<luci-input-ip-address id="firstDNSAddress" ng-model="wan.dns.value[0]" label="Domain Name Server (DNS) Address" label-class="detail-strong-input" />
|
||||
</div>
|
||||
<hr class="col-md-12"/>
|
||||
<div class="col-md-12">
|
||||
<luci-input-ip-address id="secondDNSAddress" label="Secondary DNS Address (optional)" label-class="detail-strong-input" />
|
||||
<luci-input-ip-address id="secondDNSAddress" ng-model="wan.dns.value[1]" label="Secondary DNS Address (optional)" label-class="detail-strong-input" />
|
||||
</div>
|
||||
</div>
|
||||
</luci-config-lines>
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-sm-8 col-sm-offset-4 no-side-padding">
|
||||
<input type="text" class="form-control" ng-model="data.field_4" placeholder="{{'Add domain name'|translate}}" maxlength="3" />
|
||||
<input type="text" class="form-control" ng-model="domain" placeholder="{{'Add domain name'|translate}}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-sm-8 col-sm-offset-4 no-side-padding">
|
||||
<input type="text" class="form-control" ng-model="data.field_4" placeholder="{{'Add account'|translate}}" maxlength="3" />
|
||||
<input type="text" class="form-control" ng-model="account" placeholder="{{'Add account'|translate}}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -84,12 +84,14 @@
|
|||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-sm-8 col-sm-offset-4 no-side-padding">
|
||||
<input type="text" class="form-control" ng-model="data.field_4" placeholder="{{'Add password'|translate}}" maxlength="3" />
|
||||
<input type="password" class="form-control" ng-model="password" placeholder="{{'Add password'|translate}}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</luci-config-lines>
|
||||
</luci-config-section>
|
||||
<hr class="col-md-12"/>
|
||||
<luci-config-apply></luci-config-apply>
|
||||
</div>
|
||||
</luci-layout-with-sidebar>
|
||||
|
|
@ -1,45 +1,66 @@
|
|||
$juci.module("internet")
|
||||
.controller("InternetDNSPageCtrl", function($scope, $uci){
|
||||
.controller("InternetDNSPageCtrl", function ($scope, $uci) {
|
||||
|
||||
$scope.providers = ["dyndns.org"];
|
||||
|
||||
$uci.sync("network").done( function(){
|
||||
console.log($uci.network.wan.peerdns); });
|
||||
$uci.sync("network")
|
||||
.done(function () {
|
||||
console.log("network", $uci.network);
|
||||
if ($uci.network && $uci.network.wan) {
|
||||
$scope.wan = $uci.network.wan;
|
||||
} else {
|
||||
console.error("wan network not available on box");
|
||||
// TODO show error message
|
||||
}
|
||||
}).fail(function () {
|
||||
console.error("Could not sync network settings!");
|
||||
})
|
||||
.always(function () {
|
||||
$scope.$apply();
|
||||
});
|
||||
|
||||
$scope.onApply = function(){
|
||||
$scope.busy = 1;
|
||||
$uci.save().done(function(){
|
||||
console.log("Settings saved!");
|
||||
}).fail(function(){
|
||||
console.error("Could not save internet settings!");
|
||||
}).always(function(){
|
||||
$scope.$apply();
|
||||
$scope.busy = 0;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.onChangeProvider = function(item){
|
||||
$scope.selectedConfig = item;
|
||||
$scope.error = "";
|
||||
$scope.loading = 1;
|
||||
$scope.subsections = {};
|
||||
//$uci.sync("ddns")
|
||||
// .done( function(){
|
||||
// console.log("ddns", $uci.ddns);
|
||||
// })
|
||||
// .always( function() {
|
||||
// $scope.$apply();
|
||||
// });
|
||||
|
||||
|
||||
$rpc.uci.state({
|
||||
config: item.id
|
||||
}).done(function(data){
|
||||
$scope.subsections = data.values;
|
||||
Object.keys($scope.subsections).map(function(k){
|
||||
$scope.subsections[k] = filterHiddenValues($scope.subsections[k]);
|
||||
});
|
||||
$scope.loading = 0;
|
||||
$scope.$apply();
|
||||
}).fail(function(err){
|
||||
console.error("Could not retrieve data!", err);
|
||||
$scope.error("Could not retrieve data!");
|
||||
$scope.loading = 0;
|
||||
$scope.$apply();
|
||||
});
|
||||
};
|
||||
$scope.onApply = function () {
|
||||
$scope.busy = 1;
|
||||
$uci.save().done(function () {
|
||||
console.log("Settings saved!");
|
||||
}).fail(function () {
|
||||
console.error("Could not save internet settings!");
|
||||
}).always(function () {
|
||||
$scope.$apply();
|
||||
$scope.busy = 0;
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
$scope.onChangeProvider = function (item) {
|
||||
$scope.selectedConfig = item;
|
||||
$scope.error = "";
|
||||
$scope.loading = 1;
|
||||
|
||||
|
||||
//$rpc.uci.state({
|
||||
// config: item.id
|
||||
//}).done(function(data){
|
||||
// $scope.subsections = data.values;
|
||||
// Object.keys($scope.subsections).map(function(k){
|
||||
// $scope.subsections[k] = filterHiddenValues($scope.subsections[k]);
|
||||
// });
|
||||
// $scope.loading = 0;
|
||||
// $scope.$apply();
|
||||
//}).fail(function(err){
|
||||
// console.error("Could not retrieve data!", err);
|
||||
// $scope.error("Could not retrieve data!");
|
||||
// $scope.loading = 0;
|
||||
// $scope.$apply();
|
||||
//});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue