Quick fix for datasource deletion, due to the datasource defaulting to an empty object it appeared like a datasource had been set and the UI would attempt to render with this empty state. When not selected move off of the selected datasource page instead and handle the datasource not being selected.
This commit is contained in:
parent
bbda776c49
commit
1299917e94
|
@ -12,16 +12,25 @@
|
||||||
import PromptQueryModal from "./_components/PromptQueryModal.svelte"
|
import PromptQueryModal from "./_components/PromptQueryModal.svelte"
|
||||||
import SettingsPanel from "./_components/panels/Settings.svelte"
|
import SettingsPanel from "./_components/panels/Settings.svelte"
|
||||||
import { helpers } from "@budibase/shared-core"
|
import { helpers } from "@budibase/shared-core"
|
||||||
|
import { goto } from "@roxi/routify"
|
||||||
|
|
||||||
let selectedPanel = null
|
let selectedPanel = null
|
||||||
let panelOptions = []
|
let panelOptions = []
|
||||||
|
|
||||||
// datasources.selected can return null temporarily on datasource deletion
|
// datasources.selected can return null temporarily on datasource deletion
|
||||||
$: datasource = $datasources.selected || {}
|
$: datasource = $datasources.selected
|
||||||
|
$: {
|
||||||
|
if (!datasource) {
|
||||||
|
$goto("./datasource")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$: getOptions(datasource)
|
$: getOptions(datasource)
|
||||||
|
|
||||||
const getOptions = datasource => {
|
const getOptions = datasource => {
|
||||||
|
if (!datasource) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (datasource.plus) {
|
if (datasource.plus) {
|
||||||
// Google Sheets' integration definition specifies `relationships: false` as it doesn't support relationships like other plus datasources
|
// Google Sheets' integration definition specifies `relationships: false` as it doesn't support relationships like other plus datasources
|
||||||
panelOptions =
|
panelOptions =
|
||||||
|
@ -49,6 +58,7 @@
|
||||||
|
|
||||||
<PromptQueryModal />
|
<PromptQueryModal />
|
||||||
|
|
||||||
|
{#if datasource}
|
||||||
<section>
|
<section>
|
||||||
<Layout noPadding>
|
<Layout noPadding>
|
||||||
<Layout gap="XS" noPadding>
|
<Layout gap="XS" noPadding>
|
||||||
|
@ -94,6 +104,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
</Layout>
|
</Layout>
|
||||||
</section>
|
</section>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
section {
|
section {
|
||||||
|
|
Loading…
Reference in New Issue