'New Child Record' not woring on builder
This commit is contained in:
parent
80cc7d51ef
commit
fd8341aaf6
|
@ -8,14 +8,30 @@ import NavItem from "./NavItem.svelte";
|
||||||
import getIcon from "../common/icon";
|
import getIcon from "../common/icon";
|
||||||
|
|
||||||
|
|
||||||
|
const newRootRecord = () => {
|
||||||
|
store.newRootRecord();
|
||||||
|
}
|
||||||
|
|
||||||
|
const newRootIndex = () => {
|
||||||
|
store.newRootIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
const newChildRecord = () => {
|
||||||
|
store.newChildRecord();
|
||||||
|
}
|
||||||
|
|
||||||
|
const newChildIndex = () => {
|
||||||
|
store.newChildIndex();
|
||||||
|
}
|
||||||
|
|
||||||
const defaultNewChildActions = [
|
const defaultNewChildActions = [
|
||||||
{
|
|
||||||
label:"New Root Index",
|
|
||||||
onclick: store.newRootIndex
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label:"New Root Record",
|
label:"New Root Record",
|
||||||
onclick: store.newRootRecord
|
onclick: newRootRecord
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:"New Root Index",
|
||||||
|
onclick: newRootIndex
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -25,20 +41,27 @@ const setActiveNav = (name) => () => {
|
||||||
store.setActiveNav(name);
|
store.setActiveNav(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
store.subscribe(db => {
|
store.subscribe(db => {
|
||||||
if(!db.currentNode || hierarchyFunctions.isIndex(db.currentNode)) {
|
if(!db.currentNode || hierarchyFunctions.isIndex(db.currentNode)) {
|
||||||
newChildActions = defaultNewChildActions;
|
newChildActions = defaultNewChildActions;
|
||||||
} else {
|
} else {
|
||||||
newChildActions = [
|
newChildActions = [
|
||||||
{label:"New Root Record",
|
{
|
||||||
onclick: store.newRootRecord},
|
label:"New Root Record",
|
||||||
{label: `New Child Record of ${db.currentNode.name}`,
|
onclick: newRootRecord
|
||||||
onclick: store.newChildRecord},
|
},
|
||||||
{label:"New Root Index",
|
{
|
||||||
onclick: store.newRootIndex},
|
label:"New Root Index",
|
||||||
{label: `New Index on ${db.currentNode.name}`,
|
onclick: newRootIndex
|
||||||
onclick: store.newChildIndex}
|
},
|
||||||
|
{
|
||||||
|
label: `New Child Record of ${db.currentNode.name}`,
|
||||||
|
onclick: newChildRecord
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: `New Index on ${db.currentNode.name}`,
|
||||||
|
onclick: newChildIndex
|
||||||
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue