Fix csv export (#1852)

* fetch all payments for csv export

* include fiat amount and currency in export
This commit is contained in:
jackstar12 2023-08-15 13:39:12 +02:00 committed by GitHub
parent f096b51f70
commit 3aef1605be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -175,6 +175,12 @@ new Vue({
},
paymentsCSV: {
columns: [
{
name: 'pending',
align: 'left',
label: 'Pending',
field: 'pending'
},
{
name: 'memo',
align: 'left',
@ -224,6 +230,18 @@ new Vue({
align: 'right',
label: this.$t('webhook'),
field: 'webhook'
},
{
name: 'fiat_currency',
align: 'right',
label: 'Fiat Currency',
field: row => row.extra.wallet_fiat_currency
},
{
name: 'fiat_amount',
align: 'right',
label: 'Fiat Amount',
field: row => row.extra.wallet_fiat_amount
}
],
filter: null,
@ -792,14 +810,10 @@ new Vue({
// status is important for export but it is not in paymentsTable
// because it is manually added with payment detail link and icons
// and would cause duplication in the list
let columns = structuredClone(this.paymentsCSV.columns)
columns.unshift({
name: 'pending',
align: 'left',
label: 'Pending',
field: 'pending'
LNbits.api.getPayments(this.g.wallet, {}).then(response => {
const payments = response.data.data.map(LNbits.map.payment)
LNbits.utils.exportCSV(this.paymentsCSV.columns, payments)
})
LNbits.utils.exportCSV(columns, this.payments)
},
pasteToTextArea: function () {
navigator.clipboard.readText().then(text => {