Page limit config for dashboards with visible annotations (#110911)
* Page limit config for dashboards with visible annotations Signed-off-by: Maicon Costa <maiconscosta@gmail.com> --------- Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/permissions"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/searchstore"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -28,16 +29,21 @@ var (
|
||||
)
|
||||
|
||||
type AuthService struct {
|
||||
db db.DB
|
||||
features featuremgmt.FeatureToggles
|
||||
dashSvc dashboards.DashboardService
|
||||
db db.DB
|
||||
features featuremgmt.FeatureToggles
|
||||
dashSvc dashboards.DashboardService
|
||||
searchDashboardsPageLimit int64
|
||||
}
|
||||
|
||||
func NewAuthService(db db.DB, features featuremgmt.FeatureToggles, dashSvc dashboards.DashboardService) *AuthService {
|
||||
func NewAuthService(db db.DB, features featuremgmt.FeatureToggles, dashSvc dashboards.DashboardService, cfg *setting.Cfg) *AuthService {
|
||||
section := cfg.Raw.Section("annotations")
|
||||
searchDashboardsPageLimit := section.Key("search_dashboards_page_limit").MustInt64(1000)
|
||||
|
||||
return &AuthService{
|
||||
db: db,
|
||||
features: features,
|
||||
dashSvc: dashSvc,
|
||||
db: db,
|
||||
features: features,
|
||||
dashSvc: dashSvc,
|
||||
searchDashboardsPageLimit: searchDashboardsPageLimit,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +143,7 @@ func (authz *AuthService) dashboardsWithVisibleAnnotations(ctx context.Context,
|
||||
SignedInUser: query.SignedInUser,
|
||||
Page: query.Page,
|
||||
Type: filterType,
|
||||
Limit: 1000,
|
||||
Limit: authz.searchDashboardsPageLimit,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -56,7 +56,7 @@ func ProvideService(
|
||||
return &RepositoryImpl{
|
||||
db: db,
|
||||
features: features,
|
||||
authZ: accesscontrol.NewAuthService(db, features, dashSvc),
|
||||
authZ: accesscontrol.NewAuthService(db, features, dashSvc, cfg),
|
||||
reader: read,
|
||||
writer: write,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user