Adding restore work - new modal to create a backup.
This commit is contained in:
parent
6256b5f73d
commit
1eac53230e
|
@ -6,8 +6,10 @@
|
||||||
Input,
|
Input,
|
||||||
Heading,
|
Heading,
|
||||||
Body,
|
Body,
|
||||||
|
Modal,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||||
|
import CreateRestoreModal from "./CreateRestoreModal.svelte"
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
import download from "downloadjs"
|
import download from "downloadjs"
|
||||||
import { backups } from "stores/portal"
|
import { backups } from "stores/portal"
|
||||||
|
@ -19,12 +21,14 @@
|
||||||
let updateDialog
|
let updateDialog
|
||||||
let name
|
let name
|
||||||
let restoreBackupName
|
let restoreBackupName
|
||||||
|
let restoreBackupModal
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
const onClickRestore = () => {
|
const onClickRestore = name => {
|
||||||
dispatch("buttonclick", {
|
dispatch("buttonclick", {
|
||||||
type: "backupRestore",
|
type: "backupRestore",
|
||||||
|
name,
|
||||||
backupId: row._id,
|
backupId: row._id,
|
||||||
restoreBackupName,
|
restoreBackupName,
|
||||||
})
|
})
|
||||||
|
@ -68,6 +72,10 @@
|
||||||
</ActionMenu>
|
</ActionMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Modal bind:this={restoreBackupModal}>
|
||||||
|
<CreateRestoreModal confirm={name => onClickRestore(name)} />
|
||||||
|
</Modal>
|
||||||
|
|
||||||
<ConfirmDialog
|
<ConfirmDialog
|
||||||
bind:this={deleteDialog}
|
bind:this={deleteDialog}
|
||||||
okText="Delete Backup"
|
okText="Delete Backup"
|
||||||
|
@ -81,8 +89,8 @@
|
||||||
|
|
||||||
<ConfirmDialog
|
<ConfirmDialog
|
||||||
bind:this={restoreDialog}
|
bind:this={restoreDialog}
|
||||||
okText="Restore Backup"
|
okText="Continue"
|
||||||
onOk={onClickRestore}
|
onOk={restoreBackupModal?.show}
|
||||||
title="Confirm Restore"
|
title="Confirm Restore"
|
||||||
warning={false}
|
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({
|
return await API.post({
|
||||||
url: `/api/apps/${appId}/backups/${backupId}/import`,
|
url: `/api/apps/${appId}/backups/${backupId}/import`,
|
||||||
|
body: { name },
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ export interface AppBackupQueueData {
|
||||||
}
|
}
|
||||||
import?: {
|
import?: {
|
||||||
backupId: string
|
backupId: string
|
||||||
|
nameForBackup: string
|
||||||
createdBy?: string
|
createdBy?: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue