Add steps

This commit is contained in:
Adria Navarro 2023-06-13 11:15:32 +01:00
parent e6455d005b
commit 1baaab2875
1 changed files with 31 additions and 10 deletions

View File

@ -1,19 +1,36 @@
<script> <script>
import { import { ModalContent, Toggle, Body, InlineAlert } from "@budibase/bbui"
ModalContent,
Toggle,
Body,
InlineAlert,
Divider,
} from "@budibase/bbui"
export let app export let app
export let published export let published
let includeInternalTablesRows = true let includeInternalTablesRows = true
let encypt = true let encypt = true
$: title = published ? "Export published app" : "Export latest app" const Step = { CONFIG: "config", SET_PASSWORD: "set_password" }
$: confirmText = published ? "Export published" : "Export latest" let currentStep = Step.CONFIG
$: exportButtonText = published ? "Export published" : "Export latest"
$: stepConfig = {
[Step.CONFIG]: {
title: published ? "Export published app" : "Export latest app",
confirmText: encypt ? "Continue" : exportButtonText,
onConfirm: () => {
if (!encypt) {
exportApp()
} else {
currentStep = Step.SET_PASSWORD
return false
}
},
},
[Step.SET_PASSWORD]: {
title: "Add password to encrypt your export",
confirmText: exportButtonText,
onConfirm: () => {
exportApp()
},
},
}
const exportApp = () => { const exportApp = () => {
const id = published ? app.prodId : app.devId const id = published ? app.prodId : app.devId
@ -22,7 +39,11 @@
} }
</script> </script>
<ModalContent {title} {confirmText} onConfirm={exportApp}> <ModalContent
title={stepConfig[currentStep].title}
confirmText={stepConfig[currentStep].confirmText}
onConfirm={stepConfig[currentStep].onConfirm}
>
<Body> <Body>
<Toggle <Toggle
text="Export rows from internal tables" text="Export rows from internal tables"