opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.66k stars 867 forks source link

Introduce automatic cleanup of related saved objects #4499

Open ohltyler opened 1 year ago

ohltyler commented 1 year ago

Problem

Currently, there is nothing done to remove or update saved objects, when a related/dependent one is removed. For example, removing an index pattern can have downstream effects that break visualizations, and potentially dashboards where those visualizations may be embedded.

The current (partial) solution

The Vis Augmenter / Feature Anywhere feature had a hard requirement to provide some sort of cleanup of the augment-vis saved objects when there was changes to the related plugin resources, or if the related visualization was deleted. Due to the nature of the feature and the easy potential for there to be lots of stale saved objects, as well as other UX-related flows such as preventing lots of errors showing up when rendering dashboards, an auto-deletion solution was implemented. See details here: #4059

Some immediate limitations of this solution is:

TODOs have been added in source code highlighting the main locations where the current implementation can be improved upon, and linking back to this issue.

This solution is sufficient for this feature, but it should be expanded upon

Proposal

There should be a generic framework that all saved objects can use to provide automatic cleanup when an object is deleted, as well as related UX for transparency on the downstream effects of deleting certain saved objects, and options to automatically delete or update them as well. This could be done via some modal or other way that would show when a saved obj is deleted through any of the existing UX flows.

ohltyler commented 1 year ago

Reference: https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4361#discussion_r1251276855

kavilla commented 1 year ago

I think we should consider a UX feature. One consistent work flow is that references are deleted but the actual object is still available. For example, I can delete a dashboard but it wont delete all my visualizations if those visualizations aren't attached to a dashboard anymore. Same with filters and index patterns.

Cases to think about here too:

So I think it would be better to give the user the option and if they decline then they have the ability to tag something as stale or isolated related saved object.