From ed774e3b3043f6be6a3cd78154c12e27aebfeb15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schr=C3=B6der?= Date: Wed, 27 May 2015 12:39:46 +0200 Subject: [PATCH] Fixed many minor things on vox --- luciexpress/htdocs/js/uci.js | 11 ++++++++--- .../phone/pages/phone.number_blocking.html | 6 +++--- .../phone/pages/phone.ringing_schedule.html | 2 +- .../phone/pages/phone.ringing_schedule.js | 8 +------- .../plugins/settings/pages/settings.password.js | 3 +++ .../settings/pages/settings.upgrade.html | 10 +++++----- .../plugins/settings/pages/settings.upgrade.js | 17 +++++++++++++++-- .../htdocs/plugins/wifi/pages/wifi.general.js | 3 ++- 8 files changed, 38 insertions(+), 22 deletions(-) diff --git a/luciexpress/htdocs/js/uci.js b/luciexpress/htdocs/js/uci.js index 2edd0f119..8b4ba7b26 100644 --- a/luciexpress/htdocs/js/uci.js +++ b/luciexpress/htdocs/js/uci.js @@ -383,7 +383,7 @@ } function _insertSection(self, item){ - console.log("Adding local section: "+self[".name"]+"."+item[".name"]); + //console.log("Adding local section: "+self[".name"]+"."+item[".name"]); var section = new UCI.Section(self); section.$update(item); var type = "@"+item[".type"]; @@ -401,7 +401,7 @@ function _unlinkSection(self, section){ // NOTE: can not use filter() because we must edit the list in place // in order to play well with controls that reference the list! - console.log("Removing local section: "+self[".name"]+"."+section[".name"]+" of type "+section[".type"]); + console.log("Unlinking local section: "+self[".name"]+"."+section[".name"]+" of type "+section[".type"]); var all = self["@all"]; for(var i = 0; i < all.length; i++){ if(all[i][".name"] === section[".name"]) { @@ -446,6 +446,7 @@ // now delete any section that no longer exists in our local cache async.eachSeries(Object.keys(to_delete), function(x, next){ + if(!to_delete[x]) { next(); return; } var section = to_delete[x]; //console.log("Would delete section "+section[".name"]+" of type "+section[".type"]); _unlinkSection(self, section); @@ -694,7 +695,10 @@ var commit_list = []; Object.keys(self).map(function(k){ if(self[k].constructor == UCI.Config){ - if(self[k][".need_commit"]) commit_list.push(self[k][".name"]); + if(self[k][".need_commit"]) { + commit_list.push(self[k][".name"]); + self[k][".need_commit"] = false; + } } }); async.each(commit_list, function(config, next){ @@ -744,6 +748,7 @@ next("could not commit config: "+err); }); }, function(err){ + console.log("Commit done!"); // this is to always make sure that we do this outside of this code flow setTimeout(function(){ if(err) deferred.reject(err); diff --git a/luciexpress/htdocs/plugins/phone/pages/phone.number_blocking.html b/luciexpress/htdocs/plugins/phone/pages/phone.number_blocking.html index 467f953d5..3ffb49aaf 100644 --- a/luciexpress/htdocs/plugins/phone/pages/phone.number_blocking.html +++ b/luciexpress/htdocs/plugins/phone/pages/phone.number_blocking.html @@ -13,9 +13,9 @@
-
+
- +
@@ -46,7 +46,7 @@
- +
diff --git a/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.html b/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.html index 0a1fe3c85..412e997ca 100644 --- a/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.html +++ b/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.html @@ -9,7 +9,7 @@
- +
diff --git a/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.js b/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.js index 06b41db46..3c3c6d95c 100644 --- a/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.js +++ b/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.js @@ -24,14 +24,8 @@ $juci.module("phone") .controller("PhoneRingingScheduleCtrl", function($scope, $uci){ $uci.sync(["voice_client"]).done(function(){ // TODO add config for phone - //if($uci.voice_client && $uci.voice_client.settings) $scope.settings = $uci.voice_client.settings; + if($uci.voice_client && $uci.voice_client.settings) $scope.settings = $uci.voice_client.settings; $scope.schedules = $uci.voice_client["@schedule"]; - $scope.allSipAccounts = $scope.phone_numbers.map(function(x){ - return { - label: x.name.value, - value: x[".name"] - } - }); }); $scope.onAcceptSchedule = function(){ diff --git a/luciexpress/htdocs/plugins/settings/pages/settings.password.js b/luciexpress/htdocs/plugins/settings/pages/settings.password.js index f5984a508..efc5571c1 100644 --- a/luciexpress/htdocs/plugins/settings/pages/settings.password.js +++ b/luciexpress/htdocs/plugins/settings/pages/settings.password.js @@ -38,6 +38,9 @@ JUCI.app $rpc.luci2.system.password_set({user: $rpc.$session.data.username, password: $scope.modal.password, curpass: $scope.modal.old_password}).done(function(data){ $scope.showModal = 0; $scope.$apply(); + $rpc.$logout().done(function(){ + window.location.reload(); + }); }).fail(function(){ }); diff --git a/luciexpress/htdocs/plugins/settings/pages/settings.upgrade.html b/luciexpress/htdocs/plugins/settings/pages/settings.upgrade.html index 9971de662..6d5743eb9 100644 --- a/luciexpress/htdocs/plugins/settings/pages/settings.upgrade.html +++ b/luciexpress/htdocs/plugins/settings/pages/settings.upgrade.html @@ -31,8 +31,8 @@

{{'settings.upgrade.online.info'|translate}}

- - + + @@ -40,11 +40,11 @@

{{'USB Firmware Upgrade'|translate}}

{{'settings.upgrade.usb.info'|translate}}

- + - - + + diff --git a/luciexpress/htdocs/plugins/settings/pages/settings.upgrade.js b/luciexpress/htdocs/plugins/settings/pages/settings.upgrade.js index 98770f72e..a42569e51 100644 --- a/luciexpress/htdocs/plugins/settings/pages/settings.upgrade.js +++ b/luciexpress/htdocs/plugins/settings/pages/settings.upgrade.js @@ -113,6 +113,7 @@ JUCI.app $scope.sessionID = $rpc.$sid(); $scope.uploadFilename = "/tmp/firmware.bin"; $scope.usbFileName = "()"; + $scope.usbUpgradeAvailable = false; $scope.config = $config; @@ -153,8 +154,14 @@ JUCI.app });*/ $scope.onCheckOnline = function(){ + $scope.onlineUpgradeAvailable = false; $rpc.luci2.system.upgrade_check({type: "online"}).done(function(response){ - if(response.stdout) $scope.onlineUpgrade = response.stdout.replace("\n", ""); + if(response.stdout) { + $scope.onlineUpgrade = response.stdout.replace("\n", ""); + $scope.onlineUpgradeAvailable = true; + } else { + $scope.onlineUpgrade = gettext("No upgrade has been found!"); + } if(response.stderr) $scope.$emit("error", "Online upgrade check failed: "+response.stderr); $scope.$apply(); }); @@ -164,8 +171,14 @@ JUCI.app } $scope.onCheckUSB = function(){ + $scope.usbUpgradeAvailable = false; $rpc.luci2.system.upgrade_check({type: "usb"}).done(function(response){ - if(response.stdout) $scope.usbUpgrade = response.stdout.replace("\n", ""); + if(response.stdout) { + $scope.usbUpgrade = response.stdout.replace("\n", ""); + $scope.usbUpgradeAvailable = true; + } else { + $scope.usbUpgrade = gettext("No upgrade has been found!"); + } if(response.stderr) $scope.$emit("error", "USB upgrade check failed: "+response.stderr); $scope.$apply(); }); diff --git a/luciexpress/htdocs/plugins/wifi/pages/wifi.general.js b/luciexpress/htdocs/plugins/wifi/pages/wifi.general.js index d166a09ac..9c7ff6906 100644 --- a/luciexpress/htdocs/plugins/wifi/pages/wifi.general.js +++ b/luciexpress/htdocs/plugins/wifi/pages/wifi.general.js @@ -11,7 +11,8 @@ JUCI.app ".name": "status", disabled: false, button_enabled: false - }).done(function(){ + }).done(function(section){ + $scope.status = section; $uci.save().done(function(){ next(); }).fail(function(){
Day Time