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

Improvement ideas regarding handling of subtags when their parent tag is deleted #352

Open
GuillaumeFromage opened this issue Dec 11, 2024 · 9 comments

Comments

@GuillaumeFromage
Copy link

Describe the bug
When you delete a tag that has subtags, the subtags are deleted also without warning.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the tag interface view
  2. Click on + -> Add Tag then add a tag
  3. On the tag you created, create a subtag
  4. Delete the first tag you created, the subtag will disappear

Expected behavior
I can think of two more acceptable behavior: a) you replace the the parent for all subtags, so they end up in their parent tag (or just in the tagset), b) offer a warning that says "all subtags will be deleted".

Information about your environment

  • I'm using the web interface
  • Browser: firefox
@GuillaumeFromage
Copy link
Author

GuillaumeFromage commented Dec 11, 2024

This comes from using removeItem in "catma/src/main/java/de/catma/ui/module/tags/TagsView.java". In the vaadin code, it says the function "Remove a given item from this structure. Additionally, this will recursively remove any descendants of the item." (see: https://github.com/vaadin/framework/blob/master/server/src/main/java/com/vaadin/data/TreeData.java#L291). My java is too rusty to submit a merge request, but you have functions like getChildren, getParent and setParent in that vaadin class, it doesn't seem that much of a stretch to write a small loop using them to save the children.

@maltem-za
Copy link
Member

maltem-za commented Dec 12, 2024

Hi @GuillaumeFromage, thank you for you improvement ideas regarding handling of subtags when their parent tag is deleted.

Moving the subtags up a level is an interesting thought. The changes would be a bit more involved than simply editing the UI (Vaadin) code however, as the hierarchical structure is also present in our backend data model.

P.S.: If you lost data as a result of the deletion (annotations using the subtags) and would like us to restore it, please send a quick message to [email protected]

@maltem-za maltem-za changed the title Deleting a tag deletes its subtags Improvement ideas regarding handling of subtags when their parent tag is deleted Dec 12, 2024
@GuillaumeFromage
Copy link
Author

Hi @maltem-za,

Thanks. My data is fine, I was just testing. If I make a pull request for it, would you be interested in including it? I would most likely do that one and one that also to move subtags from one tag to another, by setting the parent. A lot of the coding methodologies for social sciences rely on such recategorization, and its highly problematic that you'd need to recode all of the subtags.

My java is rusty AF but I'm sure I can make something work.

@maltem-za
Copy link
Member

Generally speaking we would welcome community contributions :)
Note that there would likely need to be a bit of back-and-forth and a few code review cycles though, and as we have limited resources I can't promise a fast turnaround.

There is also a workaround that can be used to "move" a tag, if you can live with deleting the associated existing annotations and re-creating them in a semi-automatic way. Whether this is a viable approach will also depend on whether and to what extent properties are being used.

@GuillaumeFromage
Copy link
Author

I'd be curious to hear the workaround just so it can give me hints on how to implement it in code.

@maltem-za
Copy link
Member

If you're serious about implementing your "re-parenting" idea then we should have a chat, as there are quite a few things to consider and it will undoubtedly be a deep rabbit hole (consider yourself as having been warned ;) ). It seems simple enough on the surface, but once you add the multi-user and synchronisation (merging) aspects it quickly becomes complicated. I don't mean to discourage you, but I suspect you haven't yet grasped the magnitude of the undertaking (also because I've understated it until now).

In terms of the workaround, this is purely using the GUI and existing functionality. I wouldn't use it as a reference for a "proper" solution (which would look quite different in my mind), but I mentioned it because it might be good enough in some instances. So as not to derail the conversation here too much, please send a quick mail to [email protected] and I'll gladly send you the details.

@GuillaumeFromage
Copy link
Author

I'm serious about it. Do you mean a talk like video call? Or you'd write a list of considerations? My way of offloading some of that work onto me would be to dig into the code a bit, to try to figure out what you mean. Is there a general diagram of how the architecture of the application is done? Or could you give me pointers on how the tagset are passed from one user to the next and how the data is stored?

I'll try to dig tomorrow (I'm based in so-called Quebec) and come up with some general strategy and I'm totally cool with following your pointers on how you like things.

@maltem-za
Copy link
Member

Yes exactly, I meant a video call. I've sent you a mail.

@GuillaumeFromage
Copy link
Author

Got the email, will answer soon!

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

No branches or pull requests

2 participants