Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving nodes #9

Open
ironhouzi opened this issue Apr 3, 2021 · 3 comments · May be fixed by #32
Open

Moving nodes #9

ironhouzi opened this issue Apr 3, 2021 · 3 comments · May be fixed by #32

Comments

@ironhouzi
Copy link

ironhouzi commented Apr 3, 2021

I'm not sure I clearly see how to move a node/subgraph. I was expecting a grit move <node-id> [-p ]<parent-node-id> or if the node is to be a root node: grit move -r <node-id>.

@climech
Copy link
Owner

climech commented Apr 3, 2021

The idea is to unlink the child from its parent, then link another parent to it.

E.g., given the tree:

[ ] Task (26)
 ├──[ ] Subtask (27)
 │   ├──[ ] Subsubtask (29)
 │   └──[ ] Subsubtask (30)
 └──[ ] Subtask (28)
     └──[ ] Subsubtask (31)

To move 31 under 27, first remove the link between 28 and 31 (the direction is always from parent to child):

$ grit unlink 28 31

If 31 has no other parent, this will make it a root. This can be confirmed with grit stat 31, or grit ls which prints out a list of all roots by default.

Now we can link 27 to it:

$ grit link 27 31
$ grit
[ ] Task (26)
 ├──[ ] Subtask (27)
 │   ├──[ ] Subsubtask (29)
 │   ├──[ ] Subsubtask (30)
 │   └──[ ] Subsubtask (31)
 └──[ ] Subtask (28)

I suppose a move command could be useful as a shorthand for switching parents. However, the child may have more than one parent, so it would have to work with that.

@ironhouzi
Copy link
Author

ironhouzi commented Apr 3, 2021

Thank you! The UX is somewhat cumbersome, so being able to just make 27 in your example into a root node would be really great. I think the default behavior when sub-subtasks have multiple parents is to keep all parent refs, except the one you're currently modifying.

EDIT: After trying your instructions, I managed to loose nodes -- probably messing up ORIGIN and TARGETS for the link command. I am left with a sense of poor UX in that it was easily possible for me to loose nodes and modify the data structure to a useless state without any way of undoing my actions.

@Isammoc
Copy link

Isammoc commented Apr 4, 2021

@ironhouzi I cannot understand how you manage to lose nodes.
If a node does not have any parent (with unlink), it becomes a root node.
Only rm/remove seems to be able to delete data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants