fix: CSV export limit (#3996)
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -360,18 +360,37 @@ window.app.component('lnbits-payment-list', {
|
|||||||
paymentTableRowKey(row) {
|
paymentTableRowKey(row) {
|
||||||
return row.payment_hash + row.amount
|
return row.payment_hash + row.amount
|
||||||
},
|
},
|
||||||
exportCSV(detailed = false) {
|
async exportCSV(detailed = false) {
|
||||||
// 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
|
||||||
const pagination = this.paymentsTable.pagination
|
const pagination = this.paymentsTable.pagination
|
||||||
const query = {
|
const maxPages = 100
|
||||||
sortby: pagination.sortBy ?? 'time',
|
const limit = 1000
|
||||||
direction: pagination.descending ? 'desc' : 'asc'
|
let payments = []
|
||||||
}
|
|
||||||
const params = new URLSearchParams(query)
|
this.paymentsCSV.loading = true
|
||||||
LNbits.api.getPayments(this.wallet, params).then(response => {
|
try {
|
||||||
let payments = response.data.data.map(this.mapPayment)
|
for (let page = 0; page < maxPages; page++) {
|
||||||
|
const query = {
|
||||||
|
sortby: pagination.sortBy ?? 'time',
|
||||||
|
direction: pagination.descending ? 'desc' : 'asc',
|
||||||
|
limit,
|
||||||
|
offset: page * limit
|
||||||
|
}
|
||||||
|
const params = new URLSearchParams(query)
|
||||||
|
const response = await LNbits.api.getPayments(this.wallet, params)
|
||||||
|
const pagePayments = response.data.data || []
|
||||||
|
payments = payments.concat(pagePayments.map(this.mapPayment))
|
||||||
|
|
||||||
|
if (
|
||||||
|
pagePayments.length < limit ||
|
||||||
|
payments.length >= response.data.total
|
||||||
|
) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let columns = this.paymentsCSV.columns
|
let columns = this.paymentsCSV.columns
|
||||||
|
|
||||||
if (detailed) {
|
if (detailed) {
|
||||||
@@ -400,7 +419,11 @@ window.app.component('lnbits-payment-list', {
|
|||||||
payments,
|
payments,
|
||||||
this.wallet.name + '-payments'
|
this.wallet.name + '-payments'
|
||||||
)
|
)
|
||||||
})
|
} catch (err) {
|
||||||
|
LNbits.utils.notifyApiError(err)
|
||||||
|
} finally {
|
||||||
|
this.paymentsCSV.loading = false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
addFilterTag() {
|
addFilterTag() {
|
||||||
if (!this.exportTagName) return
|
if (!this.exportTagName) return
|
||||||
|
|||||||
Reference in New Issue
Block a user