Get all selected rows for external ds row export

This commit is contained in:
Mel O'Hagan 2022-06-16 13:04:25 +01:00
parent 48dc729f9a
commit 8a03ca38ec
3 changed files with 20 additions and 25 deletions

View File

@ -155,27 +155,22 @@ exports.validate = async () => {
}
exports.exportRows = async ctx => {
const { datasourceId, tableName } = breakExternalTableId(ctx.params.tableId)
const { datasourceId } = breakExternalTableId(ctx.params.tableId)
const db = getAppDB()
let format = ctx.query.format
const datasource = await db.get(datasourceId)
if (!datasource || !datasource.entities) {
ctx.throw(400, "Datasource has not been configured for plus API.")
}
const tables = datasource.entities
const table = tables[tableName]
ctx.request.body = {
query: {
oneOf: {
[table.primaryDisplay]: ctx.request.body.rows.map(
id => breakRowIdField(id)[0]
),
_id: ctx.request.body.rows.map(row => JSON.parse(decodeURI(row))[0]),
},
},
}
let result = await exports.search(ctx)
let headers = Object.keys(result.rows[0])
const exporter = exporters[format]
const filename = `export.${format}`

View File

@ -1094,10 +1094,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@1.0.200-alpha.0":
version "1.0.200-alpha.0"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.200-alpha.0.tgz#2fd1e1cc71c07891fd66e37ceaab2cffb0df1106"
integrity sha512-CZPPuj+WIDTxLVbrv/B4J4rQiNnkRBs3ZWK2AvlVlY9knWuM034MKHPK3YaeQdVofZqkTOfWKZp6KFRroC304g==
"@budibase/backend-core@1.0.200-alpha.3":
version "1.0.200-alpha.3"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.200-alpha.3.tgz#b21ba2bdb4f1de3e5f14161b8203a1a98f693e4d"
integrity sha512-zVy6bfg4yrtjva0MoBMqIbFrNwA+v76XvRgI3GesaSuJKspWCk4lKtV6I4cr6q9Rr2U+kUzK/4ho/0F/oZcfsg==
dependencies:
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
@ -1175,12 +1175,12 @@
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
"@budibase/pro@1.0.200-alpha.0":
version "1.0.200-alpha.0"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.200-alpha.0.tgz#68adc9a61a1b975a990e1a4d4ddf5dba69fc038c"
integrity sha512-GxIxvBjCO7kQxFwASKtGC57C2cAN3oiHU+tTCb57qKtp63GdP1z+iqDLtUEOIXXume9bC1xxTD/LSBMziTrHKg==
"@budibase/pro@1.0.200-alpha.3":
version "1.0.200-alpha.3"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.200-alpha.3.tgz#c6bc4c6b335fb8eae973939efc16958022a45a99"
integrity sha512-YUUlfVJA2xhtjL3jXem7WtuqdshDWF8qm4xbEXgvlpgOxHtGrjSxf9WR4kir/F2UDDTgVNmttAS1oWVDMSGzug==
dependencies:
"@budibase/backend-core" "1.0.200-alpha.0"
"@budibase/backend-core" "1.0.200-alpha.3"
node-fetch "^2.6.1"
"@budibase/standard-components@^0.9.139":

View File

@ -291,10 +291,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@1.0.200-alpha.0":
version "1.0.200-alpha.0"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.200-alpha.0.tgz#2fd1e1cc71c07891fd66e37ceaab2cffb0df1106"
integrity sha512-CZPPuj+WIDTxLVbrv/B4J4rQiNnkRBs3ZWK2AvlVlY9knWuM034MKHPK3YaeQdVofZqkTOfWKZp6KFRroC304g==
"@budibase/backend-core@1.0.200-alpha.3":
version "1.0.200-alpha.3"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.200-alpha.3.tgz#b21ba2bdb4f1de3e5f14161b8203a1a98f693e4d"
integrity sha512-zVy6bfg4yrtjva0MoBMqIbFrNwA+v76XvRgI3GesaSuJKspWCk4lKtV6I4cr6q9Rr2U+kUzK/4ho/0F/oZcfsg==
dependencies:
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
@ -322,12 +322,12 @@
uuid "8.3.2"
zlib "1.0.5"
"@budibase/pro@1.0.200-alpha.0":
version "1.0.200-alpha.0"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.200-alpha.0.tgz#68adc9a61a1b975a990e1a4d4ddf5dba69fc038c"
integrity sha512-GxIxvBjCO7kQxFwASKtGC57C2cAN3oiHU+tTCb57qKtp63GdP1z+iqDLtUEOIXXume9bC1xxTD/LSBMziTrHKg==
"@budibase/pro@1.0.200-alpha.3":
version "1.0.200-alpha.3"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.200-alpha.3.tgz#c6bc4c6b335fb8eae973939efc16958022a45a99"
integrity sha512-YUUlfVJA2xhtjL3jXem7WtuqdshDWF8qm4xbEXgvlpgOxHtGrjSxf9WR4kir/F2UDDTgVNmttAS1oWVDMSGzug==
dependencies:
"@budibase/backend-core" "1.0.200-alpha.0"
"@budibase/backend-core" "1.0.200-alpha.3"
node-fetch "^2.6.1"
"@cspotcode/source-map-consumer@0.8.0":