From 565a60e63807dcdfbfc945a367db7d48934b9174 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sun, 28 Feb 2021 21:16:08 +0100 Subject: [PATCH] app object list --- packages/web/public/global.css | 4 ++ packages/web/src/appobj/AppObjectCore.svelte | 3 +- packages/web/src/appobj/AppObjectGroup.svelte | 37 ++++++++++++++++++ packages/web/src/appobj/AppObjectList.svelte | 31 +++++++++++++-- .../web/src/appobj/AppObjectListItem.svelte | 38 +++++++++++++++++-- .../web/src/appobj/ConnectionAppObject.svelte | 6 ++- .../web/src/appobj/DatabaseAppObject.svelte | 4 ++ .../src/appobj/DatabaseObjectAppObject.svelte | 6 +++ packages/web/src/icons/ExpandIcon.svelte | 12 ++++++ packages/web/src/icons/FontIcon.svelte | 2 +- .../web/src/widgets/ConnectionList.svelte | 2 + packages/web/src/widgets/SqlObjectList.svelte | 11 +++++- 12 files changed, 142 insertions(+), 14 deletions(-) create mode 100644 packages/web/src/appobj/AppObjectGroup.svelte create mode 100644 packages/web/src/icons/ExpandIcon.svelte diff --git a/packages/web/public/global.css b/packages/web/public/global.css index d3679ddf..a5228d52 100644 --- a/packages/web/public/global.css +++ b/packages/web/public/global.css @@ -28,6 +28,10 @@ body { background-color: var(--theme-bg-2); } +.icon-invisible { + visibility: hidden; +} + /* html, body { position: relative; width: 100%; diff --git a/packages/web/src/appobj/AppObjectCore.svelte b/packages/web/src/appobj/AppObjectCore.svelte index 2d29ded0..5f07d3cc 100644 --- a/packages/web/src/appobj/AppObjectCore.svelte +++ b/packages/web/src/appobj/AppObjectCore.svelte @@ -6,7 +6,6 @@ export let title; export let isBold = false; - export let prefix = ''; export let isBusy = false; export let statusIcon = undefined; export let statusTitle = undefined; @@ -15,7 +14,7 @@
- {prefix} + {#if isBusy} {:else} diff --git a/packages/web/src/appobj/AppObjectGroup.svelte b/packages/web/src/appobj/AppObjectGroup.svelte new file mode 100644 index 00000000..9f71da4d --- /dev/null +++ b/packages/web/src/appobj/AppObjectGroup.svelte @@ -0,0 +1,37 @@ + + +
(isExpanded = !isExpanded)}> + {group} + {items && `(${countText})`} +
+ +{#if isExpanded} + {#each filtered as item (module.extractKey(item.data))} + + {/each} +{/if} + + diff --git a/packages/web/src/appobj/AppObjectList.svelte b/packages/web/src/appobj/AppObjectList.svelte index af4f7e6b..27330750 100644 --- a/packages/web/src/appobj/AppObjectList.svelte +++ b/packages/web/src/appobj/AppObjectList.svelte @@ -1,10 +1,14 @@ - -{#each filtered as data} - -{/each} +{#if groupFunc} + {#each _.keys(groups) as group (group)} + + {/each} +{:else} + {#each filtered as data (module.extractKey(data))} + + {/each} +{/if} diff --git a/packages/web/src/appobj/AppObjectListItem.svelte b/packages/web/src/appobj/AppObjectListItem.svelte index 93871929..1521cb1c 100644 --- a/packages/web/src/appobj/AppObjectListItem.svelte +++ b/packages/web/src/appobj/AppObjectListItem.svelte @@ -1,20 +1,52 @@ - +{#if subItemsComponent} + + + {#if expandable} + + {:else} + + {/if} + + +{:else} + +{/if} {#if isExpanded && subItemsComponent} - +
+ +
{/if} + + diff --git a/packages/web/src/appobj/ConnectionAppObject.svelte b/packages/web/src/appobj/ConnectionAppObject.svelte index 7dd1c4c1..c8773cc9 100644 --- a/packages/web/src/appobj/ConnectionAppObject.svelte +++ b/packages/web/src/appobj/ConnectionAppObject.svelte @@ -102,6 +102,8 @@ statusTitle={statusTitle || engineStatusTitle} {extInfo} menu={getContextMenu(data, $openedConnections)} - on:click on:click={() => ($openedConnections = _.uniq([...$openedConnections, data._id]))} -/> + on:click +> + + diff --git a/packages/web/src/appobj/DatabaseAppObject.svelte b/packages/web/src/appobj/DatabaseAppObject.svelte index 1e04fcef..3a1460f3 100644 --- a/packages/web/src/appobj/DatabaseAppObject.svelte +++ b/packages/web/src/appobj/DatabaseAppObject.svelte @@ -1,3 +1,7 @@ + + + + +{#if isBlank} + +{:else} + +{/if} diff --git a/packages/web/src/icons/FontIcon.svelte b/packages/web/src/icons/FontIcon.svelte index a815eb34..2ed5a29a 100644 --- a/packages/web/src/icons/FontIcon.svelte +++ b/packages/web/src/icons/FontIcon.svelte @@ -102,4 +102,4 @@ }; - + diff --git a/packages/web/src/widgets/ConnectionList.svelte b/packages/web/src/widgets/ConnectionList.svelte index 298301db..e0b94df6 100644 --- a/packages/web/src/widgets/ConnectionList.svelte +++ b/packages/web/src/widgets/ConnectionList.svelte @@ -8,6 +8,7 @@ import AppObjectList from '../appobj/AppObjectList.svelte'; import * as connectionAppObject from '../appobj/ConnectionAppObject.svelte'; import SubDatabaseList from '../appobj/SubDatabaseList.svelte'; + import { openedConnections } from '../stores'; const connections = useConnectionList(); const serverStatus = useServerStatus(); @@ -30,6 +31,7 @@ module={connectionAppObject} subItemsComponent={SubDatabaseList} expandOnClick + isExpandable={data => $openedConnections.includes(data._id)} {filter} /> diff --git a/packages/web/src/widgets/SqlObjectList.svelte b/packages/web/src/widgets/SqlObjectList.svelte index 328fcb89..82303651 100644 --- a/packages/web/src/widgets/SqlObjectList.svelte +++ b/packages/web/src/widgets/SqlObjectList.svelte @@ -12,6 +12,8 @@ export let conid; export let database; + let filter = ''; + $: objects = useDatabaseInfo({ conid, database }); $: status = useDatabaseStatus({ conid, database }); @@ -26,9 +28,14 @@ - + Refresh - ({ ...x, conid, database }))} module={databaseObjectAppObject} /> + ({ ...x, conid, database }))} + module={databaseObjectAppObject} + groupFunc={data => _.startCase(data.objectTypeField)} + {filter} + />