Merge pull request #1756 from cmgustavo/feature/manage-wallets
Manage wallets
This commit is contained in:
commit
1753e315c1
8 changed files with 94 additions and 21 deletions
|
|
@ -909,6 +909,14 @@ label small.has-error {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table tr.active {
|
||||||
|
background: #CBECE6;
|
||||||
|
}
|
||||||
|
|
||||||
|
table tr.deleting {
|
||||||
|
background: #FCD5D5;
|
||||||
|
}
|
||||||
|
|
||||||
/* SECONDARY */
|
/* SECONDARY */
|
||||||
|
|
||||||
input[type='submit']
|
input[type='submit']
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,6 @@
|
||||||
|
|
||||||
@media (max-width: 1024px) {
|
@media (max-width: 1024px) {
|
||||||
|
|
||||||
.line-dashed-setup-v,
|
|
||||||
.line-dashed-v,
|
|
||||||
.line-dashed-h {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status {
|
|
||||||
left: 0;
|
|
||||||
top: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo-setup {
|
.logo-setup {
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
padding: 2rem 0;
|
padding: 2rem 0;
|
||||||
|
|
|
||||||
|
|
@ -12,4 +12,25 @@ angular.module('copayApp.controllers').controller('ManageController', function($
|
||||||
$scope.backupPlainText = backupService.profileEncrypted($rootScope.iden);
|
$scope.backupPlainText = backupService.profileEncrypted($rootScope.iden);
|
||||||
$scope.hideViewBackup = true;
|
$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();
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,13 @@ angular.module('copayApp.controllers').controller('MoreController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.deleteWallet = function() {
|
$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) {
|
$scope.purge = function(deleteAll) {
|
||||||
|
|
|
||||||
|
|
@ -359,13 +359,12 @@ angular.module('copayApp.services')
|
||||||
$rootScope.pendingTxCount = res.pendingForUs;
|
$rootScope.pendingTxCount = res.pendingForUs;
|
||||||
};
|
};
|
||||||
|
|
||||||
root.deleteWallet = function($scope, w) {
|
root.deleteWallet = function($scope, w, cb) {
|
||||||
w = w || $rootScope.wallet;
|
if (!w) return root.onErrorDigest();
|
||||||
|
var name = w.getName();
|
||||||
$rootScope.iden.deleteWallet(w.id, function() {
|
$rootScope.iden.deleteWallet(w.id, function() {
|
||||||
notification.info('Wallet deleted', $filter('translate')('Wallet deleted'));
|
notification.info(name + ' deleted', $filter('translate')('This wallet was deleted'));
|
||||||
$rootScope.wallet = null;
|
return cb();
|
||||||
var lastFocused = $rootScope.iden.getLastFocusedWallet();
|
|
||||||
root.bindProfile($scope, $rootScope.iden, lastFocused);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="side-nav" ng-if="!walletSelection && $root.wallet.isReady()">
|
<ul class="side-nav" ng-if="(!walletSelection || !wallets.0) && $root.wallet.isReady()">
|
||||||
<li data-ng-repeat="item in menu" ui-route="{{item.link}}" class="nav-item" data-ng-class="{active: isActive(item)}">
|
<li data-ng-repeat="item in menu" ui-route="{{item.link}}" class="nav-item" data-ng-class="{active: isActive(item)}">
|
||||||
<a href="#!/{{item.link}}" ng-click="toggleCollapse()" class="db p20h">
|
<a href="#!/{{item.link}}" ng-click="toggleCollapse()" class="db p20h">
|
||||||
<i class="size-21 m20r {{item.icon}}"></i> {{item.title|translate}}
|
<i class="size-21 m20r {{item.icon}}"></i> {{item.title|translate}}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,51 @@
|
||||||
</div>
|
</div>
|
||||||
</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; networkName = item.getNetworkName()"
|
||||||
|
ng-class="{'active':activeWallet == item.id, 'deleting':loading==item.id}">
|
||||||
|
<td>{{item.name || item.id }}</td>
|
||||||
|
<td width="120">{{item.requiredCopayers}} of {{item.totalCopayers}} - {{networkName}}</td>
|
||||||
|
<td width="200">{{isReady ? 'Complete' : 'Waiting for copayers...'}}</td>
|
||||||
|
<td width="200">
|
||||||
|
<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 you want 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="row">
|
||||||
<div class="large-12 columns">
|
<div class="large-12 columns">
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,13 @@
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<h2><i class="fi-minus-circle m10r"></i> <span translate>Delete Wallet</span></h2>
|
<h2><i class="fi-minus-circle m10r"></i> <span translate>Delete Wallet</span></h2>
|
||||||
<p translate class="text-gray">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.</p>
|
<p translate class="text-gray">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.</p>
|
||||||
<a translate class="button warning m0" ng-really-message="{{'Are you sure to delete this wallet from this computer?'|translate}}" ng-really-click="deleteWallet()"> Delete</a>
|
<a class="button warning m0"
|
||||||
|
ng-really-message="{{'Are you sure you want to delete this wallet?'|translate}}"
|
||||||
|
ng-really-click="deleteWallet()"
|
||||||
|
ng-class="{'disabled':loading}">
|
||||||
|
<span ng-show="!loading">Delete</span>
|
||||||
|
<span ng-show="loading">Deleting...</span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue