Fixed wan interface name

This commit is contained in:
Martin Schröder 2015-05-27 11:30:41 +02:00 committed by Martin Schröder
parent c49cf96c1c
commit ba1d6457b4
8 changed files with 33 additions and 18 deletions

View file

@ -1,4 +1,4 @@
config 'juci-settings' 'settings'
config 'settings' 'settings'
option theme 'vodafone'
option lang 'en'
list themes 'vodaphone'

View file

@ -8,13 +8,24 @@
var deferred = $.Deferred();
var self = this;
console.log("Init CONFIG");
UCI.sync("juci").done(function(){
self["wan_interface"] = "wan";
self["voice_interface"] = "wan";
self["iptv_interface"] = "wan";
UCI.sync(["juci", "boardpanel"]).done(function(){
if(UCI.juci && UCI.juci.settings){
console.log("Using settings from config/juci on router");
Object.keys(UCI.juci.settings).map(function(k){
var i = UCI.juci.settings[k];
if(i instanceof Object && "value" in i) self[k] = i.value;
if(i.value !== undefined) self[k] = i.value;
});
if(UCI.boardpanel && UCI.boardpanel.settings){
var net = UCI.boardpanel.network;
if(net.internet.value) self["wan_interface"] = net.internet.value;
if(net.voice.value) self["voice_interface"] = net.voice.value;
if(net.iptv.value) self["iptv_interface"] = net.iptv.value;
}
deferred.resolve();
} else {
loadJSON();

View file

@ -69,7 +69,7 @@ $juci.module("core")
});;
},
function(next){
var ifname = "wan"; // TODO: replace this with dynamic string after merge
var ifname = $config.wan_interface; // TODO: replace this with dynamic string after merge
$rpc.network.interface.dump().done(function(interfaces){
var conn = "";
if(interfaces && interfaces.interface){

View file

@ -9,7 +9,7 @@ JUCI.app
controller: "luciFooter"
};
})
.controller("luciFooter", function($scope, $rpc, $languages, gettextCatalog, gettext, $tr){
.controller("luciFooter", function($scope, $rpc, $languages, gettextCatalog, gettext, $tr, $config){
// TODO: move this into a higher level controller maybe?
$scope.languages = $languages.getLanguages();
$scope.isActiveLanguage = function(lang){
@ -27,7 +27,7 @@ JUCI.app
$rpc.network.interface.dump().done(function(result){
if(result && result.interface) {
result.interface.map(function(i){
if(i.interface == "wan" && i["ipv4-address"] && i["ipv4-address"].length){
if(i.interface == $config.wan_interface && i["ipv4-address"] && i["ipv4-address"].length){
$scope.wanip = i["ipv4-address"][0].address;
}
});

View file

@ -1,10 +1,8 @@
JUCI.app
.controller("InternetDNSPageCtrl", function ($scope, $uci, $log) {
$scope.providers = ["dyndns.org"];
$log.info("uci", $uci);
.controller("InternetDNSPageCtrl", function ($scope, $uci, $log, $config) {
$uci.sync(["network","ddns"]).done(function () {
if ($uci.network && $uci.network.wan) {
var wan = $uci.network.wan;
if ($uci.network) {
var wan = $uci.network[$config.wan_interface];
while(wan.dns.value.length < 2) wan.dns.value.push("");
$scope.dnsServers = wan.dns.value.map(function(x){ return { value: x }; });
$scope.onDNSBlur = function(){

View file

@ -22,7 +22,7 @@ $juci.module("internet")
},
function(next){
$rpc.network.interface.status({
"interface": "wan"
"interface": $config.wan_interface
}).done(function(wan){
if("ipv4-address" in wan)
$scope.wan.ip = wan["ipv4-address"][0].address;

View file

@ -1,11 +1,14 @@
$juci.module("internet")
.controller("InternetFirewallPageCtrl", function($scope, $uci){
.controller("InternetFirewallPageCtrl", function($scope, $uci, $config){
$scope.firewallSwitchState = 0;
$uci.sync("firewall").done(function(){
$scope.firewall = $uci.firewall;
$scope.firewallSwitchState = $uci.firewall["@rule"].filter(function(rule){ return rule.enabled.value == true; }).length > 0;
$scope.firewallSwitchState = $uci.firewall["@zone"].filter(function(zone){
return zone.name.value == "wan" && zone.input.value == "ACCEPT" && zone.forward.value == "ACCEPT";
}).length > 0;
$scope.$apply();
});
$scope.onFirewallToggle = function(){
if($scope.firewallSwitchState) {
$uci.firewall["@zone"].map(function(zone){
@ -23,4 +26,7 @@ $juci.module("internet")
});
}
}
// just to update the rules based on switch value
$scope.onFirewallToggle();
});

View file

@ -1,7 +1,7 @@
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
JUCI.app
.controller("StatsOverviewCtrl", function ($scope, $uci, $rpc, gettext) {
.controller("StatsOverviewCtrl", function ($scope, $uci, $rpc, gettext, $config) {
//$scope.expanded = false;
$scope.sections = [{}, {}, {}];
@ -19,9 +19,9 @@ JUCI.app
function(next){
var sections = [];
[
{ name: gettext("Internet"), value: $uci.boardpanel.network.internet.value||"wan" },
{ name: gettext("Voice"), value: $uci.boardpanel.network.voice.value },
{ name: gettext("IPTV"), value: $uci.boardpanel.network.iptv.value }
{ name: gettext("Internet"), value: $config.wan_interface },
{ name: gettext("Voice"), value: $config.voice_interface },
{ name: gettext("IPTV"), value: $config.iptv_interface }
]
.filter(function(x){ return x.value != "" })
.forEach(function(x, c){