Added csv file generation
This commit is contained in:
parent
b5d502273d
commit
f1adde8e44
2 changed files with 35 additions and 1 deletions
|
|
@ -19,11 +19,33 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
$scope.alternativeCurrency = [];
|
$scope.alternativeCurrency = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$scope.selectPage = function(page) {
|
$scope.selectPage = function(page) {
|
||||||
$scope.currentPage = page;
|
$scope.currentPage = page;
|
||||||
$scope.update();
|
$scope.update();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$scope.downloadHistory = function() {
|
||||||
|
var data = $scope.blockchain_txs;
|
||||||
|
var csvContent = "data:text/csv;charset=utf-8,";
|
||||||
|
|
||||||
|
data.forEach(function(it, index) {
|
||||||
|
var dataString = it.ts + ',' + it.amount + ',' + it.action + ',' + it.addressTo;
|
||||||
|
csvContent += index < data.length ? dataString + "\n" : dataString;
|
||||||
|
});
|
||||||
|
|
||||||
|
var encodedUri = encodeURI(csvContent);
|
||||||
|
var link = document.createElement("a");
|
||||||
|
link.setAttribute("href", encodedUri);
|
||||||
|
link.setAttribute("download", "my_data.csv");
|
||||||
|
|
||||||
|
link.click();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$scope.update = function() {
|
$scope.update = function() {
|
||||||
$scope.getTransactions();
|
$scope.getTransactions();
|
||||||
};
|
};
|
||||||
|
|
@ -73,6 +95,8 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
|
|
||||||
|
|
||||||
$scope.hasAction = function(actions, action) {
|
$scope.hasAction = function(actions, action) {
|
||||||
|
|
||||||
|
|
||||||
return actions.hasOwnProperty('create');
|
return actions.hasOwnProperty('create');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
class="row"
|
class="row"
|
||||||
ng-if="blockchain_txs[0].txid">
|
ng-if="blockchain_txs[0].txid">
|
||||||
<div class="large-12 columns">
|
<div class="large-12 columns">
|
||||||
|
</div>
|
||||||
<div class="panel"
|
<div class="panel"
|
||||||
ng-repeat="btx in blockchain_txs | orderBy:'-ts'" ng-click="btx.showDetails = !btx.showDetails">
|
ng-repeat="btx in blockchain_txs | orderBy:'-ts'" ng-click="btx.showDetails = !btx.showDetails">
|
||||||
<div class="row size-14">
|
<div class="row size-14">
|
||||||
|
|
@ -99,6 +99,16 @@
|
||||||
<a href="http://{{getShortNetworkName()}}.insight.is/tx/{{btx.txid}}" target="_blank" class="right"> More details <i class="icon-arrow-right2 vm"></i> </a>
|
<a href="http://{{getShortNetworkName()}}.insight.is/tx/{{btx.txid}}" target="_blank" class="right"> More details <i class="icon-arrow-right2 vm"></i> </a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div ng-if="generating" class="right size-12">
|
||||||
|
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
|
||||||
|
<span translate>Generating file...</span>
|
||||||
|
</div>
|
||||||
|
<div ng-if="!generating" class="right size-12">
|
||||||
|
<a class="text-gray" href="#!/history" ng-click="downloadHistory();">
|
||||||
|
<i class="fi-download"></i>
|
||||||
|
<span translate>Download</span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<pagination page="currentPage" total-items="totalItems" items-per-page="itemsPerPage" on-select-page="selectPage(page)" max-size="10" />
|
<pagination page="currentPage" total-items="totalItems" items-per-page="itemsPerPage" on-select-page="selectPage(page)" max-size="10" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue