negate export button

This commit is contained in:
Peter Clement 2022-06-06 15:17:14 +01:00
parent 89f57ea56e
commit 3d9a6d5c4c
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)
)
}
}