Merge branch 'feature/opinionated-sql' of github.com:Budibase/budibase into feature/opinionated-sql
This commit is contained in:
commit
4e47f22720
|
@ -27,11 +27,7 @@
|
||||||
<div class="tab-content-padding">
|
<div class="tab-content-padding">
|
||||||
<DatasourceNavigator />
|
<DatasourceNavigator />
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
{#if isExternal}
|
|
||||||
<CreateDatasourceModal />
|
<CreateDatasourceModal />
|
||||||
{:else}
|
|
||||||
<CreateTableModal />
|
|
||||||
{/if}
|
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
try {
|
try {
|
||||||
// Create datasource
|
// Create datasource
|
||||||
await datasources.save(datasource)
|
await datasources.save(datasource)
|
||||||
notifications.success(`Datasource ${name} saved successfully.`)
|
notifications.success(`Datasource ${name} updated successfully.`)
|
||||||
unsaved = false
|
unsaved = false
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
notifications.error(`Error saving datasource: ${err}`)
|
notifications.error(`Error saving datasource: ${err}`)
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
async function updateDatasourceSchema() {
|
async function updateDatasourceSchema() {
|
||||||
try {
|
try {
|
||||||
await datasources.updateSchema(datasource)
|
await datasources.updateSchema(datasource)
|
||||||
notifications.success(`Datasource ${name} schema saved successfully.`)
|
notifications.success(`Datasource ${name} tables updated successfully.`)
|
||||||
unsaved = false
|
unsaved = false
|
||||||
await tables.fetch()
|
await tables.fetch()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -44,6 +44,11 @@
|
||||||
$goto(`./${query._id}`)
|
$goto(`./${query._id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onClickTable(table) {
|
||||||
|
tables.select(table)
|
||||||
|
$goto(`../../table/${table._id}`)
|
||||||
|
}
|
||||||
|
|
||||||
function setUnsaved() {
|
function setUnsaved() {
|
||||||
unsaved = true
|
unsaved = true
|
||||||
}
|
}
|
||||||
|
@ -86,6 +91,27 @@
|
||||||
on:change={setUnsaved}
|
on:change={setUnsaved}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{#if datasource.plus}
|
||||||
|
<Divider />
|
||||||
|
<div class="query-header">
|
||||||
|
<Heading size="S">Tables</Heading>
|
||||||
|
<Button primary on:click={updateDatasourceSchema}
|
||||||
|
>Fetch Tables From Database</Button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<Body>
|
||||||
|
This datasource can determine tables automatically. Budibase can fetch your tables directly from the database and you can use them without having to write any queries at all.
|
||||||
|
</Body>
|
||||||
|
<div class="query-list">
|
||||||
|
{#each Object.keys(datasource.entities) as entity}
|
||||||
|
<div class="query-list-item" on:click={() => onClickTable(datasource.entities[entity])}>
|
||||||
|
<p class="query-name">{entity}</p>
|
||||||
|
<p>Primary Key: {datasource.entities[entity].primary}</p>
|
||||||
|
<p>→</p>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<Divider />
|
<Divider />
|
||||||
<div class="query-header">
|
<div class="query-header">
|
||||||
<Heading size="S">Queries</Heading>
|
<Heading size="S">Queries</Heading>
|
||||||
|
@ -100,15 +126,6 @@
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{#if datasource.plus}
|
|
||||||
<Divider />
|
|
||||||
<div class="query-header">
|
|
||||||
<Heading size="S">Queries</Heading>
|
|
||||||
<Button cta on:click={updateDatasourceSchema}
|
|
||||||
>Fetch Tables From Database</Button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</Layout>
|
</Layout>
|
||||||
</section>
|
</section>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -1 +1,25 @@
|
||||||
This is the budibase internal database
|
<script>
|
||||||
|
import { Button, Heading, Body, Layout, Modal } from "@budibase/bbui"
|
||||||
|
import CreateTableModal from "components/backend/TableNavigator/modals/CreateTableModal.svelte"
|
||||||
|
|
||||||
|
let modal
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Modal bind:this={modal}>
|
||||||
|
<CreateTableModal />
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<Heading>
|
||||||
|
Budibase Internal DB
|
||||||
|
</Heading>
|
||||||
|
|
||||||
|
<Body>
|
||||||
|
Stuff about the internal table
|
||||||
|
</Body>
|
||||||
|
|
||||||
|
<Button cta on:click={modal.show}>Create new table</Button>
|
||||||
|
|
||||||
|
</Layout>
|
|
@ -60,7 +60,7 @@ exports.StaticDatabases = {
|
||||||
const BudibaseInternalDB = {
|
const BudibaseInternalDB = {
|
||||||
_id: "bb_internal",
|
_id: "bb_internal",
|
||||||
type: "budibase",
|
type: "budibase",
|
||||||
name: "Budibase Internal",
|
name: "Budibase DB",
|
||||||
source: "BUDIBASE",
|
source: "BUDIBASE",
|
||||||
config: {},
|
config: {},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue