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