mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
Nested Folders: Move SharedWithMe to the top of the folders list (#79875)
This commit is contained in:
parent
5a21a6d938
commit
a62db1e24b
@ -263,7 +263,7 @@ func (s *Service) getRootFolders(ctx context.Context, q *folder.GetChildrenQuery
|
||||
|
||||
// add "shared with me" folder on the 1st page
|
||||
if (q.Page == 0 || q.Page == 1) && len(q.FolderUIDs) != 0 {
|
||||
children = append(children, &folder.SharedWithMeFolder)
|
||||
children = append([]*folder.Folder{&folder.SharedWithMeFolder}, children...)
|
||||
}
|
||||
|
||||
return children, nil
|
||||
|
@ -128,7 +128,7 @@ func TestGetFolders(t *testing.T) {
|
||||
for i := range res.Payload {
|
||||
actualFolders = append(actualFolders, res.Payload[i].UID)
|
||||
}
|
||||
assert.Equal(t, []string{"folder-0", "folder-1", "folder-2", "folder-3", "folder-4", folder.SharedWithMeFolderUID}, actualFolders)
|
||||
assert.Equal(t, []string{folder.SharedWithMeFolderUID, "folder-0", "folder-1", "folder-2", "folder-3", "folder-4"}, actualFolders)
|
||||
})
|
||||
|
||||
t.Run("Pagination works as expect for editor", func(t *testing.T) {
|
||||
@ -140,7 +140,7 @@ func TestGetFolders(t *testing.T) {
|
||||
for i := range res.Payload {
|
||||
actualFolders = append(actualFolders, res.Payload[i].UID)
|
||||
}
|
||||
assert.Equal(t, []string{"folder-0", "folder-1", folder.SharedWithMeFolderUID}, actualFolders)
|
||||
assert.Equal(t, []string{folder.SharedWithMeFolderUID, "folder-0", "folder-1"}, actualFolders)
|
||||
|
||||
page = int64(2)
|
||||
res, err = editorClient.Folders.GetFolders(folders.NewGetFoldersParams().WithLimit(&limit).WithPage(&page))
|
||||
@ -168,7 +168,7 @@ func TestGetFolders(t *testing.T) {
|
||||
for i := range res.Payload {
|
||||
actualFolders = append(actualFolders, res.Payload[i].UID)
|
||||
}
|
||||
assert.Equal(t, []string{"folder-0", "folder-1", "folder-2", "folder-4", folder.SharedWithMeFolderUID}, actualFolders)
|
||||
assert.Equal(t, []string{folder.SharedWithMeFolderUID, "folder-0", "folder-1", "folder-2", "folder-4"}, actualFolders)
|
||||
})
|
||||
|
||||
t.Run("Pagination works as expect for viewer", func(t *testing.T) {
|
||||
@ -180,7 +180,7 @@ func TestGetFolders(t *testing.T) {
|
||||
for i := range res.Payload {
|
||||
actualFolders = append(actualFolders, res.Payload[i].UID)
|
||||
}
|
||||
assert.Equal(t, []string{"folder-0", "folder-1", folder.SharedWithMeFolderUID}, actualFolders)
|
||||
assert.Equal(t, []string{folder.SharedWithMeFolderUID, "folder-0", "folder-1"}, actualFolders)
|
||||
|
||||
page = int64(2)
|
||||
res, err = viewerClient.Folders.GetFolders(folders.NewGetFoldersParams().WithLimit(&limit).WithPage(&page))
|
||||
|
Loading…
Reference in New Issue
Block a user