Manage wallets

This commit is contained in:
Gustavo Maximiliano Cortez 2014-11-10 16:41:07 -03:00
parent 9e695863ed
commit ca3e9005a7
5 changed files with 77 additions and 14 deletions

View File

@ -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']

View File

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

View File

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

View File

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

View File

@ -24,7 +24,50 @@
</div>
</div>
<div class="line-dashed-h m30v"></div>
<div class="line-dashed-h m20b"></div>
<div class="row" ng-init="getWallets()">
<div class="large-12 columns">
<table width="100%" role="grid">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Status</th>
<th>Balance</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr
data-ng-repeat="item in wallets | orderBy:'name'"
ng-init="isReady = item.isReady(); activeWallet = $root.wallet.id"
ng-class="{'active':activeWallet == item.id, 'deleting':loading==item.id}">
<td>{{item.name || item.id }}</td>
<td width="70">{{item.requiredCopayers}} of {{item.totalCopayers}}</td>
<td width="220">{{isReady ? 'Complete' : 'Waiting for copayers...'}}</td>
<td width="220">
<span ng-if="!isReady">-</span>
<span ng-if="isReady">
{{item.balanceInfo.totalBalance || 0 |noFractionNumber}} {{item.settings.unitName}}
</span>
</td>
<td width="70" class="text-center">
<a translate
class="warning"
ng-really-message="{{'Are you sure to delete the wallet'}} {{(item.name || item.id)}}"
ng-really-click="deleteWallet(item)"
ng-show="activeWallet != item.id && loading != item.id">Delete</a>
<span ng-show="loading == item.id"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>
<span ng-show="activeWallet == item.id">Active</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="line-dashed-h m20b"></div>
<div class="row">
<div class="large-12 columns">