From 8bf1dd098fd609a2f54bfae6eb0ab9d890965652 Mon Sep 17 00:00:00 2001 From: Noel Wuyts Date: Wed, 13 May 2015 09:53:05 +0200 Subject: [PATCH] ddns ui --- .../plugins/internet/pages/internet.dns.html | 55 ++++++++++++++++++ .../plugins/internet/pages/internet.dns.js | 57 ++++++++++++++----- 2 files changed, 97 insertions(+), 15 deletions(-) diff --git a/luciexpress/htdocs/plugins/internet/pages/internet.dns.html b/luciexpress/htdocs/plugins/internet/pages/internet.dns.html index 5aa446e29..34b9f231d 100644 --- a/luciexpress/htdocs/plugins/internet/pages/internet.dns.html +++ b/luciexpress/htdocs/plugins/internet/pages/internet.dns.html @@ -34,6 +34,61 @@ +
+
+
+
+ +
+
+
+ + {{$select.selected}} + +
{{provider}}
+
+
+
+
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+ +
+
+
+
diff --git a/luciexpress/htdocs/plugins/internet/pages/internet.dns.js b/luciexpress/htdocs/plugins/internet/pages/internet.dns.js index 6246f4c40..2b550a5ff 100644 --- a/luciexpress/htdocs/plugins/internet/pages/internet.dns.js +++ b/luciexpress/htdocs/plugins/internet/pages/internet.dns.js @@ -1,18 +1,45 @@ $juci.module("internet") - .controller("InternetDNSPageCtrl", function($scope, $uci){ + .controller("InternetDNSPageCtrl", function($scope, $uci){ - $uci.sync("network").done( function(){ - console.log($uci.network.wan.peerdns); }); + $scope.providers = ["dyndns.org"]; - $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; - }); - } - }); + $uci.sync("network").done( function(){ + console.log($uci.network.wan.peerdns); }); + + $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 = {}; + + + $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(); + }); + }; + + });