mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 20:24:18 -06:00
Chore: Deprecate FolderID from CountDashboardsInFolderRequest (#77804)
Deprecate FolderID from CountDashboardsInFolderRequest
This commit is contained in:
parent
bc875b4c13
commit
71a2ce5a71
@ -1068,6 +1068,7 @@ func (d *dashboardStore) CountDashboardsInFolder(
|
||||
var count int64
|
||||
var err error
|
||||
err = d.store.WithDbSession(ctx, func(sess *db.Session) error {
|
||||
// nolint:staticcheck
|
||||
session := sess.In("folder_id", req.FolderID).In("org_id", req.OrgID).
|
||||
In("is_folder", d.store.GetDialect().BooleanStr(false))
|
||||
count, err = session.Count(&dashboards.Dashboard{})
|
||||
|
@ -517,12 +517,14 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
|
||||
// setup() saves one dashboard in the general folder and two in the "savedFolder".
|
||||
count, err := dashboardStore.CountDashboardsInFolder(
|
||||
context.Background(),
|
||||
// nolint:staticcheck
|
||||
&dashboards.CountDashboardsInFolderRequest{FolderID: 0, OrgID: 1})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, int64(1), count)
|
||||
|
||||
count, err = dashboardStore.CountDashboardsInFolder(
|
||||
context.Background(),
|
||||
// nolint:staticcheck
|
||||
&dashboards.CountDashboardsInFolderRequest{FolderID: savedFolder.ID, OrgID: 1})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, int64(2), count)
|
||||
@ -542,6 +544,7 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
// nolint:staticcheck
|
||||
count, err := dashboardStore.CountDashboardsInFolder(context.Background(), &dashboards.CountDashboardsInFolderRequest{FolderID: 2, OrgID: 1})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, count, int64(0))
|
||||
|
@ -376,6 +376,7 @@ type CountDashboardsInFolderQuery struct {
|
||||
// to the store layer. The FolderID will be replaced with FolderUID when
|
||||
// dashboards are updated with parent folder UIDs.
|
||||
type CountDashboardsInFolderRequest struct {
|
||||
// Deprecated: use FolderUID instead
|
||||
FolderID int64
|
||||
OrgID int64
|
||||
}
|
||||
|
@ -602,6 +602,7 @@ func (dr DashboardServiceImpl) CountInFolder(ctx context.Context, orgID int64, f
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// nolint:staticcheck
|
||||
return dr.dashboardStore.CountDashboardsInFolder(ctx, &dashboards.CountDashboardsInFolderRequest{FolderID: folder.ID, OrgID: orgID})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user