trigger internal table modal on modal cancel
This commit is contained in:
parent
c67e769afc
commit
dad6412271
|
@ -14,6 +14,7 @@
|
|||
export let showConfirmButton = true
|
||||
export let showCloseIcon = true
|
||||
export let onConfirm = undefined
|
||||
export let onCancel = undefined
|
||||
export let disabled = false
|
||||
export let showDivider = true
|
||||
|
||||
|
@ -28,6 +29,14 @@
|
|||
}
|
||||
loading = false
|
||||
}
|
||||
|
||||
async function close() {
|
||||
loading = true
|
||||
if (!onCancel || (await onCancel()) !== false) {
|
||||
cancel()
|
||||
}
|
||||
loading = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
|
@ -65,7 +74,7 @@
|
|||
>
|
||||
<slot name="footer" />
|
||||
{#if showCancelButton}
|
||||
<Button group secondary on:click={cancel}>{cancelText}</Button>
|
||||
<Button group secondary on:click={close}>{cancelText}</Button>
|
||||
{/if}
|
||||
{#if showConfirmButton}
|
||||
<Button
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
confirmText="Continue"
|
||||
cancelText="Start from scratch"
|
||||
size="M"
|
||||
onCancel={() => internalTableModal.show()}
|
||||
onConfirm={() => {
|
||||
chooseNextModal()
|
||||
}}
|
||||
|
@ -86,9 +87,7 @@
|
|||
>
|
||||
<div class="item-body">
|
||||
<svelte:component this={ICONS.BUDIBASE} height="18" width="18" />
|
||||
<span class="icon-spacing">
|
||||
<Body size="S">Budibase DB (no prior data required)</Body></span
|
||||
>
|
||||
<span class="icon-spacing"> <Body size="S">Budibase DB</Body></span>
|
||||
</div>
|
||||
</div>
|
||||
</Layout>
|
||||
|
|
|
@ -27,15 +27,20 @@
|
|||
return datasource
|
||||
}
|
||||
async function saveDatasource() {
|
||||
let success = true
|
||||
try {
|
||||
// Create datasource
|
||||
const resp = await datasources.save(prepareData())
|
||||
|
||||
if (integration.plus) {
|
||||
updateDatasourceSchema(resp)
|
||||
fetchedSchema = updateDatasourceSchema(resp)
|
||||
}
|
||||
|
||||
if (!fetchedSchema) {
|
||||
return false
|
||||
}
|
||||
|
||||
await datasources.select(resp._id)
|
||||
$goto(`./datasource/${resp._id}`)
|
||||
notifications.success(`Datasource updated successfully.`)
|
||||
analytics.captureEvent(Events.DATASOURCE.CREATED, {
|
||||
name: resp.name,
|
||||
|
@ -43,6 +48,7 @@
|
|||
})
|
||||
} catch (err) {
|
||||
notifications.error(`Error saving datasource: ${err}`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,8 +56,10 @@
|
|||
try {
|
||||
await datasources.updateSchema(datasourceJson)
|
||||
await tables.fetch()
|
||||
return true
|
||||
} catch (err) {
|
||||
notifications.error(`Error updating datasource schema: ${err}`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -7,7 +7,13 @@
|
|||
let modal
|
||||
$: setupComplete =
|
||||
$datasources.list.find(x => (x._id = "bb_internal")).entities.length > 1 ||
|
||||
$datasources.list.length >= 1
|
||||
$datasources.list.length > 1
|
||||
|
||||
$: console.log(
|
||||
$datasources.list.find(x => (x._id = "bb_internal")).entities.length > 1
|
||||
)
|
||||
$: console.log($datasources.list.length >= 1)
|
||||
$: console.log($datasources.list)
|
||||
|
||||
onMount(() => {
|
||||
if (!setupComplete) {
|
||||
|
|
Loading…
Reference in New Issue