mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 05:26:00 +00:00
26 lines
797 B
Svelte
26 lines
797 B
Svelte
<script lang="ts">
|
|
import _ from 'lodash';
|
|
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 || [])
|
|
.filter(conn => !conn.unsaved && (direction == 'target' ? !conn.isReadOnly : true))
|
|
.map(conn => ({
|
|
value: conn._id,
|
|
label: getConnectionLabel(conn),
|
|
})),
|
|
'label'
|
|
),
|
|
];
|
|
</script>
|
|
|
|
<FormSelectField {...$$restProps} options={connectionOptions} />
|