huridocs / uwazi

Uwazi is a web-based, open-source solution for building and sharing document collections
http://www.uwazi.io
MIT License
232 stars 81 forks source link

[IX] Error if the extractor loses its linked property or template #6985

Closed salvalacruz closed 1 month ago

salvalacruz commented 1 month ago

Describe the bug In '/settings/metadata_extraction', an error occurs when you click the 'Review' button and the extractor no longer has a linked template.

To Reproduce Steps to reproduce the behavior:

  1. Create a new template with at least one property.
  2. Go to '/settings/metadata_extraction' and create a new extractor, linked to a property of this new template.
  3. Come back to templates setting and delete this linked property or even the template.
  4. Come back to '/settings/metadata_extraction'.
  5. Click on 'Review' for this extractor.
  6. You get an error: image

Expected behavior This error should be avoided:

aphilop commented 1 month ago

@txau @RafaPolit In my opinion this should be priority high and should be fixed within the next sprints and while we are still developing the IX feature. The reported scenario apparently "brakes" the system.

txau commented 1 month ago

@aphilop I agree, Deleting a property should delete also the extractor and the associated data (labeled data etc)

RafaPolit commented 1 month ago

Since this is could have further implications, indeed we have decided to:

daneryl commented 1 month ago
  • Remove the property from the extractor (in case it has more than one and others still exist on the templates)
  • Sanitize the suggestions that may have been using those values

This 2 were already implemented, the reason for the error was that the extractor is returned without templates and the client crashes.

  • Remove the whole extractor if all of its properties or templates or thesaurus are deleted

This is the only one that needs to be implemented to prevent the crash.

aphilop commented 1 month ago

Close as done.