mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 12:26:01 +00:00
handle readonly connection in UI
This commit is contained in:
@@ -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'
|
||||
),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user