1
0
Fork 0
mirror of synced 2024-09-30 17:18:14 +13:00

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

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