adds oneToMany property to save table method
This commit is contained in:
parent
9dda10d0a3
commit
7dffc1881d
|
@ -232,8 +232,9 @@ export const getBackendUiStore = () => {
|
|||
return state
|
||||
})
|
||||
},
|
||||
saveField: ({ originalName, field, primaryDisplay = false }) => {
|
||||
saveField: ({ originalName, field, primaryDisplay = false, oneToMany = false }) => {
|
||||
store.update(state => {
|
||||
console.log(state)
|
||||
// delete the original if renaming
|
||||
// need to handle if the column had no name, empty string
|
||||
if (originalName || originalName === "") {
|
||||
|
@ -248,6 +249,10 @@ export const getBackendUiStore = () => {
|
|||
if (primaryDisplay) {
|
||||
state.draftTable.primaryDisplay = field.name
|
||||
}
|
||||
// Set one-to-many
|
||||
if (oneToMany) {
|
||||
state.draftTable.oneToMany = field.name
|
||||
}
|
||||
|
||||
state.draftTable.schema[field.name] = cloneDeep(field)
|
||||
store.actions.tables.save(state.draftTable)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
let primaryDisplay =
|
||||
$backendUiStore.selectedTable.primaryDisplay == null ||
|
||||
$backendUiStore.selectedTable.primaryDisplay === field.name
|
||||
let oneToMany = false;
|
||||
let confirmDeleteDialog
|
||||
let deletion
|
||||
|
||||
|
@ -41,6 +42,7 @@
|
|||
originalName,
|
||||
field,
|
||||
primaryDisplay,
|
||||
oneToMany,
|
||||
})
|
||||
return state
|
||||
})
|
||||
|
@ -150,7 +152,7 @@
|
|||
bind:value={field.constraints.numericality.lessThanOrEqualTo} />
|
||||
{:else if field.type === 'link'}
|
||||
<Toggle
|
||||
bind:checked={field.constraints.oneToMany}
|
||||
bind:checked={field.oneToMany}
|
||||
thin
|
||||
text="One to many?" />
|
||||
<Select label="Table" thin secondary bind:value={field.tableId}>
|
||||
|
|
Loading…
Reference in New Issue