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

Delete check parent links #124

Merged
merged 4 commits into from Feb 18, 2020
Merged

Conversation

will-moore
Copy link
Member

See https://forum.image.sc/t/caution-with-copy-links-in-omero/33680

We do a simple check for multiple parents and if found, show a Warning message:

Screenshot 2020-02-11 at 15 25 19

To test:

  • Select 1 or more Images or Datasets or Plates where at least one of the selected objects has multiple Parents.
  • Click Delete.
  • Should see the warning above.
  • Also check warning is not shown when not needed.

@joshmoore
Copy link
Member

@dominikl, @jburel : how hard would it be to have a similar dialog in insight?

@jburel
Copy link
Member

jburel commented Feb 12, 2020

We already have a confirmation dialog so it will be a matter of adding a check and add the warning message.
Insight has already a warning message (divergence between web/insight)
Screenshot 2020-02-12 at 08 28 10

I will have a look

var multiple = false;
var links = {};
data.data.forEach(function(link){
var childId = link.child.type + link.child.id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I understand the dialog correctly as soon as one image has more than one parent the warning is displayed. So the loop could be stop as soon as multiple is true

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I want to break out of the loop early then I have to switch to using a for loop, which is slightly less nice coding style (I prefer the 'functional' style). I don't think you will notice much performance improvement to break early but can refactor if you want?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i understand but we have seen cases where people were trying to delete a large number of objects from the UI
so it will be good to see if it makes a major change in performance.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is running after we make a call to the server, which takes e.g. 162 millisecs for 46 images (just tried that). I imagine the refactor will save maybe a few millisecs and won't be noticed compared to the time to load the data. With a large number of images the effect will be even smaller since it will take longer to load the data.
If you want me to spend time to analyse the performance under various conditions (for loop vv forEach and many images where the first has multiple parents vv many images where none of the images have multiple parents (so we don't break early) then I can do, but I think that would not be the best use of time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking

If you want me to spend time to analyse the performance under various conditions (for loop vv forEach and many images where the first has multiple parents vv many images where none of the images have multiple parents (so we don't break early) then I can do, but I think that would not be the best use of time.

This is not what I was suggesting. Nonetheless we need to keep in mind performance and large volume since it is the reality! and break early if required.
For this call, it seems that we might not have a significant performance degradation.

@jburel
Copy link
Member

jburel commented Feb 12, 2020

Actually insight has already a check in place for images
Screenshot 2020-02-12 at 11 24 00

@jburel
Copy link
Member

jburel commented Feb 13, 2020

Unfortunately this will partially prevent the lost of image data.
Follow is a use case that will delete the image. The user is very likely to delete a dataset.

  • Add an image to 2 datasets, d1 and d2.
  • d1 is only in one project or orphan
  • Select to delete d1.
  • The image will be also deleted and "disappear" from d2

@will-moore
Copy link
Member Author

@jburel If you delete a Dataset, any Images in it that are also in another Dataset won't get deleted.

@jburel
Copy link
Member

jburel commented Feb 13, 2020

I got mislead by the UI, you are correct
It is deleting from the display but a refresh "brings" it back
I forgot about that strange behaviour

@jburel
Copy link
Member

jburel commented Feb 13, 2020

The UI bug should be fixed

@will-moore
Copy link
Member Author

@jburel That last commit should fix the bug you noticed.

@jburel
Copy link
Member

jburel commented Feb 14, 2020

Thanks @will-moore , the shared image is now removed from the second dataset when the first dataset is deleted.

@jburel jburel merged commit ecba375 into ome:master Feb 18, 2020
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 this pull request may close these issues.

None yet

3 participants