automatically adds index for new record

This commit is contained in:
Michael Shanks 2019-10-31 09:22:01 +00:00
parent 21287181a2
commit 871949ef5e
1 changed files with 8 additions and 1 deletions

View File

@ -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);