Added column signers to CSV file
This commit is contained in:
parent
2dd2baebc3
commit
a72ae412a2
1 changed files with 23 additions and 7 deletions
|
|
@ -29,7 +29,6 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
|
|
||||||
|
|
||||||
$scope.downloadHistory = function() {
|
$scope.downloadHistory = function() {
|
||||||
|
|
||||||
if (window.cordova) {
|
if (window.cordova) {
|
||||||
log.info('Not available on mobile');
|
log.info('Not available on mobile');
|
||||||
return;
|
return;
|
||||||
|
|
@ -41,18 +40,25 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
w.getTransactionHistory(function(err, res) {
|
w.getTransactionHistory(function(err, res) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|
||||||
if (!res) {
|
if (!res) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var unit = w.settings.unitName;
|
var unit = w.settings.unitName;
|
||||||
var data = res.items;
|
var data = res.items;
|
||||||
var filename = "copay_history.csv";
|
var filename = "copay_history.csv";
|
||||||
var csvContent = "data:text/csv;charset=utf-8,";
|
var csvContent = "data:text/csv;charset=utf-8,";
|
||||||
csvContent += "Date,Amount(" + unit + "),Action,AddressTo,Comment\n";
|
csvContent += "Date,Amount(" + unit + "),Action,AddressTo,Comment";
|
||||||
|
|
||||||
|
if (w.isShared()) {
|
||||||
|
csvContent += ",Signers\n";
|
||||||
|
} else {
|
||||||
|
csvContent += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
data.forEach(function(it, index) {
|
data.forEach(function(it, index) {
|
||||||
var dataString = formatDate(it.minedTs || it.sentTs) + ',' + it.amount + ',' + it.action + ',' + it.addressTo + ',' + formatString(it.comment);
|
var dataString = formatDate(it.minedTs || it.sentTs) + ',' + it.amount + ',' + it.action + ',' + formatString(it.addressTo) + ',' + formatString(it.comment);
|
||||||
|
if (it.actionList) {
|
||||||
|
dataString += ',' + formatSigners(it.actionList);
|
||||||
|
}
|
||||||
csvContent += index < data.length ? dataString + "\n" : dataString;
|
csvContent += index < data.length ? dataString + "\n" : dataString;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -91,12 +97,22 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
|
function formatSigners(item) {
|
||||||
|
if (!item) return '';
|
||||||
|
var str = '';
|
||||||
|
item.forEach(function(it, index) {
|
||||||
|
str += index == 0 ? w.publicKeyRing.nicknameForCopayer(it.cId) : '|' + w.publicKeyRing.nicknameForCopayer(it.cId);
|
||||||
|
});
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$scope.update = function() {
|
$scope.update = function() {
|
||||||
$scope.getTransactions();
|
$scope.getTransactions();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue