1
0
Fork 0
mirror of synced 2024-06-02 02:25:17 +12:00

trigger internal table modal on modal cancel

This commit is contained in:
Peter Clement 2021-09-27 09:59:56 +01:00
parent ee367a42a6
commit 9e0b15e6a7
4 changed files with 29 additions and 7 deletions

View file

@ -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

View file

@ -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>

View file

@ -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>

View file

@ -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) {