Adding error scenario for table name already in use.

This commit is contained in:
mike12345567 2021-11-01 16:03:53 +00:00
parent 835b0efe74
commit 7efa06901e
1 changed files with 4 additions and 3 deletions

View File

@ -6,8 +6,9 @@
export let datasource export let datasource
let name = "" let name = ""
$: valid = name && name.length > 0 && !datasource?.entities[name]
$: valid = name && name.length > 0 $: error =
name && datasource?.entities[name] ? "Table name already in use." : null
function buildDefaultTable(tableName, datasourceId) { function buildDefaultTable(tableName, datasourceId) {
return { return {
@ -40,5 +41,5 @@
<Body <Body
>Provide a name for your new table; you can add columns once it is created.</Body >Provide a name for your new table; you can add columns once it is created.</Body
> >
<Input label="Table Name" bind:value={name} /> <Input label="Table Name" bind:error bind:value={name} />
</ModalContent> </ModalContent>