Folders: Fix folder pagination for cloud instances with many folders (#90008)

* filter the k6 folder out in the SQL queries rather than during post processing to ensure that the correct number of results is always returned

* linting
This commit is contained in:
Ieva
2024-07-05 11:19:03 +01:00
committed by GitHub
parent 4f06568f8a
commit e9ebb6eaa4
7 changed files with 95 additions and 24 deletions
@@ -4,6 +4,7 @@ import (
"fmt"
"strings"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/folder"
"github.com/grafana/grafana/pkg/services/search/model"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
@@ -127,6 +128,14 @@ func (f DashboardFilter) Where() (string, []any) {
return sqlUIDin("dashboard.uid", f.UIDs)
}
type K6FolderFilter struct{}
func (f K6FolderFilter) Where() (string, []any) {
filter := "dashboard.uid != ? AND (dashboard.folder_uid != ? OR dashboard.folder_uid IS NULL)"
params := []any{accesscontrol.K6FolderUID, accesscontrol.K6FolderUID}
return filter, params
}
type TagsFilter struct {
Tags []string
}