From 9811235be7e664d4917495ef6d461cb20d275992 Mon Sep 17 00:00:00 2001 From: Romein van Buren Date: Thu, 19 Jan 2023 20:57:22 +0100 Subject: [PATCH] Many at once - this seems a good time to commit --- frontend/src/components/grid-items.svelte | 36 ++++++---- frontend/src/components/grid.svelte | 12 +++- frontend/src/components/icon.svelte | 58 +++++++++------- frontend/src/components/modal.svelte | 7 +- frontend/src/components/objectgrid.svelte | 2 + frontend/src/components/tabbar.svelte | 11 ++- .../collection/find-viewconfig.svelte | 54 +++++++++++++++ .../connection/collection/find.svelte | 68 +++++++++++++++++-- frontend/src/reset.css | 4 ++ frontend/wailsjs/go/app/App.d.ts | 2 + frontend/wailsjs/go/app/App.js | 4 ++ internal/app/hosts.go | 52 ++++++++++++-- 12 files changed, 252 insertions(+), 58 deletions(-) create mode 100644 frontend/src/organisms/connection/collection/find-viewconfig.svelte diff --git a/frontend/src/components/grid-items.svelte b/frontend/src/components/grid-items.svelte index f21782c..598d809 100644 --- a/frontend/src/components/grid-items.svelte +++ b/frontend/src/components/grid-items.svelte @@ -11,14 +11,20 @@ export let activePath = []; export let level = 0; export let striped = true; + export let hideObjectIndicators = false; const dispatch = createEventDispatcher(); let childrenOpen = {}; + let _items = []; - $: _items = objectToArray(items).map(item => { - item.children = objectToArray(item.children); - return item; - }); + $: refresh(hideObjectIndicators, items); + + function refresh(hideObjectIndicators, items) { + _items = objectToArray(items).map(item => { + item.children = objectToArray(item.children); + return item; + }); + } function objectToArray(obj) { if (Array.isArray(obj)) { @@ -56,7 +62,7 @@ } function doubleClick(itemKey) { - toggleChildren(itemKey, false); + // toggleChildren(itemKey, false); dispatch('trigger', { level, itemKey }); } @@ -67,17 +73,20 @@ function formatValue(value) { if (Array.isArray(value)) { - return '[...]'; - } - if (typeof value === 'object') { - return '{...}'; - } - if (value === undefined || value === null) { - return ''; + return hideObjectIndicators ? '' : '[...]'; } if (typeof value === 'number' || typeof value === 'boolean') { return String(value); } + if ((value === undefined) || (value === null)) { + return ''; + } + if (new Date(value).toString() !== 'Invalid Date') { + return new Date(value); + } + if (typeof value === 'object') { + return hideObjectIndicators ? '' : '{...}'; + } if (String(value).length <= 1000) { return value; } @@ -118,6 +127,7 @@ {#if item.children && childrenOpen[item[key]]}
@@ -24,7 +25,16 @@ - +
diff --git a/frontend/src/components/icon.svelte b/frontend/src/components/icon.svelte index 05b851e..1c18de1 100644 --- a/frontend/src/components/icon.svelte +++ b/frontend/src/components/icon.svelte @@ -2,28 +2,36 @@ export let name = ''; -{#if name === 'radio'} - -{:else if name === 'chev-l'} - -{:else if name === 'chev-r'} - -{:else if name === 'chev-d'} - -{:else if name === 'db'} - -{:else if name === 'x'} - -{:else if name === '+'} - -{:else if name === '-'} - -{:else if name === 'reload'} - -{:else if name === 'clipboard'} - -{:else if name === 'edit'} - -{:else if name === 'check'} - -{/if} + + {#if name === 'radio'} + + {:else if name === 'chev-l'} + + {:else if name === 'chev-r'} + + {:else if name === 'chev-d'} + + {:else if name === 'db'} + + {:else if name === 'x'} + + {:else if name === '+'} + + {:else if name === '-'} + + {:else if name === 'reload'} + + {:else if name === 'clipboard'} + + {:else if name === 'edit'} + + {:else if name === 'check'} + + {:else if name === 'list'} + + {:else if name === 'table'} + + {:else if name === 'cog'} + + {/if} + diff --git a/frontend/src/components/modal.svelte b/frontend/src/components/modal.svelte index a410964..266b666 100644 --- a/frontend/src/components/modal.svelte +++ b/frontend/src/components/modal.svelte @@ -26,12 +26,13 @@ function keydown(event) { if ((event.key === 'Escape') && (level === numberOfModalsOpen)) { + event.preventDefault(); show = false; } } - + {#if show}