Added link to blockchain after sent a txp

This commit is contained in:
Gustavo Maximiliano Cortez 2015-02-12 12:14:37 -03:00
parent 2a32a308bd
commit 9854ca1464
3 changed files with 59 additions and 34 deletions

View File

@ -5,44 +5,63 @@ angular.module('copayApp.controllers').controller('HomeWalletController', functi
$scope.openTxModal = function(tx) { $scope.openTxModal = function(tx) {
var ModalInstanceCtrl = function($scope, $modalInstance) { var ModalInstanceCtrl = function($scope, $modalInstance) {
var w = $rootScope.wallet; var w = $rootScope.wallet;
$scope.error = null;
$scope.tx = tx; $scope.tx = tx;
$scope.registeredCopayerIds = w.getRegisteredCopayerIds(); $scope.registeredCopayerIds = w.getRegisteredCopayerIds();
$scope.loading = null; $scope.loading = null;
$scope.getShortNetworkName = function() {
var w = $rootScope.wallet;
return w.getNetworkName().substring(0, 4);
};
$scope.sign = function(ntxid) { $scope.sign = function(ntxid) {
$scope.loading = true; $scope.loading = true;
$scope.error = null;
$timeout(function() { $timeout(function() {
w.signAndSend(ntxid, function(err, id, status) { w.signAndSend(ntxid, function(err, id, status) {
$scope.loading = false; $scope.loading = false;
if (err) if (err) {
$scope.error = err; $scope.error = 'Transaction could not send. Please try again.';
else $scope.$digest();
$modalInstance.close(status); }
else {
$modalInstance.close(status);
}
}); });
}, 100); }, 100);
}; };
$scope.reject = function(ntxid) { $scope.reject = function(ntxid) {
$scope.loading = true; $scope.loading = true;
$scope.error = null;
$timeout(function() { $timeout(function() {
w.reject(ntxid, function(err, status) { w.reject(ntxid, function(err, status) {
$scope.loading = false; $scope.loading = false;
if (err) if (err) {
$scope.error = err; $scope.error = err;
else $scope.$digest();
$modalInstance.close(status); }
else {
$modalInstance.close(status);
}
}); });
}, 100); }, 100);
}; };
$scope.broadcast = function(ntxid) { $scope.broadcast = function(ntxid) {
$scope.loading = true; $scope.loading = true;
$scope.error = null;
$timeout(function() { $timeout(function() {
w.issueTx(ntxid, function(err, txid, status) { w.issueTx(ntxid, function(err, txid, status) {
$scope.loading = false; $scope.loading = false;
if (err) if (err) {
$scope.error = err; $scope.error = 'Transaction could not send. Please try again.';
$modalInstance.close(status); $scope.$digest();
}
else {
$modalInstance.close(status);
}
}); });
}, 100); }, 100);
}; };

View File

@ -73,7 +73,7 @@
<small class="ellipsis text-gray m10v" ng-if="btx.txid" > ID: {{btx.txid}} </small> <small class="ellipsis text-gray m10v" ng-if="btx.txid" > ID: {{btx.txid}} </small>
<div class="oh"> <div class="oh">
<a class="button-setup right" ng-click="$root.openExternalLink('http://' + getShortNetworkName() + '.insight.is/tx/' + btx.txid)" ng-if="btx.txid"> <a class="button outline light-gray tiny right" ng-click="$root.openExternalLink('http://' + getShortNetworkName() + '.insight.is/tx/' + btx.txid)" ng-if="btx.txid">
See it on the blockchain <i class="icon-arrow-right2 vm"></i> See it on the blockchain <i class="icon-arrow-right2 vm"></i>
</a> </a>
</div> </div>

View File

@ -81,15 +81,14 @@
<span class="text-warning size-14"> <span class="text-warning size-14">
{{error}} {{error}}
</span> </span>
<a class="close-notification text-warning" ng-click="error=null">&#215;</a>
</div> </div>
<div class="row collapse" <div class="row collapse m10t"
ng-init="hideSign = false; hideReject = false" ng-init="hideSign = false; hideReject = false"
ng-show="!tx.signedBy[$root.wallet.getMyCopayerId()] && !tx.rejectedBy[$root.wallet.getMyCopayerId()] && ng-show="!tx.signedBy[$root.wallet.getMyCopayerId()] && !tx.rejectedBy[$root.wallet.getMyCopayerId()] &&
$root.wallet.txProposals.txps[tx.ntxid].builder.build().countInputMissingSignatures(0) != 0"> $root.wallet.txProposals.txps[tx.ntxid].builder.build().countInputMissingSignatures(0) != 0">
<div class="large-5 medium-5 small-5 columns"> <div class="large-5 medium-5 small-5 columns">
<button class="button warning m0 expand" ng-click="hideSign = true; reject(tx.ntxid);" <button class="button warning m0 expand" ng-click="hideTxInfo = true; hideSign = true; reject(tx.ntxid);"
ng-disabled="loading" ng-show="!hideReject"> ng-disabled="loading" ng-show="!hideReject">
<i class="fi-x icon-sign x" ng-show="!loading"></i> <i class="fi-x icon-sign x" ng-show="!loading"></i>
<i class="fi-bitcoin-circle icon-rotate spinner" ng-show="loading"></i> <i class="fi-bitcoin-circle icon-rotate spinner" ng-show="loading"></i>
@ -97,7 +96,7 @@
</button> </button>
</div> </div>
<div class="large-5 medium-5 small-5 columns text-right"> <div class="large-5 medium-5 small-5 columns text-right">
<button class="button primary m0 expand" ng-click="hideReject = true; sign(tx.ntxid)" <button class="button primary m0 expand" ng-click="hideTxInfo = true; hideReject = true; sign(tx.ntxid)"
ng-disabled="loading" ng-show="!hideSign"> ng-disabled="loading" ng-show="!hideSign">
<i class="fi-check icon-sign check" ng-show="!loading"></i> <i class="fi-check icon-sign check" ng-show="!loading"></i>
<i class="fi-bitcoin-circle icon-rotate spinner" ng-show="loading"></i> <i class="fi-bitcoin-circle icon-rotate spinner" ng-show="loading"></i>
@ -106,23 +105,30 @@
</div> </div>
</div> </div>
<div class="row collapse" <div ng-show="!hideTxInfo">
ng-show="!$root.wallet.txProposals.txps[tx.ntxid].sentTs <div class="row collapse m10t"
&& $root.wallet.txProposals.txps[tx.ntxid].builder.build().countInputMissingSignatures(0) == 0"> ng-show="!$root.wallet.txProposals.txps[tx.ntxid].sentTs
<button class="primary tiny m0 expand" && $root.wallet.txProposals.txps[tx.ntxid].builder.build().countInputMissingSignatures(0) == 0">
ng-click="broadcast(tx.ntxid)" <button class="primary tiny m0 expand"
ng-disabled="loading"> <i class="fi-upload-cloud"></i> ng-click="broadcast(tx.ntxid)"
<span translate>Broadcast Transaction</span> ng-disabled="loading"> <i class="fi-upload-cloud"></i>
</button> <span translate>Broadcast Transaction</span>
</div> </button>
<div class="text-center text-success" </div>
ng-show="$root.wallet.txProposals.txps[tx.ntxid].sentTs <div class="text-success m10t oh"
&& $root.wallet.txProposals.txps[tx.ntxid].builder.build().countInputMissingSignatures(0) == 0"> ng-show="$root.wallet.txProposals.txps[tx.ntxid].sentTs
Transaction sent! && $root.wallet.txProposals.txps[tx.ntxid].isFullySigned()">
</div> <a class="button outline light-gray tiny right"
<div class="text-center text-warning" ng-click="$root.openExternalLink('http://' + getShortNetworkName() + '.insight.is/tx/' +
ng-show="!$root.wallet.txProposals.txps[tx.ntxid].sentTs && $root.wallet.txProposals.txps[tx.ntxid].sentTxid)">
!$root.wallet.txProposals.txps[tx.ntxid].isPending($root.wallet.maxRejectCount())"> See it on the blockchain <i class="icon-arrow-right2 vm"></i>
Transaction finally rejected </a>
<div class="m10t">Transaction sent!</div>
</div>
<div class="text-center text-warning"
ng-show="!$root.wallet.txProposals.txps[tx.ntxid].sentTs &&
$root.wallet.txProposals.txps[tx.ntxid].isFinallyRejected($root.wallet.maxRejectCount())">
Transaction finally rejected
</div>
</div> </div>
</div> </div>