automatically adds index for new record
This commit is contained in:
parent
21287181a2
commit
871949ef5e
|
@ -253,7 +253,7 @@ const saveCurrentNode = (store) => () => {
|
|||
existingNode.parent().children = pipe(existingNode.parent().children, [
|
||||
filter(c => c.nodeId !== existingNode.nodeId)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// should add node into existing hierarchy
|
||||
const cloned = cloneDeep(s.currentNode);
|
||||
|
@ -272,6 +272,13 @@ const saveCurrentNode = (store) => () => {
|
|||
sortBy(newIndexOfchild)
|
||||
]);
|
||||
|
||||
if(!existingNode && s.currentNode.type === "record") {
|
||||
const defaultIndex = templateApi(s.hierarchy)
|
||||
.getNewIndexTemplate(cloned.parent());
|
||||
defaultIndex.name = `all_${cloned.collectionName}`;
|
||||
defaultIndex.allowedRecordNodeIds = [cloned.nodeId];
|
||||
}
|
||||
|
||||
s.currentNodeIsNew = false;
|
||||
|
||||
savePackage(store, s);
|
||||
|
|
Loading…
Reference in New Issue