From 3df2e1a445598b233f34dbb4262ab6bd94796b49 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Wed, 25 May 2022 20:33:56 +0200 Subject: [PATCH] portal connection fix --- packages/api/env/portal/.env | 9 ++++++++- packages/web/src/appobj/ConnectionAppObject.svelte | 5 ++++- packages/web/src/widgets/ConnectionList.svelte | 5 +++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/api/env/portal/.env b/packages/api/env/portal/.env index 1ff16412..6d85d69e 100644 --- a/packages/api/env/portal/.env +++ b/packages/api/env/portal/.env @@ -1,6 +1,6 @@ DEVMODE=1 -CONNECTIONS=mysql,postgres,mongo,mongo2,mysqlssh,sqlite +CONNECTIONS=mysql,postgres,mongo,mongo2,mysqlssh,sqlite,relational LABEL_mysql=MySql localhost SERVER_mysql=localhost @@ -41,4 +41,11 @@ LABEL_sqlite=sqlite FILE_sqlite=/home/jena/.dbgate/files/sqlite/feeds.sqlite ENGINE_sqlite=sqlite@dbgate-plugin-sqlite +LABEL_relational=Relational dataset repo +SERVER_relational=relational.fit.cvut.cz +USER_relational=guest +PASSWORD_relational=relational +ENGINE_relational=mariadb@dbgate-plugin-mysql +READONLY_relational=1 + # docker run -p 3000:3000 -e CONNECTIONS=mongo -e URL_mongo=mongodb://localhost:27017 -e ENGINE_mongo=mongo@dbgate-plugin-mongo -e LABEL_mongo=mongo dbgate/dbgate:beta diff --git a/packages/web/src/appobj/ConnectionAppObject.svelte b/packages/web/src/appobj/ConnectionAppObject.svelte index e54b71af..907ae495 100644 --- a/packages/web/src/appobj/ConnectionAppObject.svelte +++ b/packages/web/src/appobj/ConnectionAppObject.svelte @@ -12,6 +12,7 @@ return filterName(filter, ...databases.map(x => x.name)); }; export function openConnection(connection) { + const config = getCurrentConfig(); if (connection.singleDatabase) { currentDatabase.set({ connection, name: connection.defaultDatabase }); apiCall('database-connections/refresh', { @@ -26,7 +27,9 @@ conid: connection._id, keepOpen: true, }); - expandedConnections.update(x => _.uniq([...x, connection._id])); + if (!config.runAsPortal) { + expandedConnections.update(x => _.uniq([...x, connection._id])); + } } closeMultipleTabs(x => x.tabComponent == 'ConnectionTab' && x.props?.conid == connection._id, true); } diff --git a/packages/web/src/widgets/ConnectionList.svelte b/packages/web/src/widgets/ConnectionList.svelte index fdec4ea3..0682db65 100644 --- a/packages/web/src/widgets/ConnectionList.svelte +++ b/packages/web/src/widgets/ConnectionList.svelte @@ -64,8 +64,9 @@ {filter} passProps={{ connectionColorFactory: $connectionColorFactory, showPinnedInsteadOfUnpin: true }} getIsExpanded={data => $expandedConnections.includes(data._id) && !data.singleDatabase} - setIsExpanded={(data, value) => - expandedConnections.update(old => (value ? [...old, data._id] : old.filter(x => x != data._id)))} + setIsExpanded={(data, value) => { + expandedConnections.update(old => (value ? [...old, data._id] : old.filter(x => x != data._id))); + }} /> {#if $connections && !$connections.find(x => !x.unsaved) && $openedConnections.length == 0 && $commandsCustomized['new.connection']?.enabled && !$openedTabs.find(x => !x.closedTime && x.tabComponent == 'ConnectionTab' && !x.props?.conid)} runCommand('new.connection')} fillHorizontal