mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
CloudMigrations: cover cases where library panel has no folder (#94405)
This commit is contained in:
parent
ee65f89533
commit
96384b5181
@ -672,6 +672,7 @@ func TestGetParentNames(t *testing.T) {
|
||||
},
|
||||
libraryElements: []libraryElement{
|
||||
{UID: "libraryElementUID-0", FolderUID: &libraryElementFolderUID},
|
||||
{UID: "libraryElementUID-1"},
|
||||
},
|
||||
expectedDashParentNames: []string{"", "Folder A", "Folder B"},
|
||||
expectedFoldParentNames: []string{"Folder A"},
|
||||
|
@ -588,7 +588,9 @@ func (s *Service) getParentNames(ctx context.Context, signedInUser *user.SignedI
|
||||
parentFolderUIDsSet[f.ParentUID] = struct{}{}
|
||||
}
|
||||
for _, libraryElement := range libraryElements {
|
||||
parentFolderUIDsSet[*libraryElement.FolderUID] = struct{}{}
|
||||
if libraryElement.FolderUID != nil {
|
||||
parentFolderUIDsSet[*libraryElement.FolderUID] = struct{}{}
|
||||
}
|
||||
}
|
||||
parentFolderUIDsSlice := make([]string, 0, len(parentFolderUIDsSet))
|
||||
for parentFolderUID := range parentFolderUIDsSet {
|
||||
@ -610,7 +612,9 @@ func (s *Service) getParentNames(ctx context.Context, signedInUser *user.SignedI
|
||||
parentNamesByType[cloudmigration.FolderDataType][f.UID] = foldersUIDsToFolderName[f.ParentUID]
|
||||
}
|
||||
for _, libraryElement := range libraryElements {
|
||||
parentNamesByType[cloudmigration.LibraryElementDataType][libraryElement.UID] = foldersUIDsToFolderName[*libraryElement.FolderUID]
|
||||
if libraryElement.FolderUID != nil {
|
||||
parentNamesByType[cloudmigration.LibraryElementDataType][libraryElement.UID] = foldersUIDsToFolderName[*libraryElement.FolderUID]
|
||||
}
|
||||
}
|
||||
|
||||
return parentNamesByType, err
|
||||
|
Loading…
Reference in New Issue
Block a user