Skip to content

Commit

Permalink
load backup list when backup section is called. scope.apply. refactor…
Browse files Browse the repository at this point in the history
…, silence log outputs.
  • Loading branch information
gubatron committed Aug 30, 2014
1 parent b5ca4e0 commit cf68300
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
3 changes: 0 additions & 3 deletions html/js/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var app = angular.module('app', ['ui.bootstrap', 'ngRoute', 'obControllers'])


app.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
Expand Down Expand Up @@ -134,8 +133,6 @@ app.directive("validateOnBlur", [function() {
return ddo;
}]);



function validate_bitcoin_address(address) {
var result = false;

Expand Down
17 changes: 9 additions & 8 deletions html/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@ obControllers
$('#backup-form').show()
$('#backup-form').siblings().hide()
$('#settings-backup').addClass('active');
$scope.getBackups();
break;
default:
$('#profile-form').show();
Expand All @@ -1050,7 +1051,6 @@ obControllers

}


$scope.addNotary = function(notary) {

notaryGUID = (notary != '') ? notary : $scope.newNotary;
Expand Down Expand Up @@ -1136,25 +1136,26 @@ obControllers
}

$scope.getBackups = function() {
console.log('Settings.getBackups')
//console.log("executing getBackups()!")
socket.send('get_backups')
}

$scope.onGetBackupsResponse = function (msg) {
//console.log("executing onGetBackupsResponse!")
if (msg.result === 'success') {
//update UI with list of backups. (could be empty list)
if (msg.backups) {
$scope.backups = []
//convert list of json objects into JS objects.
for (i=0; i < msg.backups.length; i++) {
msg.backups[i] = $.parseJSON(msg.backups[i])
console.log(msg.backups[i]);
$scope.backups[i] = $.parseJSON(msg.backups[i]);
}

$scope.backups = msg.backups;
$scope.$apply();
if (!$scope.$$phase) {
$scope.$apply();
}
}

} else if (msg.result === 'failure') {
//console.log('onGetBackupsResponse: failure')
Notifier.error(msg.detail, 'Could not fetch list of backups, check your backup folder')
}
}
Expand Down

0 comments on commit cf68300

Please sign in to comment.