mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 18:06:01 +00:00
use svelte select
This commit is contained in:
23
packages/web/src/impexp/FormSchemaSelect.svelte
Normal file
23
packages/web/src/impexp/FormSchemaSelect.svelte
Normal file
@@ -0,0 +1,23 @@
|
||||
<script lang="ts">
|
||||
import { getFormContext } from '../forms/FormProviderCore.svelte';
|
||||
import FormSelectField from '../forms/FormSelectField.svelte';
|
||||
import { useDatabaseInfo, useDatabaseList } from '../utility/metadataLoaders';
|
||||
|
||||
export let conidName;
|
||||
export let databaseName;
|
||||
|
||||
const { values } = getFormContext();
|
||||
$: dbinfo = useDatabaseInfo({ conid: $values[conidName], database: values[databaseName] });
|
||||
|
||||
$: schemaOptions = (($dbinfo && $dbinfo.schemas) || []).map(schema => ({
|
||||
value: schema.schemaName,
|
||||
label: schema.schemaName,
|
||||
}));
|
||||
|
||||
</script>
|
||||
|
||||
{#if schemaOptions.length == 0}
|
||||
<div>Not available</div>
|
||||
{:else}
|
||||
<FormSelectField {...$$restProps} options={schemaOptions} />
|
||||
{/if}
|
||||
Reference in New Issue
Block a user