From eef74b306bceba2eb28dbf6879de44fdf35d2376 Mon Sep 17 00:00:00 2001 From: Romein van Buren Date: Sat, 24 Jun 2023 16:05:33 +0200 Subject: [PATCH] Made it possible to input loose JSON into find view inputs I.e. `{ key: 'val' }` or `{ 'num': 2 }` besides `{ "strict": "json" }`. --- CHANGELOG.md | 1 + frontend/src/organisms/connection/collection/find.svelte | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed1e8bf..45749c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## [Unreleased] * Open dump in Explorer/Finder when finished (#43). +* Made it possible (again) to input loose JSON into find view inputs, i.e. `{ key: 'val' }` or `{ 'num': 2 }` besides `{ "strict": "json" }`. ## [v0.2.1] diff --git a/frontend/src/organisms/connection/collection/find.svelte b/frontend/src/organisms/connection/collection/find.svelte index 6d9de76..97d2b9a 100644 --- a/frontend/src/organisms/connection/collection/find.svelte +++ b/frontend/src/organisms/connection/collection/find.svelte @@ -48,7 +48,13 @@ querying = `Querying ${collection.key}…`; activePath = []; - const newResult = await FindItems(collection.hostKey, collection.dbKey, collection.key, JSON.stringify(form)); + const newResult = await FindItems(collection.hostKey, collection.dbKey, collection.key, JSON.stringify({ + fields: convertLooseJson(form.fields || defaults.fields), + limit: form.limit ?? defaults.limit, + query: convertLooseJson(form.query) || defaults.query, + skip: form.skip ?? defaults.skip, + sort: convertLooseJson(form.sort) || defaults.sort, + })); if (newResult) { newResult.results = newResult.results?.map(s => EJSON.parse(s, { relaxed: false }));