From 8bebdfccd857a0975be9b965f174f461dbc8e6d3 Mon Sep 17 00:00:00 2001 From: Romein van Buren Date: Sun, 25 Jun 2023 08:16:31 +0200 Subject: [PATCH] Small frontend fixes --- frontend/src/components/forminput.svelte | 2 +- frontend/src/components/grid-items.svelte | 4 +- .../connection/collection/find.svelte | 42 ++++++++++++++----- .../connection/collection/insert.svelte | 14 +++---- 4 files changed, 42 insertions(+), 20 deletions(-) diff --git a/frontend/src/components/forminput.svelte b/frontend/src/components/forminput.svelte index a3f7193..9d2498a 100644 --- a/frontend/src/components/forminput.svelte +++ b/frontend/src/components/forminput.svelte @@ -70,7 +70,7 @@
{#if type === 'string'} - + {:else if type === 'objectid'} { - item.children = objectToArray(item.children); + if (item.children) { + item.children = objectToArray(item.children); + } return item; }); diff --git a/frontend/src/organisms/connection/collection/find.svelte b/frontend/src/organisms/connection/collection/find.svelte index 97d2b9a..5207f3f 100644 --- a/frontend/src/organisms/connection/collection/find.svelte +++ b/frontend/src/organisms/connection/collection/find.svelte @@ -169,22 +169,41 @@ Query or id + />
@@ -242,9 +263,11 @@ {:else} { - return { key: c.key, title: c.key }; - }) || []} + columns={$views[collection.viewKey]?.columns + ?.filter(c => c.showInTable) + .map(c => { + return { key: c.key, title: c.key }; + }) || []} showHeaders={true} items={result.results ? result.results.map(r => EJSON.deserialize(r)) : []} bind:activePath @@ -295,7 +318,6 @@
{#if objectViewerData} - {/if} diff --git a/frontend/src/organisms/connection/collection/insert.svelte b/frontend/src/organisms/connection/collection/insert.svelte index 9387c25..f75bcad 100644 --- a/frontend/src/organisms/connection/collection/insert.svelte +++ b/frontend/src/organisms/connection/collection/insert.svelte @@ -73,12 +73,7 @@ } function showJson() { - if (viewType === 'form') { - objectViewerData = { ...(newItems[0] || {}) }; - } - else if (viewType === 'table') { - objectViewerData = [ ...newItems ]; - } + objectViewerData = [ ...newItems ]; } function addRow(beforeIndex = -1) { @@ -151,7 +146,6 @@
inputTypes.includes(c.inputType)) .map(c => { @@ -162,7 +156,9 @@ canRemoveItems={true} hideChildrenToggles={true} on:addRow={addRow} + on:removeItem={() => deleteRow()} bind:inputsValid={allValid} + bind:items={newItems} />
{/if} @@ -209,7 +205,9 @@ - +{#if objectViewerData} + +{/if}