From d8f25c17f717793676eedebbb231abac9d2ab9ad Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Fri, 6 Jan 2023 14:32:42 +0100 Subject: [PATCH] fix --- packages/api/src/controllers/serverConnections.js | 4 ++++ packages/web/src/impexp/SourceTargetConfig.svelte | 14 +++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/api/src/controllers/serverConnections.js b/packages/api/src/controllers/serverConnections.js index ccdbefe1..5417a2ce 100644 --- a/packages/api/src/controllers/serverConnections.js +++ b/packages/api/src/controllers/serverConnections.js @@ -47,6 +47,9 @@ module.exports = { const existing = this.opened.find(x => x.conid == conid); if (existing) return existing; const connection = await connections.getCore({ conid }); + if (!connection) { + throw new Error(`Connection with conid="${conid}" not fund`); + } if (connection.passwordMode == 'askPassword' || connection.passwordMode == 'askUser') { throw new MissingCredentialsError({ conid, passwordMode: connection.passwordMode }); } @@ -110,6 +113,7 @@ module.exports = { listDatabases_meta: true, async listDatabases({ conid }, req) { + if (!conid) return []; testConnectionPermission(conid, req); const opened = await this.ensureOpened(conid); return opened.databases; diff --git a/packages/web/src/impexp/SourceTargetConfig.svelte b/packages/web/src/impexp/SourceTargetConfig.svelte index 900faa1e..a972af7e 100644 --- a/packages/web/src/impexp/SourceTargetConfig.svelte +++ b/packages/web/src/impexp/SourceTargetConfig.svelte @@ -21,7 +21,7 @@ import FormSchemaSelect from './FormSchemaSelect.svelte'; import FormTablesSelect from './FormTablesSelect.svelte'; import { findEngineDriver } from 'dbgate-tools'; -import AceEditor from '../query/AceEditor.svelte'; + import AceEditor from '../query/AceEditor.svelte'; export let direction; export let storageTypeField; @@ -139,17 +139,9 @@ import AceEditor from '../query/AceEditor.svelte';
Query
{#if $values.sourceQueryType == 'json'} - setFieldValue('sourceQuery', e.detail)} - mode="json" - /> + setFieldValue('sourceQuery', e.detail)} mode="json" /> {:else} - setFieldValue('sourceQuery', e.detail)} - {engine} - /> + setFieldValue('sourceQuery', e.detail)} {engine} /> {/if}
{/if}