From 626bc5e9dd0ded315cb0e66881022fc1a2c745b4 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 17 Jun 2021 11:40:01 +0100 Subject: [PATCH] better UI flow, list tables underneath datasources --- .../app/[application]/data/_layout.svelte | 4 -- .../[selectedDatasource]/index.svelte | 39 +++++++++++++------ .../data/datasource/bb_internal/index.svelte | 26 ++++++++++++- packages/server/src/db/utils.js | 2 +- 4 files changed, 54 insertions(+), 17 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte index bc582e5544..cdf02d8eb4 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte @@ -27,11 +27,7 @@
- {#if isExternal} - {:else} - - {/if}
diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte index 8d91795d35..cd3ef1f5c5 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte @@ -21,7 +21,7 @@ try { // Create datasource await datasources.save(datasource) - notifications.success(`Datasource ${name} saved successfully.`) + notifications.success(`Datasource ${name} updated successfully.`) unsaved = false } catch (err) { notifications.error(`Error saving datasource: ${err}`) @@ -31,7 +31,7 @@ async function updateDatasourceSchema() { try { await datasources.updateSchema(datasource) - notifications.success(`Datasource ${name} schema saved successfully.`) + notifications.success(`Datasource ${name} tables updated successfully.`) unsaved = false await tables.fetch() } catch (err) { @@ -44,6 +44,11 @@ $goto(`./${query._id}`) } + function onClickTable(table) { + tables.select(table) + $goto(`../../table/${table._id}`) + } + function setUnsaved() { unsaved = true } @@ -86,6 +91,27 @@ on:change={setUnsaved} /> + {#if datasource.plus} + +
+ Tables + +
+ + 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. + +
+ {#each Object.keys(datasource.entities) as entity} +
onClickTable(datasource.entities[entity])}> +

{entity}

+

Primary Key: {datasource.entities[entity].primary}

+

+
+ {/each} +
+ {/if}
Queries @@ -100,15 +126,6 @@
{/each} - {#if datasource.plus} - -
- Queries - -
- {/if} {/if} diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/bb_internal/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/bb_internal/index.svelte index 4029d2fbd6..20033d7faa 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/bb_internal/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/bb_internal/index.svelte @@ -1 +1,25 @@ -This is the budibase internal database \ No newline at end of file + + + + + + + + + Budibase Internal DB + + + + Stuff about the internal table + + + + + \ No newline at end of file diff --git a/packages/server/src/db/utils.js b/packages/server/src/db/utils.js index d382bdbccc..74ddf87176 100644 --- a/packages/server/src/db/utils.js +++ b/packages/server/src/db/utils.js @@ -60,7 +60,7 @@ exports.StaticDatabases = { const BudibaseInternalDB = { _id: "bb_internal", type: "budibase", - name: "Budibase Internal", + name: "Budibase DB", source: "BUDIBASE", config: {}, }