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