diff --git a/packages/web/src/appobj/ConnectionAppObject.svelte b/packages/web/src/appobj/ConnectionAppObject.svelte index 61c7dba89..ada422a2b 100644 --- a/packages/web/src/appobj/ConnectionAppObject.svelte +++ b/packages/web/src/appobj/ConnectionAppObject.svelte @@ -123,6 +123,7 @@ import { getConnectionLabel } from 'dbgate-tools'; import hasPermission from '../utility/hasPermission'; import { switchCurrentDatabase } from '../utility/common'; + import { getConnectionClickActionSetting } from '../settings/settingsTools'; export let data; export let passProps; @@ -184,16 +185,24 @@ }); const config = getCurrentConfig(); - if (config.runAsPortal == false && !config.storageDatabase) { - openNewTab({ - title: getConnectionLabel(data), - icon: 'img connection', - tabComponent: 'ConnectionTab', - tabPreviewMode: true, - props: { - conid: data._id, - }, - }); + + const connectionClickAction = getConnectionClickActionSetting(); + if (connectionClickAction == 'openDetails') { + if (config.runAsPortal == false && !config.storageDatabase) { + openNewTab({ + title: getConnectionLabel(data), + icon: 'img connection', + tabComponent: 'ConnectionTab', + tabPreviewMode: true, + props: { + conid: data._id, + }, + }); + } + } + if (connectionClickAction == 'connect') { + await tick(); + handleConnect(); } }; diff --git a/packages/web/src/appobj/DatabaseAppObject.svelte b/packages/web/src/appobj/DatabaseAppObject.svelte index bc76ee360..113bab9bf 100644 --- a/packages/web/src/appobj/DatabaseAppObject.svelte +++ b/packages/web/src/appobj/DatabaseAppObject.svelte @@ -351,11 +351,13 @@ await dbgateApi.dropAllDbObjects(${JSON.stringify( text: `New ${driver?.collectionSingularLabel ?? 'collection/container'}`, }, hasPermission(`dbops/query`) && - driver?.databaseEngineTypes?.includes('sql') && isProApp() && { onClick: handleQueryDesigner, text: 'Design query' }, - driver?.databaseEngineTypes?.includes('sql') && isProApp() && { - onClick: handleNewPerspective, - text: 'Design perspective query', - }, + driver?.databaseEngineTypes?.includes('sql') && + isProApp() && { onClick: handleQueryDesigner, text: 'Design query' }, + driver?.databaseEngineTypes?.includes('sql') && + isProApp() && { + onClick: handleNewPerspective, + text: 'Design perspective query', + }, connection.useSeparateSchemas && { onClick: handleRefreshSchemas, text: 'Refresh schemas' }, { divider: true }, @@ -486,6 +488,7 @@ await dbgateApi.dropAllDbObjects(${JSON.stringify( import ChooseArchiveFolderModal from '../modals/ChooseArchiveFolderModal.svelte'; import { extractShellConnection } from '../impexp/createImpExpScript'; import { getNumberIcon } from '../icons/FontIcon.svelte'; + import { getDatabaseClickActionSetting } from '../settings/settingsTools'; export let data; export let passProps; @@ -523,6 +526,9 @@ await dbgateApi.dropAllDbObjects(${JSON.stringify( on:click={() => { // switchCurrentDatabase(data); $focusedConnectionOrDatabase = { conid: data.connection?._id, database: data.name, connection: data.connection }; + if (getDatabaseClickActionSetting() == 'switch') { + switchCurrentDatabase(data); + } }} on:dragstart on:dragenter diff --git a/packages/web/src/settings/SettingsModal.svelte b/packages/web/src/settings/SettingsModal.svelte index 089b2ed61..a59fcafbe 100644 --- a/packages/web/src/settings/SettingsModal.svelte +++ b/packages/web/src/settings/SettingsModal.svelte @@ -278,6 +278,30 @@ ORDER BY
Default actions
+ + + + + {#if $commandsCustomized['new.connection']?.enabled} - runCommand('new.connection')} title="Add new connection" data-testid="ConnectionList_buttonNewConnection"> + runCommand('new.connection')} + title="Add new connection" + data-testid="ConnectionList_buttonNewConnection" + > runCommand('new.connection.folder')} title="Add new connection folder"> @@ -235,6 +240,8 @@ domFilter?.focus(text); }} handleObjectClick={(data, options) => { + const connectionClickAction = getConnectionClickActionSetting(); + if (data.database) { if (options.focusTab) { if ($openedSingleDatabaseConnections.includes(data.conid)) { @@ -250,7 +257,7 @@ openConnection(data.connection); } else { const config = getCurrentConfig(); - if (config.runAsPortal == false && !config.storageDatabase) { + if (config.runAsPortal == false && !config.storageDatabase && connectionClickAction == 'openDetails') { openNewTab({ title: getConnectionLabel(data.connection), icon: 'img connection',