From ca3e9005a7c0551f3d30b557bae5d0a4092c3bad Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 10 Nov 2014 16:41:07 -0300 Subject: [PATCH 1/4] Manage wallets --- css/src/main.css | 8 ++++++ css/src/mobile.css | 11 --------- js/controllers/manage.js | 21 ++++++++++++++++ js/services/controllerUtils.js | 6 +++-- views/manage.html | 45 +++++++++++++++++++++++++++++++++- 5 files changed, 77 insertions(+), 14 deletions(-) diff --git a/css/src/main.css b/css/src/main.css index ca693ca11..a0957a77f 100644 --- a/css/src/main.css +++ b/css/src/main.css @@ -909,6 +909,14 @@ label small.has-error { font-size: 11px; } +table tr.active { + background: #CBECE6; +} + +table tr.deleting { + background: #FCD5D5; +} + /* SECONDARY */ input[type='submit'] diff --git a/css/src/mobile.css b/css/src/mobile.css index 400c76249..e7e42fe1f 100644 --- a/css/src/mobile.css +++ b/css/src/mobile.css @@ -6,17 +6,6 @@ @media (max-width: 1024px) { - .line-dashed-setup-v, - .line-dashed-v, - .line-dashed-h { - border: none; - } - - .status { - left: 0; - top: 40px; - } - .logo-setup { margin: 20px 0; padding: 2rem 0; diff --git a/js/controllers/manage.js b/js/controllers/manage.js index 97c53a0bc..347d07900 100644 --- a/js/controllers/manage.js +++ b/js/controllers/manage.js @@ -12,4 +12,25 @@ angular.module('copayApp.controllers').controller('ManageController', function($ $scope.backupPlainText = backupService.profileEncrypted($rootScope.iden); $scope.hideViewBackup = true; }; + + $scope.getWallets = function() { + $scope.wallets = []; + var wids = _.pluck($rootScope.iden.listWallets(), 'id'); + _.each(wids, function(wid) { + var w = $rootScope.iden.getWalletById(wid); + $scope.wallets.push(w); + controllerUtils.updateBalance(w, function() { + $rootScope.$digest(); + }, true); + }); + }; + + $scope.deleteWallet = function(w) { + if (!w) return; + $scope.loading = w.id; + controllerUtils.deleteWallet($scope, w, function() { + $scope.loading = false; + $scope.getWallets(); + }); + }; }); diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index 02e4179d1..a871347c8 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -359,10 +359,12 @@ angular.module('copayApp.services') $rootScope.pendingTxCount = res.pendingForUs; }; - root.deleteWallet = function($scope, w) { + root.deleteWallet = function($scope, w, cb) { w = w || $rootScope.wallet; + var name = w.getName(); $rootScope.iden.deleteWallet(w.id, function() { - notification.info('Wallet deleted', $filter('translate')('Wallet deleted')); + notification.info(name + ' deleted', $filter('translate')('Wallet deleted')); + if (cb) return cb(); $rootScope.wallet = null; var lastFocused = $rootScope.iden.getLastFocusedWallet(); root.bindProfile($scope, $rootScope.iden, lastFocused); diff --git a/views/manage.html b/views/manage.html index 95e4cf5ef..58c9e8f99 100644 --- a/views/manage.html +++ b/views/manage.html @@ -24,7 +24,50 @@ -
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
NameTypeStatusBalanceActions
{{item.name || item.id }}{{item.requiredCopayers}} of {{item.totalCopayers}}{{isReady ? 'Complete' : 'Waiting for copayers...'}} + - + + {{item.balanceInfo.totalBalance || 0 |noFractionNumber}} {{item.settings.unitName}} + + + Delete + + Active +
+
+
+ +
From ea7de935d7e7e11b528237209b5b7f965e8e83b4 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 11 Nov 2014 10:59:05 -0300 Subject: [PATCH 2/4] Rename of callback function. Add network name. --- js/services/controllerUtils.js | 4 ++-- views/manage.html | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index a871347c8..73ea2d818 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -359,12 +359,12 @@ angular.module('copayApp.services') $rootScope.pendingTxCount = res.pendingForUs; }; - root.deleteWallet = function($scope, w, cb) { + root.deleteWallet = function($scope, w, skipBind) { w = w || $rootScope.wallet; var name = w.getName(); $rootScope.iden.deleteWallet(w.id, function() { notification.info(name + ' deleted', $filter('translate')('Wallet deleted')); - if (cb) return cb(); + if (skipBind) return skipBind(); $rootScope.wallet = null; var lastFocused = $rootScope.iden.getLastFocusedWallet(); root.bindProfile($scope, $rootScope.iden, lastFocused); diff --git a/views/manage.html b/views/manage.html index 58c9e8f99..1e5f8fe45 100644 --- a/views/manage.html +++ b/views/manage.html @@ -41,12 +41,13 @@ {{item.name || item.id }} - {{item.requiredCopayers}} of {{item.totalCopayers}} - {{isReady ? 'Complete' : 'Waiting for copayers...'}} - + {{item.requiredCopayers}} of {{item.totalCopayers}} - {{networkName}} + {{isReady ? 'Complete' : 'Waiting for copayers...'}} + - {{item.balanceInfo.totalBalance || 0 |noFractionNumber}} {{item.settings.unitName}} From 74b61624e5891f14fee25bd1bcc38d1f30efc530 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 11 Nov 2014 12:54:52 -0300 Subject: [PATCH 3/4] deleting wallet with callback --- js/controllers/more.js | 8 +++++++- js/services/controllerUtils.js | 11 ++++------- views/manage.html | 2 +- views/more.html | 8 +++++++- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/js/controllers/more.js b/js/controllers/more.js index 5af6313a9..f1e129e4a 100644 --- a/js/controllers/more.js +++ b/js/controllers/more.js @@ -88,7 +88,13 @@ angular.module('copayApp.controllers').controller('MoreController', }; $scope.deleteWallet = function() { - controllerUtils.deleteWallet($scope); + $scope.loading = true; + controllerUtils.deleteWallet($scope, $rootScope.wallet, function() { + $rootScope.wallet = null; + var lastFocused = $rootScope.iden.getLastFocusedWallet(); + controllerUtils.bindProfile($scope, $rootScope.iden, lastFocused); + $scope.loading = false; + }); }; $scope.purge = function(deleteAll) { diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index 73ea2d818..b54f62d2b 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -359,15 +359,12 @@ angular.module('copayApp.services') $rootScope.pendingTxCount = res.pendingForUs; }; - root.deleteWallet = function($scope, w, skipBind) { - w = w || $rootScope.wallet; + root.deleteWallet = function($scope, w, cb) { + if (!w) return root.onErrorDigest(); var name = w.getName(); $rootScope.iden.deleteWallet(w.id, function() { - notification.info(name + ' deleted', $filter('translate')('Wallet deleted')); - if (skipBind) return skipBind(); - $rootScope.wallet = null; - var lastFocused = $rootScope.iden.getLastFocusedWallet(); - root.bindProfile($scope, $rootScope.iden, lastFocused); + notification.info(name + ' deleted', $filter('translate')('This wallet was deleted')); + return cb(); }); }; diff --git a/views/manage.html b/views/manage.html index 1e5f8fe45..c952c85c9 100644 --- a/views/manage.html +++ b/views/manage.html @@ -56,7 +56,7 @@ Delete diff --git a/views/more.html b/views/more.html index 108151341..59a9e29ad 100644 --- a/views/more.html +++ b/views/more.html @@ -48,7 +48,13 @@

Delete Wallet

If all funds have been removed from your wallet and you do not wish to have the wallet data stored on your computer anymore, you can delete your wallet.

- Delete + + Delete + Deleting... +
From 5a9ecb3a13bec53665ba3d0a2b942552d726515a Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 11 Nov 2014 12:55:25 -0300 Subject: [PATCH 4/4] fix sidebar when you delete your last inactive wallet --- views/includes/sidebar.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/includes/sidebar.html b/views/includes/sidebar.html index fa7961da0..2b1d78c37 100644 --- a/views/includes/sidebar.html +++ b/views/includes/sidebar.html @@ -76,7 +76,7 @@ -