2023-06-16 13:30:08 +02:00
|
|
|
<script>
|
2023-06-20 16:02:53 +02:00
|
|
|
import { Input, notifications } from "@budibase/bbui"
|
2023-06-16 13:30:08 +02:00
|
|
|
import { goto } from "@roxi/routify"
|
|
|
|
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
|
|
|
import { apps } from "stores/portal"
|
2023-10-30 13:46:44 +01:00
|
|
|
import { appStore } from "stores/frontend"
|
2023-06-16 13:30:08 +02:00
|
|
|
import { API } from "api"
|
|
|
|
|
|
|
|
export const show = () => {
|
|
|
|
deletionModal.show()
|
|
|
|
}
|
|
|
|
|
|
|
|
export const hide = () => {
|
|
|
|
deletionModal.hide()
|
|
|
|
}
|
|
|
|
|
|
|
|
let deletionModal
|
|
|
|
let deletionConfirmationAppName
|
|
|
|
|
|
|
|
const deleteApp = async () => {
|
|
|
|
try {
|
2023-10-30 13:46:44 +01:00
|
|
|
await API.deleteApp($appStore.appId)
|
2023-06-16 13:30:08 +02:00
|
|
|
apps.load()
|
|
|
|
notifications.success("App deleted successfully")
|
|
|
|
$goto("/builder")
|
|
|
|
} catch (err) {
|
|
|
|
notifications.error("Error deleting app")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<ConfirmDialog
|
|
|
|
bind:this={deletionModal}
|
|
|
|
title="Delete app"
|
|
|
|
okText="Delete"
|
|
|
|
onOk={deleteApp}
|
|
|
|
onCancel={() => (deletionConfirmationAppName = null)}
|
2023-10-30 13:46:44 +01:00
|
|
|
disabled={deletionConfirmationAppName !== $appStore.name}
|
2023-06-16 13:30:08 +02:00
|
|
|
>
|
2023-10-30 13:46:44 +01:00
|
|
|
Are you sure you want to delete <b>{$appStore.name}</b>?
|
2023-06-16 13:30:08 +02:00
|
|
|
<br />
|
|
|
|
Please enter the app name below to confirm.
|
|
|
|
<br /><br />
|
2023-10-30 13:46:44 +01:00
|
|
|
<Input
|
|
|
|
bind:value={deletionConfirmationAppName}
|
|
|
|
placeholder={$appStore.name}
|
|
|
|
/>
|
2023-06-16 13:30:08 +02:00
|
|
|
</ConfirmDialog>
|