1
0
Fork 0
mirror of synced 2024-10-01 09:38:55 +13:00
This commit is contained in:
Martin McKeaveney 2021-02-25 16:21:41 +00:00
parent 6a0c80da58
commit 0cfbe2357b
4 changed files with 26 additions and 15 deletions

View file

@ -28,10 +28,8 @@
.flat() .flat()
// Prevent modal closing if there were errors // Prevent modal closing if there were errors
return false return false
} } else if (rowResponse.status === 400 || rowResponse.status === 500) {
errors = [{ message: rowResponse.message }]
if (rowResponse.status === 500) {
notifier.danger(rowResponse.message)
return false return false
} }

View file

@ -60,7 +60,7 @@
.flat() .flat()
} }
return false return false
} else if (rowResponse.status === 400 && rowResponse.message) { } else if (rowResponse.status === 400 || rowResponse.status === 500) {
errors = [{ message: rowResponse.message }] errors = [{ message: rowResponse.message }]
return false return false
} }

View file

@ -43,16 +43,6 @@
</Label> </Label>
{:else} {:else}
{#if schema.relationshipType === 'one-to-many'} {#if schema.relationshipType === 'one-to-many'}
<Multiselect
secondary
bind:value={linkedIds}
{label}
placeholder="Choose some options">
{#each rows as row}
<option value={row._id}>{getPrettyName(row)}</option>
{/each}
</Multiselect>
{:else}
<Select <Select
thin thin
secondary secondary
@ -66,5 +56,15 @@
</option> </option>
{/each} {/each}
</Select> </Select>
{:else}
<Multiselect
secondary
bind:value={linkedIds}
{label}
placeholder="Choose some options">
{#each rows as row}
<option value={row._id}>{getPrettyName(row)}</option>
{/each}
</Multiselect>
{/if} {/if}
{/if} {/if}

View file

@ -322,9 +322,22 @@ class LinkController {
tableId: table._id, tableId: table._id,
fieldName: fieldName, fieldName: fieldName,
} }
if (field.autocolumn) { if (field.autocolumn) {
linkConfig.autocolumn = field.autocolumn linkConfig.autocolumn = field.autocolumn
} }
if (field.relationshipType) {
// Ensure that the other side of the relationship is locked to one record
linkConfig.relationshipType = field.relationshipType
// Update this table to be the many
table.schema[field.name].relationshipType =
RelationshipTypes.MANY_TO_MANY
const response = await this._db.put(table)
table._rev = response.rev
}
// check the linked table to make sure we aren't overwriting an existing column // check the linked table to make sure we aren't overwriting an existing column
const existingSchema = linkedTable.schema[field.fieldName] const existingSchema = linkedTable.schema[field.fieldName]
if ( if (