Unistore: ensure dashboard DeleteInFolders work on both storages (#113197)
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
This commit is contained in:
@@ -1638,12 +1638,14 @@ func (dr *DashboardServiceImpl) DeleteInFolders(ctx context.Context, orgID int64
|
||||
defer span.End()
|
||||
|
||||
// We need a list of dashboard uids inside the folder to delete related public dashboards
|
||||
dashes, err := dr.dashboardStore.FindDashboards(ctx, &dashboards.FindPersistedDashboardsQuery{
|
||||
dashes, err := dr.searchDashboardsThroughK8s(ctx, &dashboards.FindPersistedDashboardsQuery{
|
||||
SignedInUser: u,
|
||||
FolderUIDs: folderUIDs,
|
||||
OrgId: orgID,
|
||||
Type: searchstore.TypeDashboard,
|
||||
Limit: 100000,
|
||||
OrgId: orgID,
|
||||
FolderUIDs: folderUIDs,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return folder.ErrInternal.Errorf("failed to fetch dashboards: %w", err)
|
||||
}
|
||||
@@ -1658,7 +1660,14 @@ func (dr *DashboardServiceImpl) DeleteInFolders(ctx context.Context, orgID int64
|
||||
return err
|
||||
}
|
||||
|
||||
return dr.dashboardStore.DeleteDashboardsInFolders(ctx, &dashboards.DeleteDashboardsInFolderRequest{FolderUIDs: folderUIDs, OrgID: orgID})
|
||||
for _, dash := range dashes {
|
||||
errDel := dr.DeleteDashboard(ctx, dash.ID, dash.UID, orgID)
|
||||
if errDel != nil {
|
||||
dr.log.Error("failed to delete dashboard inside folder", "dashboardUID", dash.UID, "folderUIDs", folderUIDs, "error", errDel)
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (dr *DashboardServiceImpl) Kind() string { return entity.StandardKindDashboard }
|
||||
|
||||
Reference in New Issue
Block a user