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