From 8bbd5ee508d57943a3253b64be40cba4bbdbebda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schr=C3=B6der?= Date: Wed, 6 May 2015 13:28:21 +0200 Subject: [PATCH] .. --- .../htdocs/plugins/core/pages/overview.html | 4 +- .../htdocs/plugins/core/pages/overview.js | 106 ++++++++---------- .../plugins/status/pages/status.restart.js | 8 +- .../plugins/status/pages/status.status.dsl.js | 2 +- .../htdocs/plugins/wifi/pages/wifi.general.js | 2 - .../htdocs/plugins/wifi/pages/wifi.wps.html | 40 ------- .../htdocs/plugins/wifi/pages/wifi.wps.js | 62 +--------- .../widgets/luci.layout.single_column.html | 8 +- 8 files changed, 59 insertions(+), 173 deletions(-) diff --git a/luciexpress/htdocs/plugins/core/pages/overview.html b/luciexpress/htdocs/plugins/core/pages/overview.html index 2ce0e3daf..72948b83c 100644 --- a/luciexpress/htdocs/plugins/core/pages/overview.html +++ b/luciexpress/htdocs/plugins/core/pages/overview.html @@ -21,7 +21,7 @@ Router
{{wireless.clients.length}}
{{network.clients.length}}
-
{{sipAccounts.length||0}}
+
{{sipAccounts.length}}
@@ -90,7 +90,7 @@
U{{$index}}
-
{{sip.user.value}}
+
{{sip.username}}
diff --git a/luciexpress/htdocs/plugins/core/pages/overview.js b/luciexpress/htdocs/plugins/core/pages/overview.js index 0777683c4..e2c1b45d0 100644 --- a/luciexpress/htdocs/plugins/core/pages/overview.js +++ b/luciexpress/htdocs/plugins/core/pages/overview.js @@ -13,68 +13,52 @@ $juci.module("core") }; function refresh() { - //var sections = result.values; - //var cfgs = Object.keys(sections).filter(function(x) { return x.indexOf("cfg") == 0; }); - //$scope.wireless.wps = cfgs.filter(function(x) { return cfgs["wps_pbc"] == 1; }).length != 0; - - $scope.defaultHostName = $tr(gettext("Unknown")); - $scope.sipAccounts = []; - $scope.wifiSchedStatus = gettext("off"); - $scope.wifiWPSStatus = gettext("off"); - async.series([ - function(next){ - $uci.sync(["wireless", "easybox", "voice_client"]).done(function(){ - $scope.wifi = $uci.wireless; - $scope.easybox = $uci.easybox; - $scope.voice_client = $uci.voice_client; - if($uci.wireless && $uci.wireless.status) - $scope.wifiSchedStatus = (($uci.wireless.status.schedule.value)?gettext("on"):gettext("off")); - if($uci.wireless && $uci.wireless.wps) - $scope.wifiWPSStatus = (($scope.easybox.settings.wpsbutton.value)?gettext("on"):gettext("off")); - if($uci.voice_client && $uci.voice_client["@sip_service_provider"]){ - $scope.sipAccounts = $uci.voice_client["@sip_service_provider"]; - } - }).always(function(){ next(); }); - }, - function(next){ - $rpc.router.clients().done(function(clients){ - //alert(JSON.stringify(Object.keys(clients).map(function(x) { return clients[x]; }))); - var all = Object.keys(clients).map(function(x) { return clients[x]; }); - $scope.wireless.clients = all.filter(function(x){ - return x.connected && x.wireless == true; - }); - $scope.network.clients = all.filter(function(x){ - return x.connected && x.wireless == false; - }); - next(); - }).fail(function(){ - next(); - });; - }, - function(next){ - /*$rpc.asterisk.status().done(function(data){ - if(data && data.sip){ - var accounts = []; - Object.keys(data.sip).map(function(k){ - if(data.sip[k].ip) accounts.push(data.sip[k]); + $uci.sync(["wireless", "easybox"]).done(function(){ + //var sections = result.values; + //var cfgs = Object.keys(sections).filter(function(x) { return x.indexOf("cfg") == 0; }); + //$scope.wireless.wps = cfgs.filter(function(x) { return cfgs["wps_pbc"] == 1; }).length != 0; + $scope.wifi = $uci.wireless; + $scope.easybox = $uci.easybox; + $scope.wifiSchedStatus = (($scope.wifi.status.schedule.value)?gettext("on"):gettext("off")); + $scope.wifiWPSStatus = (($scope.easybox.settings.wpsbutton.value)?gettext("on"):gettext("off")); + $scope.defaultHostName = $tr(gettext("Unknown")); + async.series([ + function(next){ + $rpc.router.clients().done(function(clients){ + //alert(JSON.stringify(Object.keys(clients).map(function(x) { return clients[x]; }))); + var all = Object.keys(clients).map(function(x) { return clients[x]; }); + $scope.wireless.clients = all.filter(function(x){ + return x.connected && x.wireless == true; }); - $scope.sipAccounts = accounts; - } - }).always(function(){ next(); }); */ - // just fall through - next(); - }, - function(next){ - $rpc.router.dslstats().done(function(dslstats){ - var stats = dslstats.dslstats; - if(stats && stats.bearers && stats.bearers.length > 0){ - $scope.dsl.max_rate_up = Math.round(stats.bearers[0].max_rate_up / 1000); - $scope.dsl.max_rate_down = Math.round(stats.bearers[0].max_rate_down / 1000); - } - }).always(function(){ next(); }); - } - ], function(){ - $scope.$apply(); + $scope.network.clients = all.filter(function(x){ + return x.connected && x.wireless == false; + }); + next(); + }); + }, + function(next){ + $rpc.asterisk.status().done(function(data){ + if(data && data.sip){ + var accounts = []; + Object.keys(data.sip).map(function(k){ + if(data.sip[k].ip) accounts.push(data.sip[k]); + }); + $scope.sipAccounts = accounts; + } + }).always(function(){ next(); }); + }, + function(next){ + $rpc.router.dslstats().done(function(dslstats){ + var stats = dslstats.dslstats; + if(stats && stats.bearers && stats.bearers.length > 0){ + $scope.dsl.max_rate_up = Math.round(stats.bearers[0].max_rate_up / 1000); + $scope.dsl.max_rate_down = Math.round(stats.bearers[0].max_rate_down / 1000); + } + }).always(function(){ next(); }); + } + ], function(){ + $scope.$apply(); + }); }); } refresh(); //setInterval(refresh, 5000); diff --git a/luciexpress/htdocs/plugins/status/pages/status.restart.js b/luciexpress/htdocs/plugins/status/pages/status.restart.js index ce4126aa4..1ff15c542 100644 --- a/luciexpress/htdocs/plugins/status/pages/status.restart.js +++ b/luciexpress/htdocs/plugins/status/pages/status.restart.js @@ -1,8 +1,4 @@ $juci.module("status") -.controller("StatusRestartPageCtrl", function($scope, $rpc){ - $scope.onRestart = function(){ - $rpc.luci2.system.reboot().done(function(){ - console.log("Restarting the system..."); - }); - } +.controller("StatusRestartPageCtrl", function($scope){ + }); diff --git a/luciexpress/htdocs/plugins/status/pages/status.status.dsl.js b/luciexpress/htdocs/plugins/status/pages/status.status.dsl.js index 42e66b318..4be7b9d2c 100644 --- a/luciexpress/htdocs/plugins/status/pages/status.status.dsl.js +++ b/luciexpress/htdocs/plugins/status/pages/status.status.dsl.js @@ -1,5 +1,5 @@ $juci.module("status") -.controller("StatsCtrl", function($scope, $rpc, $session, gettext, $tr){ +.controller("StatsCtrl", function($scope, $rpc, $session, gettextCatalog){ $scope.dslstats = {}; $scope.dslConnectionInfo = { diff --git a/luciexpress/htdocs/plugins/wifi/pages/wifi.general.js b/luciexpress/htdocs/plugins/wifi/pages/wifi.general.js index 782224c90..c9e1ab0c8 100644 --- a/luciexpress/htdocs/plugins/wifi/pages/wifi.general.js +++ b/luciexpress/htdocs/plugins/wifi/pages/wifi.general.js @@ -27,8 +27,6 @@ $juci.module("wifi") window.uci = $uci; $scope.interfaces = $uci.wireless['@wifi-iface']; $scope.status = $uci.wireless.status; - if($uci.easybox) - $scope.easybox = $uci.easybox.settings; $scope.$apply(); next(); diff --git a/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.html b/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.html index d25b37d17..6b0aed006 100644 --- a/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.html +++ b/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.html @@ -8,46 +8,6 @@ - - - - - - -

WPS PBC

-

wifi.wps.pbc.info

- - - - - - - - -

WPS with own PIN

-

wifi.wps.pin.info

- - - - - - - - - - - -

WPS with foreign PIN

-

wifi.wps.otherpin.info

- - - - - - - - -
diff --git a/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.js b/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.js index ff99692da..5a3f727f7 100644 --- a/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.js +++ b/luciexpress/htdocs/plugins/wifi/pages/wifi.wps.js @@ -1,68 +1,10 @@ $juci.module("wifi") .controller("WifiWPSPageCtrl", function($scope, $uci){ - $scope.data = { - userPIN: "" - } - $uci.sync(["easybox", "wireless"]).done(function(){ + $uci.sync(["easybox"]).done(function(){ $scope.easybox = $uci.easybox; - $scope.wireless = $uci.wireless; $scope.$apply(); }).fail(function(err){ console.log("failed to sync config: "+err); }); - $rpc.wps.showpin().done(function(data){ - $scope.generatedPIN = data.pin; - }); - function pair(){ - $scope.showProgress = 1; - $scope.pairState = 'progress'; - $scope.timeRemaining = 60; - $uci.save().done(function(){ - var interval = setInterval(function(){ - $scope.timeRemaining --; - if($scope.timeRemaining == 0){ - clearInterval(interval); - } - }, 1000); - $rpc.wps.pbc().done(function(){ - clearInterval(interval); - $scope.pairState = 'success'; - $scope.$apply(); - setTimeout(function(){ - $scope.showProgress = 0; - $scope.$apply(); - }, 2000); - }).fail(function(){ - clearInterval(interval); - $scope.pairState = 'fail'; - $scope.$apply(); - setTimeout(function(){ - $scope.showProgress = 0; - $scope.$apply(); - }, 2000); - }).always(function(){ - $scope.showProgress = 0; - }); - }); - } - $scope.save = function(){ - $uci.save(); - } - $scope.onPairPBC = function(){ - - pair(); - } - $scope.onPairUserPIN = function(){ - $rpc.wps.stapin({ pin: $scope.data.userPIN }).done(function(data){ - pair(); - }); - } - $scope.onGeneratePIN = function(){ - $rpc.wps.genpin().done(function(data){ - $rpc.wps.setpin({pin: data.pin}).done(function(){ - $scope.generatedPIN = data.pin; - $scope.$apply(); - }); - }); - } + }); diff --git a/luciexpress/htdocs/themes/vodafone/widgets/luci.layout.single_column.html b/luciexpress/htdocs/themes/vodafone/widgets/luci.layout.single_column.html index 107d8cfb4..97def3f0a 100644 --- a/luciexpress/htdocs/themes/vodafone/widgets/luci.layout.single_column.html +++ b/luciexpress/htdocs/themes/vodafone/widgets/luci.layout.single_column.html @@ -20,5 +20,11 @@
- +
+
+
+ +
+
+