Adding restore work - new modal to create a backup.
This commit is contained in:
parent
7f1233576b
commit
b4a223be3d
|
@ -6,8 +6,10 @@
|
|||
Input,
|
||||
Heading,
|
||||
Body,
|
||||
Modal,
|
||||
} from "@budibase/bbui"
|
||||
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"
|
||||
|
@ -19,12 +21,14 @@
|
|||
let updateDialog
|
||||
let name
|
||||
let restoreBackupName
|
||||
let restoreBackupModal
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
const onClickRestore = () => {
|
||||
const onClickRestore = name => {
|
||||
dispatch("buttonclick", {
|
||||
type: "backupRestore",
|
||||
name,
|
||||
backupId: row._id,
|
||||
restoreBackupName,
|
||||
})
|
||||
|
@ -68,6 +72,10 @@
|
|||
</ActionMenu>
|
||||
</div>
|
||||
|
||||
<Modal bind:this={restoreBackupModal}>
|
||||
<CreateRestoreModal confirm={name => onClickRestore(name)} />
|
||||
</Modal>
|
||||
|
||||
<ConfirmDialog
|
||||
bind:this={deleteDialog}
|
||||
okText="Delete Backup"
|
||||
|
@ -81,8 +89,8 @@
|
|||
|
||||
<ConfirmDialog
|
||||
bind:this={restoreDialog}
|
||||
okText="Restore Backup"
|
||||
onOk={onClickRestore}
|
||||
okText="Continue"
|
||||
onOk={restoreBackupModal?.show}
|
||||
title="Confirm Restore"
|
||||
warning={false}
|
||||
>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<script>
|
||||
import { ModalContent, Input, Body } from "@budibase/bbui"
|
||||
|
||||
export let confirm
|
||||
|
||||
let name
|
||||
</script>
|
||||
|
||||
<ModalContent
|
||||
onConfirm={() => confirm(name)}
|
||||
title="Backup your current version"
|
||||
confirmText="Confirm Restore"
|
||||
>
|
||||
<Body size="S"
|
||||
>Create a backup of your current app to allow you to roll back after
|
||||
restoring this backup</Body
|
||||
>
|
||||
<Input label="Backup name" bind:value={name} />
|
||||
</ModalContent>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -40,9 +40,10 @@ export const buildBackupsEndpoints = API => ({
|
|||
})
|
||||
},
|
||||
|
||||
restoreBackup: async ({ appId, backupId }) => {
|
||||
restoreBackup: async ({ appId, backupId, name }) => {
|
||||
return await API.post({
|
||||
url: `/api/apps/${appId}/backups/${backupId}/import`,
|
||||
body: { name },
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ export interface AppBackupQueueData {
|
|||
}
|
||||
import?: {
|
||||
backupId: string
|
||||
nameForBackup: string
|
||||
createdBy?: string
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue