1
0
Fork 0
mirror of synced 2024-10-04 03:54:37 +13:00

negate export button

This commit is contained in:
Peter Clement 2022-06-06 15:17:14 +01:00
parent 88c98d0227
commit bd737cc1ca
3 changed files with 14 additions and 14 deletions

View file

@ -2,15 +2,15 @@
import { ModalContent, Toggle } from "@budibase/bbui"
export let app
let includeRows = true
let excludeRows = false
const exportApp = () => {
const id = app.deployed ? app.prodId : app.devId
const appName = encodeURIComponent(app.name)
window.location = `/api/backups/export?appId=${id}&appname=${appName}&includeRows=${includeRows}`
window.location = `/api/backups/export?appId=${id}&appname=${appName}&excludeRows=${excludeRows}`
}
</script>
<ModalContent title={"Export"} confirmText={"Export"} onConfirm={exportApp}>
<Toggle text="Include Data" bind:value={includeRows} />
<Toggle text="Exclude Rows" bind:value={excludeRows} />
</ModalContent>

View file

@ -1,11 +1,11 @@
const { streamBackup } = require("../../utilities/fileSystem")
exports.exportAppDump = async function (ctx) {
let { appId, includeRows } = ctx.query
let { appId, excludeRows } = ctx.query
const appName = decodeURI(ctx.query.appname)
includeRows = includeRows === "true"
excludeRows = excludeRows === "true"
const backupIdentifier = `${appName}-export-${new Date().getTime()}.txt`
ctx.attachment(backupIdentifier)
ctx.body = await streamBackup(appId, includeRows)
ctx.body = await streamBackup(appId, excludeRows)
}

View file

@ -110,20 +110,20 @@ exports.apiFileReturn = contents => {
return fs.createReadStream(path)
}
exports.defineFilter = includeRows => {
if (includeRows) {
return doc =>
!(
doc._id.includes(USER_METDATA_PREFIX) ||
doc._id.includes(LINK_USER_METADATA_PREFIX)
)
} else if (!includeRows) {
exports.defineFilter = excludeRows => {
if (excludeRows) {
return doc =>
!(
doc._id.includes(USER_METDATA_PREFIX) ||
doc._id.includes(LINK_USER_METADATA_PREFIX) ||
doc._id.includes(TABLE_ROW_PREFIX)
)
} else if (!excludeRows) {
return doc =>
!(
doc._id.includes(USER_METDATA_PREFIX) ||
doc._id.includes(LINK_USER_METADATA_PREFIX)
)
}
}