elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.62k stars 8.22k forks source link

Ensuring referential integrity for saved objects deleted from saved objects management #146044

Open rudolf opened 1 year ago

rudolf commented 1 year ago

Deleting a saved object from saved objects management does not enforce referential integrity. That means when there's a parent to child or child to parent references, deleting the parent does not delete it's children.

Sometimes this is the desired behaviour, e.g. deleting a dashboard should not delete all the visualisations in the visualisations library references by this dashboard.

Other times this is undesired, like when a case is deleted we might want to delete all the cases-comments and cases-user-actions so that we don't leave "orphaned" objects which continuously accumalate but have no value.

When there's a parent to child reference, it's possible to delete the child leaving the parent in an inconsistent state. For instance deleting the data view used by a dashboard that effectively breaks the dashboard, although the impact of this change isn't obvious to the user performing the action.

Given that the correct action to take here very much depends on the domain of the plugin, this logic needs to be specified by the plugin.

There are a couple of options here:

  1. Move "delete saved object" out of the saved objects management UI and into the Application. Based on early mockups this seems like the direction Global Experience might want to take https://github.com/elastic/kibana/issues/143745
  2. Add a client-side onDelete hook
  3. Add a server-side onDelete hook
elasticmachine commented 1 year ago

Pinging @elastic/kibana-core (Team:Core)

drewdaemon commented 1 year ago

The need for this from the visualization team has been removed for now.

We have decided to save event annotation groups as single saved objects instead of a group object with multiple hidden children. Because of that decision, this task is no longer a blocker.