mirror of
https://github.com/grafana/grafana.git
synced 2026-07-30 08:18:10 -05:00
Chore: Deprecate FolderID from GetDashboardQuery (#77812)
This commit is contained in:
@@ -884,6 +884,7 @@ func (d *dashboardStore) deleteAlertDefinition(dashboardId int64, sess *db.Sessi
|
||||
func (d *dashboardStore) GetDashboard(ctx context.Context, query *dashboards.GetDashboardQuery) (*dashboards.Dashboard, error) {
|
||||
var queryResult *dashboards.Dashboard
|
||||
err := d.store.WithDbSession(ctx, func(sess *db.Session) error {
|
||||
// nolint:staticcheck
|
||||
if query.ID == 0 && len(query.UID) == 0 && (query.Title == nil || query.FolderID == nil) {
|
||||
return dashboards.ErrDashboardIdentifierNotSet
|
||||
}
|
||||
@@ -894,6 +895,7 @@ func (d *dashboardStore) GetDashboard(ctx context.Context, query *dashboards.Get
|
||||
dashboard.Title = *query.Title
|
||||
mustCols = append(mustCols, "title")
|
||||
}
|
||||
// nolint:staticcheck
|
||||
if query.FolderID != nil {
|
||||
dashboard.FolderID = *query.FolderID
|
||||
mustCols = append(mustCols, "folder_id")
|
||||
|
||||
@@ -93,7 +93,7 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
|
||||
setup()
|
||||
query := dashboards.GetDashboardQuery{
|
||||
Title: util.Pointer("test dash 23"),
|
||||
FolderID: &savedFolder.ID,
|
||||
FolderID: &savedFolder.ID, // nolint:staticcheck
|
||||
OrgID: 1,
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
|
||||
setup()
|
||||
query := dashboards.GetDashboardQuery{
|
||||
Title: util.Pointer("test dash 23"),
|
||||
FolderID: util.Pointer(int64(0)),
|
||||
FolderID: util.Pointer(int64(0)), // nolint:staticcheck
|
||||
OrgID: 1,
|
||||
}
|
||||
|
||||
|
||||
@@ -302,9 +302,10 @@ type DeleteOrphanedProvisionedDashboardsCommand struct {
|
||||
//
|
||||
// Multiple constraints can be combined.
|
||||
type GetDashboardQuery struct {
|
||||
ID int64
|
||||
UID string
|
||||
Title *string
|
||||
ID int64
|
||||
UID string
|
||||
Title *string
|
||||
// Deprecated: use FolderUID instead
|
||||
FolderID *int64
|
||||
OrgID int64
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ func (prov *defaultAlertRuleProvisioner) getOrCreateFolderUID(
|
||||
ctx context.Context, folderName string, orgID int64) (string, error) {
|
||||
cmd := &dashboards.GetDashboardQuery{
|
||||
Title: &folderName,
|
||||
FolderID: util.Pointer(int64(0)),
|
||||
FolderID: util.Pointer(int64(0)), // nolint:staticcheck
|
||||
OrgID: orgID,
|
||||
}
|
||||
cmdResult, err := prov.dashboardService.GetDashboard(ctx, cmd)
|
||||
|
||||
@@ -318,7 +318,7 @@ func (fr *FileReader) getOrCreateFolder(ctx context.Context, cfg *config, servic
|
||||
|
||||
cmd := &dashboards.GetDashboardQuery{
|
||||
Title: &folderName,
|
||||
FolderID: util.Pointer(int64(0)),
|
||||
FolderID: util.Pointer(int64(0)), // nolint:staticcheck
|
||||
OrgID: cfg.OrgID,
|
||||
}
|
||||
result, err := fr.dashboardStore.GetDashboard(ctx, cmd)
|
||||
|
||||
Reference in New Issue
Block a user