openConnection(e.detail)} bind:modalOpen={addressBarModalOpen} />
{#if host && connection}
({
id: dbKey,
collCount: Object.keys(connection.databases[dbKey].collections || {}).length || '',
children: Object.keys(connection.databases[dbKey].collections).map(collKey => ({
id: collKey,
menu: [ { label: `Drop ${collKey}`, fn: () => dropCollection(dbKey, collKey) } ],
})).sort((a, b) => a.id.localeCompare(b)) || [],
menu: [ { label: `Drop ${dbKey}`, fn: () => dropDatabase(dbKey) } ],
}))}
actions={[
{ icon: 'reload', fn: reload },
{ icon: '+', fn: evt => {
if (activeDbKey) {
contextMenu.show(evt, [
{ label: 'New database', fn: () => newDb = {} },
{ label: 'New collection', fn: () => newColl = {} },
]);
}
else {
newDb = {};
}
} },
{ icon: '-' },
]}
bind:activeKey={activeDbKey}
bind:activeChildKey={activeCollKey}
on:select={e => openDatabase(e.detail)}
on:selectChild={e => openCollection(e.detail)}
/>
{/if}