handle readonly connection in UI

This commit is contained in:
Jan Prochazka
2022-03-17 12:37:17 +01:00
parent 34658e134f
commit 267e687e2b
16 changed files with 52 additions and 19 deletions

View File

@@ -3,16 +3,20 @@
import FormSelectField from '../forms/FormSelectField.svelte';
import getConnectionLabel from '../utility/getConnectionLabel';
import { useConnectionList } from '../utility/metadataLoaders';
export let allowChooseModel = false;
export let direction;
$: connections = useConnectionList();
$: connectionOptions = [
...(allowChooseModel ? [{ label: '(DB Model)', value: '__model' }] : []),
..._.sortBy(
($connections || []).map(conn => ({
value: conn._id,
label: getConnectionLabel(conn),
})),
($connections || [])
.filter(conn => (direction == 'target' ? !conn.isReadOnly : true))
.map(conn => ({
value: conn._id,
label: getConnectionLabel(conn),
})),
'label'
),
];

View File

@@ -114,7 +114,7 @@
/>
{#if storageType == 'database' || storageType == 'query'}
<FormConnectionSelect name={connectionIdField} label="Server" />
<FormConnectionSelect name={connectionIdField} label="Server" {direction} />
<FormDatabaseSelect conidName={connectionIdField} name={databaseNameField} label="Database" />
{/if}
{#if storageType == 'database'}