Fixed many minor things on vox

This commit is contained in:
Martin Schröder 2015-05-27 12:39:46 +02:00 committed by Martin Schröder
parent b67619b937
commit ed774e3b30
8 changed files with 38 additions and 22 deletions

View file

@ -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);

View file

@ -13,9 +13,9 @@
<luci-config-lines ng-show="filter.block_outgoing.value">
<hr/>
<luci-config-line title="Do not allow connections to these numbers">
<div class="row" ng-repeat="rule in outgoingRules">
<div class="row" ng-repeat="rule in outgoingRules track by rule['.name']">
<div class="form-group form-inline">
<input type="text" class="form-control" ng-model="rule.extension.value" ng-blur="onSave()"/>
<input type="text" class="form-control" ng-model="rule.extension.value" ng-blur="onSave()" placeholder="{{'Phone Extension'|translate}}"/>
<button class="btn btn-default" ng-click="onDeleteOutgoingRule(rule)"><i class="fa fa-trash"></i></button>
</div>
</div>
@ -46,7 +46,7 @@
<luci-config-line title="Do not allow connections from these numbers">
<div class="row" ng-repeat="rule in incomingRules">
<div class="form-group form-inline">
<input type="text" class="form-control" ng-model="rule.extension.value" ng-blur="onSave()"/>
<input type="text" class="form-control" ng-model="rule.extension.value" ng-blur="onSave()" placeholder="{{'Phone Extension'|translate}}"/>
<button class="btn btn-default" ng-click="onDeleteIncomingRule(rule)"><i class="fa fa-trash"></i></button>
</div>
</div>

View file

@ -9,7 +9,7 @@
<switch id="enabled" name="enabled" ng-model="settings.scheduling.value" class="green"></switch>
</luci-config-line>
</luci-config-lines>
<table class="table">
<table class="table" ng-show="settings.scheduling.value">
<thead>
<th translate>Day</th>
<th translate>Time</th>

View file

@ -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(){

View file

@ -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(){
});

View file

@ -31,8 +31,8 @@
<p>{{'settings.upgrade.online.info'|translate}}</p>
<luci-config-lines>
<luci-config-line title="{{onlineUpgrade}}">
<button ng-hide="onlineUpgrade" class="btn btn-lg btn-default" ng-click="onOnlineCheck()">{{'Check for Update'|translate}}</button>
<button ng-show="onlineUpgrade" class="btn btn-lg btn-default" ng-click="onUpgradeOnline()">{{'Upgrade'|translate}}</button>
<button ng-hide="onlineUpgradeAvailable" class="btn btn-lg btn-default" ng-click="onOnlineCheck()">{{'Check for Upgrade'|translate}}</button>
<button ng-show="onlineUpgradeAvailable" class="btn btn-lg btn-default" ng-click="onUpgradeOnline()">{{'Install Upgrade'|translate}}</button>
</luci-config-line>
</luci-config-lines>
</luci-config-section>
@ -40,11 +40,11 @@
<h2>{{'USB Firmware Upgrade'|translate}}</h2>
<p>{{'settings.upgrade.usb.info'|translate}}</p>
<luci-config-lines>
<luci-config-line title="{{usbUpgrade}}" ng-show="usbUpgrade">
<luci-config-line title="{{usbUpgrade}}" ng-show="usbUpgradeAvailable">
<button class="btn btn-lg btn-default" ng-click="onUpgradeUSB()">{{'Install Upgrade'|translate}}</button>
</luci-config-line>
<luci-config-line title="{{usbUpgrade}}" ng-hide="usbUpgrade">
<button class="btn btn-lg btn-default" ng-click="onCheckUSB()">{{'Check for Update'|translate}}</button>
<luci-config-line title="{{usbUpgrade}}" ng-hide="usbUpgradeAvailable">
<button class="btn btn-lg btn-default" ng-click="onCheckUSB()">{{'Check for Upgrade'|translate}}</button>
</luci-config-line>
</luci-config-lines>
</luci-config-section>

View file

@ -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();
});

View file

@ -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(){