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