forked from tsai/budibase
5 changed files with 51 additions and 13 deletions
@ -0,0 +1,16 @@ |
|||||
|
<script> |
||||
|
import { ModalContent, Toggle } from "@budibase/bbui" |
||||
|
|
||||
|
export let app |
||||
|
let includeRows = true |
||||
|
|
||||
|
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}` |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<ModalContent title={"Export"} confirmText={"Export"} onConfirm={exportApp}> |
||||
|
<Toggle text="Include Data" bind:value={includeRows} /> |
||||
|
</ModalContent> |
||||
@ -1,9 +1,11 @@ |
|||||
const { streamBackup } = require("../../utilities/fileSystem") |
const { streamBackup } = require("../../utilities/fileSystem") |
||||
|
|
||||
exports.exportAppDump = async function (ctx) { |
exports.exportAppDump = async function (ctx) { |
||||
const { appId } = ctx.query |
let { appId, includeRows } = ctx.query |
||||
const appName = decodeURI(ctx.query.appname) |
const appName = decodeURI(ctx.query.appname) |
||||
|
includeRows = includeRows === "true" |
||||
const backupIdentifier = `${appName}-export-${new Date().getTime()}.txt` |
const backupIdentifier = `${appName}-export-${new Date().getTime()}.txt` |
||||
ctx.attachment(backupIdentifier) |
ctx.attachment(backupIdentifier) |
||||
ctx.body = await streamBackup(appId) |
|
||||
|
ctx.body = await streamBackup(appId, includeRows) |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue