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

will-moore commented Feb 11, 2020

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

This comment has been minimized.

Copy link
Member

joshmoore commented Feb 12, 2020

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

@jburel

This comment has been minimized.

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;

This comment has been minimized.

Copy link
@jburel

jburel Feb 12, 2020

Member

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

This comment has been minimized.

Copy link
@will-moore

will-moore Feb 12, 2020

Author Member

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?

This comment has been minimized.

Copy link
@jburel

jburel Feb 12, 2020

Member

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.

This comment has been minimized.

Copy link
@will-moore

will-moore Feb 12, 2020

Author Member

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.

This comment has been minimized.

Copy link
@jburel

jburel Feb 12, 2020

Member

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member Author

will-moore commented Feb 13, 2020

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

@jburel

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

jburel commented Feb 13, 2020

The UI bug should be fixed

@will-moore

This comment has been minimized.

Copy link
Member Author

will-moore commented Feb 13, 2020

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

@jburel

This comment has been minimized.

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
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.