fix download issue and pass name for backup after restore
This commit is contained in:
parent
b4a223be3d
commit
02b505c75c
|
@ -11,8 +11,6 @@
|
|||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||
import CreateRestoreModal from "./CreateRestoreModal.svelte"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import download from "downloadjs"
|
||||
import { backups } from "stores/portal"
|
||||
|
||||
export let row
|
||||
|
||||
|
@ -20,7 +18,6 @@
|
|||
let restoreDialog
|
||||
let updateDialog
|
||||
let name
|
||||
let restoreBackupName
|
||||
let restoreBackupModal
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
@ -30,7 +27,7 @@
|
|||
type: "backupRestore",
|
||||
name,
|
||||
backupId: row._id,
|
||||
restoreBackupName,
|
||||
restoreBackupName: name,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -48,12 +45,9 @@
|
|||
name,
|
||||
})
|
||||
}
|
||||
|
||||
async function downloadExport() {
|
||||
let resp = await backups.downloadBackup({
|
||||
backupId: row._id,
|
||||
appId: row.appId,
|
||||
})
|
||||
download(resp, row.filename)
|
||||
window.location = `/api/apps/${row.appId}/backups/${row._id}/file`
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@
|
|||
}
|
||||
|
||||
async function handleButtonClick({ detail }) {
|
||||
console.log(detail.type)
|
||||
if (detail.type === "backupDelete") {
|
||||
await backups.deleteBackup({
|
||||
appId: app.instance._id,
|
||||
|
@ -118,6 +117,7 @@
|
|||
await backups.restoreBackup({
|
||||
appId: app.instance._id,
|
||||
backupId: detail.backupId,
|
||||
name: detail.restoreBackupName,
|
||||
})
|
||||
} else if (detail.type === "backupUpdate") {
|
||||
await backups.updateBackup({
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { Badge } from "@budibase/bbui"
|
||||
|
||||
export let value = "started"
|
||||
$: status = value.charAt(0).toUpperCase() + value.slice(1)
|
||||
$: status = value?.charAt(0).toUpperCase() + value?.slice(1)
|
||||
</script>
|
||||
|
||||
<Badge green={value === "complete"} red={value === "failed"} size="S">
|
||||
|
|
|
@ -15,8 +15,8 @@ export function createBackupsStore() {
|
|||
return API.searchBackups({ appId, trigger, page, startDate, endDate })
|
||||
}
|
||||
|
||||
async function restoreBackup({ appId, backupId }) {
|
||||
return API.restoreBackup({ appId, backupId })
|
||||
async function restoreBackup({ appId, backupId, name }) {
|
||||
return API.restoreBackup({ appId, backupId, name })
|
||||
}
|
||||
|
||||
async function deleteBackup({ appId, backupId }) {
|
||||
|
|
Loading…
Reference in New Issue