forked from tsai/budibase
committed by
GitHub
19 changed files with 111 additions and 73 deletions
@ -1 +0,0 @@ |
|||||
<slot /> |
|
||||
@ -1,36 +0,0 @@ |
|||||
<script> |
|
||||
import { store, backendUiStore } from "builderStore" |
|
||||
import { goto } from "@sveltech/routify" |
|
||||
import { onMount } from "svelte" |
|
||||
|
|
||||
$: instances = $store.appInstances |
|
||||
|
|
||||
async function selectDatabase(database) { |
|
||||
backendUiStore.actions.database.select(database) |
|
||||
} |
|
||||
|
|
||||
onMount(async () => { |
|
||||
if ($store.appInstances.length > 0) { |
|
||||
await selectDatabase($store.appInstances[0]) |
|
||||
$goto(`./${$backendUiStore.selectedDatabase._id}`) |
|
||||
} |
|
||||
}) |
|
||||
</script> |
|
||||
|
|
||||
<div class="root"> |
|
||||
<div class="node-view"> |
|
||||
<slot /> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<style> |
|
||||
.root { |
|
||||
height: 100%; |
|
||||
position: relative; |
|
||||
} |
|
||||
|
|
||||
.node-view { |
|
||||
overflow-y: auto; |
|
||||
flex: 1 1 auto; |
|
||||
} |
|
||||
</style> |
|
||||
@ -1,20 +0,0 @@ |
|||||
<script> |
|
||||
import { store, backendUiStore } from "builderStore" |
|
||||
import { goto } from "@sveltech/routify" |
|
||||
import { onMount } from "svelte" |
|
||||
|
|
||||
$: instances = $store.appInstances |
|
||||
|
|
||||
async function selectDatabase(database) { |
|
||||
backendUiStore.actions.database.select(database) |
|
||||
} |
|
||||
|
|
||||
onMount(async () => { |
|
||||
if ($store.appInstances.length > 0) { |
|
||||
await selectDatabase($store.appInstances[0]) |
|
||||
$goto(`../${$backendUiStore.selectedDatabase._id}`) |
|
||||
} |
|
||||
}) |
|
||||
</script> |
|
||||
|
|
||||
Please select a database |
|
||||
@ -1,6 +1,6 @@ |
|||||
<script> |
<script> |
||||
import { goto } from "@sveltech/routify" |
import { goto } from "@sveltech/routify" |
||||
$goto("../database") |
$goto("../model") |
||||
</script> |
</script> |
||||
|
|
||||
<!-- routify:options index=false --> |
<!-- routify:options index=false --> |
||||
|
|||||
@ -0,0 +1,14 @@ |
|||||
|
<script> |
||||
|
import { params } from "@sveltech/routify" |
||||
|
import { backendUiStore } from "builderStore" |
||||
|
|
||||
|
if ($params.selectedModel) { |
||||
|
const model = $backendUiStore.models.find(m => m._id === $params.selectedModel) |
||||
|
if (model) { |
||||
|
backendUiStore.actions.models.select(model) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<slot /> |
||||
@ -0,0 +1,35 @@ |
|||||
|
<script> |
||||
|
import { backendUiStore } from "builderStore" |
||||
|
import { goto, leftover } from "@sveltech/routify" |
||||
|
import { onMount } from "svelte" |
||||
|
|
||||
|
async function selectModel(model) { |
||||
|
backendUiStore.actions.models.select(model) |
||||
|
} |
||||
|
|
||||
|
onMount(async () => { |
||||
|
// navigate to first model in list, if not already selected |
||||
|
// and this is the final url (i.e. no selectedModel) |
||||
|
if (!$leftover && $backendUiStore.models.length > 0 && (!$backendUiStore.selectedModel || !$backendUiStore.selectedModel._id)) { |
||||
|
$goto(`./${$backendUiStore.models[0]._id}`) |
||||
|
} |
||||
|
}) |
||||
|
</script> |
||||
|
|
||||
|
<div class="root"> |
||||
|
<div class="node-view"> |
||||
|
<slot /> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<style> |
||||
|
.root { |
||||
|
height: 100%; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.node-view { |
||||
|
overflow-y: auto; |
||||
|
flex: 1 1 auto; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,24 @@ |
|||||
|
<script> |
||||
|
import { store, backendUiStore } from "builderStore" |
||||
|
import { goto, leftover } from "@sveltech/routify" |
||||
|
import { onMount } from "svelte" |
||||
|
|
||||
|
async function selectModel(model) { |
||||
|
backendUiStore.actions.models.select(model) |
||||
|
} |
||||
|
|
||||
|
onMount(async () => { |
||||
|
// navigate to first model in list, if not already selected |
||||
|
// and this is the final url (i.e. no selectedModel) |
||||
|
if (!$leftover && $backendUiStore.models.length > 0 && (!$backendUiStore.selectedModel || !$backendUiStore.selectedModel._id)) { |
||||
|
// this file routes as .../models/index, so, go up one. |
||||
|
$goto(`../${$backendUiStore.models[0]._id}`) |
||||
|
} |
||||
|
}) |
||||
|
</script> |
||||
|
|
||||
|
{#if $backendUiStore.models.length === 0} |
||||
|
Please create a model |
||||
|
{:else} |
||||
|
Please select a model |
||||
|
{/if} |
||||
Loading…
Reference in new issue