diff --git a/frontend/src/components/grid.svelte b/frontend/src/components/grid.svelte index ff6d66c..06ac59b 100644 --- a/frontend/src/components/grid.svelte +++ b/frontend/src/components/grid.svelte @@ -1,10 +1,10 @@
- {#if actions?.length} + {#if showHeaders && columns.some(col => col.title)} @@ -59,14 +59,14 @@ background-color: #fff; } - .actions { + /* .actions { margin-bottom: 0.5rem; padding: 0.5rem; border-bottom: 1px solid #ccc; } .actions button { margin-right: 0.2rem; - } + } */ table { border-collapse: collapse; diff --git a/frontend/src/organisms/connection/hosttree.svelte b/frontend/src/organisms/connection/hosttree.svelte index a058d1c..89d1c13 100644 --- a/frontend/src/organisms/connection/hosttree.svelte +++ b/frontend/src/organisms/connection/hosttree.svelte @@ -1,5 +1,5 @@ dispatch('renameCollection', collKey) }, + { label: `Drop ${collKey}…`, fn: () => dropCollection(dbKey, collKey) }, + { separator: true }, + { label: 'New collection…', fn: () => dispatch('newCollection') }, + ], })) || [], - menu: buildMenu(hostKey, dbKey), + menu: [ + { label: `Drop database ${dbKey}…`, fn: () => dropDatabase(dbKey) }, + { separator: true }, + { label: 'New database…', fn: () => dispatch('newDatabase') }, + ], })), + menu: [ + { label: 'New database…', fn: () => dispatch('newDatabase') }, + { separator: true }, + { label: `Edit host ${hosts[hostKey].name}…`, fn: () => dispatch('editHost', hostKey) }, + ], }))} - actions={[ - { icon: 'reload', fn: reload }, - { icon: '+', fn: evt => contextMenu.show(evt, buildMenu(activeHostKey, activeDbKey, activeCollKey, 'new')) }, - { icon: 'edit', fn: evt => contextMenu.show(evt, buildMenu(activeHostKey, activeDbKey, activeCollKey, 'edit')), disabled: !activeHostKey }, - { icon: '-', fn: evt => contextMenu.show(evt, buildMenu(activeHostKey, activeDbKey, activeCollKey, 'drop')), disabled: !activeDbKey }, - ]} bind:activePath={activeGridPath} on:select={e => { const key = e.detail.itemKey; @@ -136,3 +122,12 @@ } }} /> + + diff --git a/frontend/src/organisms/connection/index.svelte b/frontend/src/organisms/connection/index.svelte index 24d99f0..e2f6608 100644 --- a/frontend/src/organisms/connection/index.svelte +++ b/frontend/src/organisms/connection/index.svelte @@ -75,18 +75,20 @@ onMount(getHosts); - newDb = {}} - on:newCollection={() => newColl = {}} - on:editHost={e => editHost(e.detail)} - on:editCollection={e => openEditCollModal(e.detail)} -/> +
+ newDb = {}} + on:newCollection={() => newColl = {}} + on:editHost={e => editHost(e.detail)} + on:renameCollection={e => openEditCollModal(e.detail)} + /> +