change backup to be appname
This commit is contained in:
parent
e283dc0bb1
commit
efe1cca74b
|
@ -14,9 +14,10 @@
|
|||
async function exportApp() {
|
||||
appExportLoading = true
|
||||
try {
|
||||
download(`/api/backups/export?appId=${_id}`)
|
||||
download(`/api/backups/export?appId=${_id}&appname=${name}`)
|
||||
notifier.success("App Export Complete.")
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
notifier.danger("App Export Failed.")
|
||||
} finally {
|
||||
appExportLoading = false
|
||||
|
@ -29,13 +30,13 @@
|
|||
<Spacer medium />
|
||||
<div class="card-footer">
|
||||
<TextButton text medium blue href="/_builder/{_id}">
|
||||
Open
|
||||
{name}
|
||||
→
|
||||
Open {name} →
|
||||
</TextButton>
|
||||
{#if appExportLoading}
|
||||
<Spinner size="10" />
|
||||
{:else}<i class="ri-folder-download-line" on:click={exportApp} />{/if}
|
||||
{:else}
|
||||
<i class="ri-folder-download-line" on:click={exportApp} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ const os = require("os")
|
|||
const fs = require("fs-extra")
|
||||
|
||||
exports.exportAppDump = async function(ctx) {
|
||||
const { appId } = ctx.query
|
||||
const { appId, appname } = ctx.query
|
||||
|
||||
const backupsDir = path.join(os.homedir(), ".budibase", "backups")
|
||||
fs.ensureDirSync(backupsDir)
|
||||
|
||||
const backupIdentifier = `${appId} Backup: ${new Date()}.txt`
|
||||
const backupIdentifier = `${appname}Backup${new Date().getTime()}.txt`
|
||||
|
||||
await performDump({
|
||||
dir: backupsDir,
|
||||
|
@ -23,19 +23,4 @@ exports.exportAppDump = async function(ctx) {
|
|||
|
||||
ctx.attachment(backupIdentifier)
|
||||
ctx.body = fs.createReadStream(backupFile)
|
||||
// ctx.body = {
|
||||
// url: `/api/backups/download/${backupIdentifier}`,
|
||||
// }
|
||||
}
|
||||
|
||||
// exports.downloadAppDump = async function(ctx) {
|
||||
// const fileName = ctx.params.fileName
|
||||
|
||||
// const backupsDir = path.join(os.homedir(), ".budibase", "backups")
|
||||
// fs.ensureDirSync(backupsDir)
|
||||
|
||||
// const backupFile = path.join(backupsDir, fileName)
|
||||
|
||||
// ctx.attachment(fileName)
|
||||
// ctx.body = fs.createReadStream(backupFile)
|
||||
// }
|
||||
|
|
|
@ -6,10 +6,5 @@ const { BUILDER } = require("../../utilities/security/permissions")
|
|||
const router = Router()
|
||||
|
||||
router.get("/api/backups/export", authorized(BUILDER), controller.exportAppDump)
|
||||
// .get(
|
||||
// "/api/backups/download/:fileName",
|
||||
// authorized(BUILDER),
|
||||
// controller.downloadAppDump
|
||||
// )
|
||||
|
||||
module.exports = router
|
||||
|
|
Loading…
Reference in New Issue