[release-12.0.1] Dashboard and Folders: fix version mismatch (#104717)
Folders: Fix version mismatch errors
This commit is contained in:
@@ -88,6 +88,7 @@ func (ss *FolderUnifiedStoreImpl) UnstructuredToLegacyFolder(ctx context.Context
|
||||
updaterId = creatorId
|
||||
}
|
||||
|
||||
folder.Version = int(item.GetGeneration())
|
||||
folder.CreatedBy = creatorId
|
||||
folder.UpdatedBy = updaterId
|
||||
|
||||
@@ -124,6 +125,7 @@ func (ss *FolderUnifiedStoreImpl) UnstructuredToLegacyFolderList(ctx context.Con
|
||||
updaterId = creatorId
|
||||
}
|
||||
|
||||
folder.Version = int(item.GetGeneration())
|
||||
folder.CreatedBy = creatorId
|
||||
folder.UpdatedBy = updaterId
|
||||
folders = append(folders, folder)
|
||||
|
||||
@@ -591,6 +591,8 @@ func (s *Service) updateOnApiServer(ctx context.Context, cmd *folder.UpdateFolde
|
||||
NewTitle: cmd.NewTitle,
|
||||
NewDescription: cmd.NewDescription,
|
||||
SignedInUser: user,
|
||||
Overwrite: cmd.Overwrite,
|
||||
Version: cmd.Version,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -104,6 +104,11 @@ func (ss *FolderUnifiedStoreImpl) Update(ctx context.Context, cmd folder.UpdateF
|
||||
return nil, err
|
||||
}
|
||||
meta.SetFolder(*cmd.NewParentUID)
|
||||
} else {
|
||||
// only compare versions if not moving the folder
|
||||
if !cmd.Overwrite && (cmd.Version != int(obj.GetGeneration())) {
|
||||
return nil, dashboards.ErrDashboardVersionMismatch
|
||||
}
|
||||
}
|
||||
|
||||
out, err := ss.k8sclient.Update(ctx, updated, cmd.OrgID, v1.UpdateOptions{
|
||||
|
||||
Reference in New Issue
Block a user