From 10730d8053c139ec6951edf738aba8a7370bdc25 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 2 Jul 2021 14:33:05 +0100 Subject: [PATCH] Implementing UI to support the backend put in place. --- .../TableNavigator/TableNavigator.svelte | 5 +- .../CreateEditRelationship.svelte | 175 +++++++++++------- .../CreateEditRelationship/TableSelect.svelte | 8 +- .../[selectedDatasource]/index.svelte | 155 +++++++++++----- .../modals/EditDisplayColumnsModal.svelte | 38 ++++ packages/server/src/constants/definitions.ts | 4 +- packages/server/src/integrations/postgres.ts | 7 +- 7 files changed, 274 insertions(+), 118 deletions(-) create mode 100644 packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/modals/EditDisplayColumnsModal.svelte diff --git a/packages/builder/src/components/backend/TableNavigator/TableNavigator.svelte b/packages/builder/src/components/backend/TableNavigator/TableNavigator.svelte index 323d484fab..ac1d82bf67 100644 --- a/packages/builder/src/components/backend/TableNavigator/TableNavigator.svelte +++ b/packages/builder/src/components/backend/TableNavigator/TableNavigator.svelte @@ -10,9 +10,10 @@ export let sourceId - $: selectedView = $views.selected && $views.selected.name - $: sortedTables = $tables.list.filter(table => table.sourceId === sourceId).sort(alphabetical) + $: sortedTables = $tables.list + .filter(table => table.sourceId === sourceId) + .sort(alphabetical) function selectTable(table) { tables.select(table) diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/CreateEditRelationship/CreateEditRelationship.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/CreateEditRelationship/CreateEditRelationship.svelte index d038304547..f15d7b22f1 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/CreateEditRelationship/CreateEditRelationship.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/CreateEditRelationship/CreateEditRelationship.svelte @@ -1,25 +1,31 @@ - + + + + + {#if datasource && integration} @@ -119,9 +175,16 @@
Tables - +
+ {#if plusTables && plusTables.length !== 0} + + {/if} + +
This datasource can determine tables automatically. Budibase can fetch @@ -130,10 +193,7 @@
{#each plusTables as table} -
onClickTable(table)} - > +
onClickTable(table)}>

{table.name}

Primary Key: {table.primary}

@@ -141,30 +201,35 @@ {/each}
- +
Relationships - + +
+ + Tell budibase how your tables are related to get even more smart + features. + +
+ {#each Object.values(relationships) as relationship} +
+ openRelationshipModal(relationship.from, relationship.to)} + > +

+ {buildRelationshipDisplayString( + relationship.from, + relationship.to + )} +

+

{relationship.from?.name} to {relationship.to?.name}

+

+
+ {/each}
- - Tell budibase how your tables are related to get even more smart features. - -
- {#each plusTables as table} - {#each Object.keys(table.schema) as column} - {#if table.schema[column].type === "link" && table.schema[column].relationshipType !== RelationshipTypes.MANY_TO_ONE} -
openRelationshipModal(table.schema[column])}> -

{table.schema[column].name}

-

{buildRelationshipDisplayString(table, table.schema[column])}

-

-
- {/if} - {/each} - {/each} -
- {/if}
@@ -252,4 +317,10 @@ text-overflow: ellipsis; font-size: var(--font-size-s); } + + .table-buttons { + display: grid; + grid-gap: var(--spacing-l); + grid-template-columns:1fr 1fr; + } diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/modals/EditDisplayColumnsModal.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/modals/EditDisplayColumnsModal.svelte new file mode 100644 index 0000000000..7d2e6fdf0b --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/modals/EditDisplayColumnsModal.svelte @@ -0,0 +1,38 @@ + + + Select the columns that will be shown when displaying relationships. + {#each plusTables as table} +