Skip to content

Commit

Permalink
Add TODOs (#4513)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler authored Jul 6, 2023
1 parent 1cdc0f6 commit 04ae9cb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ export class SavedObjectEdition extends Component<
buttonColor: 'danger',
}
);
// TODO: This trigger should be maintained and emitted by the saved objects plugin
// when an obj is deleted. Tracking issue:
// https://github.com/opensearch-project/OpenSearch-Dashboards/issues/4499
if (confirmed) {
this.props.uiActions
.getTrigger(SAVED_OBJECT_DELETE_TRIGGER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import { i18n } from '@osd/i18n';
import { Trigger } from '../../../ui_actions/public';

/**
* This action is currently being used behind-the-scenes in the vis_augmenter plugin
* TODO: This action is currently being used behind-the-scenes in the vis_augmenter plugin
* to clean up related augment-vis saved objects when a visualization is deleted.
* This could be improved upon by potentially moving and maintaining this in the
* saved_objects plugin, expanding to other situations where automatic cleanup may
* be helpful, and communicating this better on the UI (modals, callouts, etc.)
* This should be moved and maintained by the saved objects plugin. Tracking issue:
* https://github.com/opensearch-project/OpenSearch-Dashboards/issues/4499
*/
export const SAVED_OBJECT_DELETE_TRIGGER = 'SAVED_OBJECT_DELETE_TRIGGER';
export const savedObjectDeleteTrigger: Trigger<'SAVED_OBJECT_DELETE_TRIGGER'> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export class SavedObjectDeleteAction implements Action<SavedObjectDeleteContext>
* If deletion of a vis saved object has been triggered, we want to clean up
* any augment-vis saved objects that have a reference to this vis since it
* is now stale.
* TODO: this should be automatically handled by the saved objects plugin, instead
* of this specific scenario in the vis_augmenter plugin. Tracking issue:
* https://github.com/opensearch-project/OpenSearch-Dashboards/issues/4499
*/
public async execute({ type, savedObjectId }: SavedObjectDeleteContext) {
if (!(await this.isCompatible({ type, savedObjectId }))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,14 @@ export class VisualizeEmbeddable
)) as ExprVisLayers;
const visLayers = exprVisLayers.layers;

// There may be some stale saved objs if any plugin resources have been deleted since last time
// data was fetched from them via the expression functions. Execute this trigger so any listening
// action can perform cleanup.
/**
* There may be some stale saved objs if any plugin resources have been deleted since last time
* data was fetched from them via the expression functions. Execute this trigger so any listening
* action can perform cleanup.
*
* TODO: this should be automatically handled by the saved objects plugin. Tracking issue:
* https://github.com/opensearch-project/OpenSearch-Dashboards/issues/4499
*/
getUiActions().getTrigger(PLUGIN_RESOURCE_DELETE_TRIGGER).exec({
savedObjs: augmentVisSavedObjs,
visLayers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ export const VisualizeListing = () => {
savedObjects.client
.delete(item.savedObjectType, item.id)
.then(() => {
/**
* TODO: this should be automatically handled by the saved objects plugin. Tracking issue:
* https://github.com/opensearch-project/OpenSearch-Dashboards/issues/4499
*/
uiActions
.getTrigger(SAVED_OBJECT_DELETE_TRIGGER)
.exec({ type: item.savedObjectType, savedObjectId: item.id });
Expand Down

0 comments on commit 04ae9cb

Please sign in to comment.