Chore: Deprecate FolderID from Dashboard (#77823)

* Chore: Deprecate FolderID from Dashboard

* chore: add two missing nolint comments
This commit is contained in:
Kat Yang
2023-11-15 10:28:50 -05:00
committed by GitHub
parent 0214b25663
commit 3a2e96b0db
28 changed files with 92 additions and 27 deletions
+2
View File
@@ -172,7 +172,9 @@ func (hs *HTTPServer) GetDashboard(c *contextmodel.ReqContext) response.Response
}
// lookup folder title
// nolint:staticcheck
if dash.FolderID > 0 {
// nolint:staticcheck
query := dashboards.GetDashboardQuery{ID: dash.FolderID, OrgID: c.SignedInUser.GetOrgID()}
queryResult, err := hs.DashboardService.GetDashboard(c.Req.Context(), &query)
if err != nil {
+1 -1
View File
@@ -195,7 +195,7 @@ func (hs *HTTPServer) getDashboardACL(ctx context.Context, user identity.Request
acl = append(acl, &dashboards.DashboardACLInfoDTO{
OrgID: dashboard.OrgID,
DashboardID: dashboard.ID,
FolderID: dashboard.FolderID,
FolderID: dashboard.FolderID, // nolint:staticcheck
Created: p.Created,
Updated: p.Updated,
UserID: p.UserId,
+5
View File
@@ -379,11 +379,13 @@ func TestDashboardAPIEndpoint(t *testing.T) {
t.Run("Given two dashboards with the same title in different folders", func(t *testing.T) {
dashOne := dashboards.NewDashboard("dash")
dashOne.ID = 2
// nolint:staticcheck
dashOne.FolderID = 1
dashOne.HasACL = false
dashTwo := dashboards.NewDashboard("dash")
dashTwo.ID = 4
// nolint:staticcheck
dashTwo.FolderID = 3
dashTwo.HasACL = false
})
@@ -411,6 +413,7 @@ func TestDashboardAPIEndpoint(t *testing.T) {
}
dashboardService := dashboards.NewFakeDashboardService(t)
// nolint:staticcheck
dashboardService.On("SaveDashboard", mock.Anything, mock.AnythingOfType("*dashboards.SaveDashboardDTO"), mock.AnythingOfType("bool")).
Return(&dashboards.Dashboard{ID: dashID, UID: "uid", Title: "Dash", Slug: "dash", Version: 2, FolderUID: folderUID, FolderID: folderID}, nil)
mockFolderService := &foldertest.FakeService{
@@ -646,6 +649,7 @@ func TestDashboardAPIEndpoint(t *testing.T) {
const folderID int64 = 1
fakeDash := dashboards.NewDashboard("Child dash")
fakeDash.ID = 2
// nolint:staticcheck
fakeDash.FolderID = folderID
fakeDash.HasACL = false
@@ -780,6 +784,7 @@ func TestDashboardAPIEndpoint(t *testing.T) {
func TestDashboardVersionsAPIEndpoint(t *testing.T) {
fakeDash := dashboards.NewDashboard("Child dash")
fakeDash.ID = 1
// nolint:staticcheck
fakeDash.FolderID = 1
fakeDashboardVersionService := dashvertest.NewDashboardVersionServiceFake()
+3 -3
View File
@@ -346,7 +346,7 @@ func setupDB(b testing.TB) benchScenario {
OrgID: signedInUser.OrgID,
IsFolder: false,
UID: str,
FolderID: f0.ID,
FolderID: f0.ID, // nolint:staticcheck
Slug: str,
Title: str,
Data: simplejson.New(),
@@ -373,7 +373,7 @@ func setupDB(b testing.TB) benchScenario {
OrgID: signedInUser.OrgID,
IsFolder: false,
UID: str,
FolderID: f1.ID,
FolderID: f1.ID, // nolint:staticcheck
Slug: str,
Title: str,
Data: simplejson.New(),
@@ -400,7 +400,7 @@ func setupDB(b testing.TB) benchScenario {
OrgID: signedInUser.OrgID,
IsFolder: false,
UID: str,
FolderID: f2.ID,
FolderID: f2.ID, // nolint:staticcheck
Slug: str,
Title: str,
Data: simplejson.New(),