rename record
This commit is contained in:
parent
337d4019c1
commit
72ce6833c0
|
@ -244,7 +244,7 @@ export const deleteCurrentNode = store => () => {
|
||||||
|
|
||||||
export const saveField = store => field => {
|
export const saveField = store => field => {
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
state.currentNode.fields = state.currentNode.fields.filter(f => f.name !== field.name)
|
state.currentNode.fields = state.currentNode.fields.filter(f => f.id !== field.id)
|
||||||
|
|
||||||
templateApi(state.hierarchy).addField(state.currentNode, field)
|
templateApi(state.hierarchy).addField(state.currentNode, field)
|
||||||
return state
|
return state
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
errors = validate.field(allFields)(clonedField)
|
errors = validate.field(allFields)(clonedField)
|
||||||
if (errors.length > 0) return
|
if (errors.length > 0) return
|
||||||
field.typeOptions = cloneDeep(clonedField.typeOptions)
|
field.typeOptions = cloneDeep(clonedField.typeOptions)
|
||||||
onFinished({ ...clonedField, ...field })
|
onFinished({ ...field, ...clonedField })
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
|
|
||||||
$: models = $store.hierarchy.children
|
$: models = $store.hierarchy.children
|
||||||
$: parent = record && record.parent()
|
$: parent = record && record.parent()
|
||||||
$: isChildModel = parent.name !== "root"
|
$: isChildModel = parent && parent.name !== "root"
|
||||||
$: modelExistsInHierarchy = getNode(
|
$: modelExistsInHierarchy = $store.currentNode && getNode(
|
||||||
$store.hierarchy,
|
$store.hierarchy,
|
||||||
$store.currentNode.nodeId
|
$store.currentNode.nodeId
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {
|
||||||
import { all, getDefaultOptions } from "../types"
|
import { all, getDefaultOptions } from "../types"
|
||||||
import { applyRuleSet, makerule } from "../common/validationCommon"
|
import { applyRuleSet, makerule } from "../common/validationCommon"
|
||||||
import { BadRequestError } from "../common/errors"
|
import { BadRequestError } from "../common/errors"
|
||||||
|
import { generate } from "shortid"
|
||||||
|
|
||||||
export const fieldErrors = {
|
export const fieldErrors = {
|
||||||
AddFieldValidationFailed: "Add field validation: ",
|
AddFieldValidationFailed: "Add field validation: ",
|
||||||
|
@ -17,6 +18,7 @@ export const fieldErrors = {
|
||||||
export const allowedTypes = () => keys(all)
|
export const allowedTypes = () => keys(all)
|
||||||
|
|
||||||
export const getNewField = type => ({
|
export const getNewField = type => ({
|
||||||
|
id: generate(),
|
||||||
name: "", // how field is referenced internally
|
name: "", // how field is referenced internally
|
||||||
type,
|
type,
|
||||||
typeOptions: getDefaultOptions(type),
|
typeOptions: getDefaultOptions(type),
|
||||||
|
|
Loading…
Reference in New Issue