This commit is contained in:
Jan Prochazka 2023-01-06 14:32:42 +01:00
parent f6173335da
commit d8f25c17f7
2 changed files with 7 additions and 11 deletions

View File

@ -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;

View File

@ -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';
<div class="label">Query</div>
<div class="sqlwrap">
{#if $values.sourceQueryType == 'json'}
<AceEditor
value={$values.sourceQuery}
on:input={e => setFieldValue('sourceQuery', e.detail)}
mode="json"
/>
<AceEditor value={$values.sourceQuery} on:input={e => setFieldValue('sourceQuery', e.detail)} mode="json" />
{:else}
<SqlEditor
value={$values.sourceQuery}
on:input={e => setFieldValue('sourceQuery', e.detail)}
{engine}
/>
<SqlEditor value={$values.sourceQuery} on:input={e => setFieldValue('sourceQuery', e.detail)} {engine} />
{/if}
</div>
{/if}