diff --git a/packages/web/src/appobj/ConnectionAppObject.svelte b/packages/web/src/appobj/ConnectionAppObject.svelte index c3b415b2a..5ff11e381 100644 --- a/packages/web/src/appobj/ConnectionAppObject.svelte +++ b/packages/web/src/appobj/ConnectionAppObject.svelte @@ -254,11 +254,10 @@ text: 'Create database', onClick: handleCreateDatabase, }, - $openedConnections.includes(data._id) && - driver?.supportsServerSummary && { - text: 'Server summary', - onClick: handleServerSummary, - }, + driver?.supportsServerSummary && { + text: 'Server summary', + onClick: handleServerSummary, + }, ], data.singleDatabase && [ { divider: true }, diff --git a/packages/web/src/tabs/ServerSummaryTab.svelte b/packages/web/src/tabs/ServerSummaryTab.svelte index 05c176fb3..558f15cd2 100644 --- a/packages/web/src/tabs/ServerSummaryTab.svelte +++ b/packages/web/src/tabs/ServerSummaryTab.svelte @@ -38,7 +38,7 @@ } async function runAction(action, row) { - const { command, openQuery } = action; + const { command, openQuery, openTab, addDbProps } = action; if (command) { await apiCall('server-connections/summary-command', { conid, refreshToken, command, row }); refresh(); @@ -55,6 +55,20 @@ }, }); } + if (openTab) { + const props = {}; + if (addDbProps) { + props['conid'] = conid; + props['database'] = row.name; + } + openNewTab({ + ...openTab, + props: { + ...openTab.props, + ...props, + }, + }); + } } @@ -77,7 +91,7 @@ {#each col.actions as action, index} {#if index > 0} - | + | {/if} runAction(action, row)}>{action.header} {/each} @@ -101,4 +115,8 @@ background-color: var(--theme-bg-0); overflow: auto; } + + .action-separator { + margin: 0 5px; + } diff --git a/plugins/dbgate-plugin-mongo/src/backend/driver.js b/plugins/dbgate-plugin-mongo/src/backend/driver.js index fbc2f6de6..0621fab16 100644 --- a/plugins/dbgate-plugin-mongo/src/backend/driver.js +++ b/plugins/dbgate-plugin-mongo/src/backend/driver.js @@ -417,10 +417,22 @@ const driver = { header: 'All', command: 'profileAll', }, + // { + // header: 'View', + // openQuery: "db['system.profile'].find()", + // tabTitle: 'Profile data', + // }, { header: 'View', - openQuery: "db['system.profile'].find()", - tabTitle: 'Profile data', + openTab: { + title: 'system.profile', + icon: 'img collection', + tabComponent: 'CollectionDataTab', + props: { + pureName: 'system.profile', + }, + }, + addDbProps: true, }, ], },