K8s/Dashboards: Remove uid+version from spec (#101992)

This commit is contained in:
Ryan McKinley
2025-03-16 20:46:12 -05:00
committed by GitHub
parent 5c24312625
commit bb881f38bb
9 changed files with 83 additions and 52 deletions
@@ -286,11 +286,13 @@ func (s *Service) UnstructuredToLegacyDashboardVersion(ctx context.Context, item
uid := obj.GetName()
spec["uid"] = uid
dashVersion := 0
parentVersion := 0
if version, ok := spec["version"].(int64); ok {
dashVersion = int(version)
parentVersion = dashVersion - 1
dashVersion := obj.GetGeneration()
parentVersion := dashVersion - 1
if parentVersion < 0 {
parentVersion = 0
}
if dashVersion > 0 {
spec["version"] = dashVersion
}
createdBy, err := s.k8sclient.GetUserFromMeta(ctx, obj.GetCreatedBy())
@@ -325,8 +327,8 @@ func (s *Service) UnstructuredToLegacyDashboardVersion(ctx context.Context, item
CreatedBy: createdBy.ID,
Message: obj.GetMessage(),
RestoredFrom: restoreVer,
Version: dashVersion,
ParentVersion: parentVersion,
Version: int(dashVersion),
ParentVersion: int(parentVersion),
Data: simplejson.NewFromAny(spec),
}