mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Deprecate FolderID from SaveDashboardCommand (#77813)
This commit is contained in:
parent
b3ad61e180
commit
d090dab138
@ -406,7 +406,7 @@ func TestDashboardAPIEndpoint(t *testing.T) {
|
||||
"title": "Dash",
|
||||
}),
|
||||
Overwrite: true,
|
||||
FolderID: folderID,
|
||||
FolderID: folderID, // nolint:staticcheck
|
||||
FolderUID: folderUID,
|
||||
IsFolder: false,
|
||||
Message: "msg",
|
||||
|
@ -439,7 +439,7 @@ func insertTestDashboard(t *testing.T, store db.DB, title string, orgId int64,
|
||||
t.Helper()
|
||||
cmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: orgId,
|
||||
FolderID: folderId,
|
||||
FolderID: folderId, // nolint:staticcheck
|
||||
FolderUID: folderUID,
|
||||
IsFolder: isFolder,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
|
@ -337,7 +337,7 @@ func TestIntegrationDashboardInheritedFolderRBAC(t *testing.T) {
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
"title": dashInParentTitle,
|
||||
}),
|
||||
FolderID: nestedFolders[0].ID,
|
||||
FolderID: nestedFolders[0].ID, // nolint:staticcheck
|
||||
FolderUID: nestedFolders[0].UID,
|
||||
}
|
||||
_, err = dashboardWriteStore.SaveDashboard(context.Background(), saveDashboardCmd)
|
||||
@ -350,7 +350,7 @@ func TestIntegrationDashboardInheritedFolderRBAC(t *testing.T) {
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
"title": dashInSubfolderTitle,
|
||||
}),
|
||||
FolderID: nestedFolders[1].ID,
|
||||
FolderID: nestedFolders[1].ID, // nolint:staticcheck
|
||||
FolderUID: nestedFolders[1].UID,
|
||||
}
|
||||
_, err = dashboardWriteStore.SaveDashboard(context.Background(), saveDashboardCmd)
|
||||
@ -440,7 +440,7 @@ func moveDashboard(t *testing.T, dashboardStore dashboards.Store, orgId int64, d
|
||||
|
||||
cmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: orgId,
|
||||
FolderID: newFolderId,
|
||||
FolderID: newFolderId, // nolint:staticcheck
|
||||
FolderUID: newFolderUID,
|
||||
Dashboard: dashboard,
|
||||
Overwrite: true,
|
||||
|
@ -25,7 +25,7 @@ func TestIntegrationDashboardProvisioningTest(t *testing.T) {
|
||||
|
||||
folderCmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: 1,
|
||||
FolderID: 0,
|
||||
FolderID: 0, // nolint:staticcheck
|
||||
FolderUID: "",
|
||||
IsFolder: true,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
@ -40,7 +40,7 @@ func TestIntegrationDashboardProvisioningTest(t *testing.T) {
|
||||
saveDashboardCmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: 1,
|
||||
IsFolder: false,
|
||||
FolderID: dash.ID,
|
||||
FolderID: dash.ID, // nolint:staticcheck
|
||||
FolderUID: dash.UID,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
"id": nil,
|
||||
@ -67,7 +67,7 @@ func TestIntegrationDashboardProvisioningTest(t *testing.T) {
|
||||
saveCmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: 1,
|
||||
IsFolder: false,
|
||||
FolderID: dash.ID,
|
||||
FolderID: dash.ID, // nolint:staticcheck
|
||||
FolderUID: dash.UID,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
"id": nil,
|
||||
|
@ -219,7 +219,7 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
|
||||
"tags": []interface{}{},
|
||||
}),
|
||||
Overwrite: true,
|
||||
FolderID: 2,
|
||||
FolderID: 2, // nolint:staticcheck
|
||||
UserID: 100,
|
||||
}
|
||||
dash, err := dashboardStore.SaveDashboard(context.Background(), cmd)
|
||||
@ -234,7 +234,7 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
|
||||
"title": "folderId",
|
||||
"tags": []interface{}{},
|
||||
}),
|
||||
FolderID: 0,
|
||||
FolderID: 0, // nolint:staticcheck
|
||||
Overwrite: true,
|
||||
UserID: 100,
|
||||
}
|
||||
@ -1151,7 +1151,7 @@ func insertTestDashboard(t *testing.T, dashboardStore dashboards.Store, title st
|
||||
t.Helper()
|
||||
cmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: orgId,
|
||||
FolderID: folderId,
|
||||
FolderID: folderId, // nolint:staticcheck
|
||||
FolderUID: folderUID,
|
||||
IsFolder: isFolder,
|
||||
Dashboard: simplejson.NewFromAny(map[string]interface{}{
|
||||
@ -1173,7 +1173,7 @@ func insertTestDashboardForPlugin(t *testing.T, dashboardStore dashboards.Store,
|
||||
t.Helper()
|
||||
cmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: orgId,
|
||||
FolderID: folderId,
|
||||
FolderID: folderId, // nolint:staticcheck
|
||||
IsFolder: isFolder,
|
||||
Dashboard: simplejson.NewFromAny(map[string]interface{}{
|
||||
"id": nil,
|
||||
|
@ -66,6 +66,7 @@ func TestSaveDashboardCommand_GetDashboardModel(t *testing.T) {
|
||||
json := simplejson.New()
|
||||
json.Set("title", "test dash")
|
||||
|
||||
// nolint:staticcheck
|
||||
cmd := &SaveDashboardCommand{Dashboard: json, FolderID: 1, FolderUID: "1"}
|
||||
dash := cmd.GetDashboardModel()
|
||||
|
||||
|
@ -128,7 +128,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
"title": "Dash",
|
||||
}),
|
||||
FolderID: sc.otherSavedFolder.ID,
|
||||
FolderID: sc.otherSavedFolder.ID, // nolint:staticcheck
|
||||
FolderUID: sc.otherSavedFolder.UID,
|
||||
UserID: 10000,
|
||||
Overwrite: true,
|
||||
@ -152,7 +152,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
"title": sc.savedDashInFolder.Title,
|
||||
}),
|
||||
FolderID: sc.savedFolder.ID,
|
||||
FolderID: sc.savedFolder.ID, // nolint:staticcheck
|
||||
FolderUID: sc.savedFolder.UID,
|
||||
UserID: 10000,
|
||||
Overwrite: true,
|
||||
@ -177,7 +177,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"uid": sc.savedDashInFolder.UID,
|
||||
"title": "New dash",
|
||||
}),
|
||||
FolderID: sc.savedFolder.ID,
|
||||
FolderID: sc.savedFolder.ID, // nolint:staticcheck
|
||||
FolderUID: sc.savedFolder.UID,
|
||||
UserID: 10000,
|
||||
Overwrite: true,
|
||||
@ -252,7 +252,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"id": sc.savedDashInGeneralFolder.ID,
|
||||
"title": "Dash",
|
||||
}),
|
||||
FolderID: sc.otherSavedFolder.ID,
|
||||
FolderID: sc.otherSavedFolder.ID, // nolint:staticcheck
|
||||
FolderUID: sc.otherSavedFolder.UID,
|
||||
UserID: 10000,
|
||||
Overwrite: true,
|
||||
@ -277,7 +277,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"id": sc.savedDashInFolder.ID,
|
||||
"title": "Dash",
|
||||
}),
|
||||
FolderID: 0,
|
||||
FolderID: 0, // nolint:staticcheck
|
||||
FolderUID: "",
|
||||
UserID: 10000,
|
||||
Overwrite: true,
|
||||
@ -302,7 +302,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"uid": sc.savedDashInGeneralFolder.UID,
|
||||
"title": "Dash",
|
||||
}),
|
||||
FolderID: sc.otherSavedFolder.ID,
|
||||
FolderID: sc.otherSavedFolder.ID, // nolint:staticcheck
|
||||
FolderUID: sc.otherSavedFolder.UID,
|
||||
UserID: 10000,
|
||||
Overwrite: true,
|
||||
@ -327,7 +327,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"uid": sc.savedDashInFolder.UID,
|
||||
"title": "Dash",
|
||||
}),
|
||||
FolderID: 0,
|
||||
FolderID: 0, // nolint:staticcheck
|
||||
FolderUID: "",
|
||||
UserID: 10000,
|
||||
Overwrite: true,
|
||||
@ -359,7 +359,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"id": nil,
|
||||
"title": sc.savedDashInFolder.Title,
|
||||
}),
|
||||
FolderID: 0,
|
||||
FolderID: 0, // nolint:staticcheck
|
||||
FolderUID: "",
|
||||
Overwrite: shouldOverwrite,
|
||||
}
|
||||
@ -383,7 +383,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"id": nil,
|
||||
"title": sc.savedDashInGeneralFolder.Title,
|
||||
}),
|
||||
FolderID: sc.savedFolder.ID,
|
||||
FolderID: sc.savedFolder.ID, // nolint:staticcheck
|
||||
FolderUID: sc.savedFolder.UID,
|
||||
Overwrite: shouldOverwrite,
|
||||
}
|
||||
@ -475,7 +475,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
"title": "Expect error",
|
||||
}),
|
||||
FolderID: 123412321,
|
||||
FolderID: 123412321, // nolint:staticcheck
|
||||
FolderUID: "123412321",
|
||||
Overwrite: shouldOverwrite,
|
||||
}
|
||||
@ -492,7 +492,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"id": sc.savedDashInGeneralFolder.ID,
|
||||
"title": "test dash 23",
|
||||
}),
|
||||
FolderID: sc.savedFolder.ID,
|
||||
FolderID: sc.savedFolder.ID, // nolint:staticcheck
|
||||
FolderUID: sc.savedFolder.UID,
|
||||
Overwrite: shouldOverwrite,
|
||||
}
|
||||
@ -510,7 +510,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"title": "Updated title",
|
||||
"version": sc.savedDashInGeneralFolder.Version,
|
||||
}),
|
||||
FolderID: sc.savedFolder.ID,
|
||||
FolderID: sc.savedFolder.ID, // nolint:staticcheck
|
||||
FolderUID: sc.savedFolder.UID,
|
||||
Overwrite: shouldOverwrite,
|
||||
}
|
||||
@ -534,7 +534,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"uid": sc.savedDashInFolder.UID,
|
||||
"title": "test dash 23",
|
||||
}),
|
||||
FolderID: 0,
|
||||
FolderID: 0, // nolint:staticcheck
|
||||
FolderUID: "",
|
||||
Overwrite: shouldOverwrite,
|
||||
}
|
||||
@ -552,7 +552,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"title": "Updated title",
|
||||
"version": sc.savedDashInFolder.Version,
|
||||
}),
|
||||
FolderID: 0,
|
||||
FolderID: 0, // nolint:staticcheck
|
||||
FolderUID: "",
|
||||
Overwrite: shouldOverwrite,
|
||||
}
|
||||
@ -629,7 +629,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"id": sc.savedDashInGeneralFolder.ID,
|
||||
"title": "Updated title",
|
||||
}),
|
||||
FolderID: sc.savedFolder.ID,
|
||||
FolderID: sc.savedFolder.ID, // nolint:staticcheck
|
||||
FolderUID: sc.savedFolder.UID,
|
||||
Overwrite: shouldOverwrite,
|
||||
}
|
||||
@ -652,7 +652,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||
"uid": sc.savedDashInFolder.UID,
|
||||
"title": "Updated title",
|
||||
}),
|
||||
FolderID: 0,
|
||||
FolderID: 0, // nolint:staticcheck
|
||||
FolderUID: "",
|
||||
Overwrite: shouldOverwrite,
|
||||
}
|
||||
@ -995,7 +995,7 @@ func saveTestDashboard(t *testing.T, title string, orgID, folderID int64, folder
|
||||
|
||||
cmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: orgID,
|
||||
FolderID: folderID,
|
||||
FolderID: folderID, // nolint:staticcheck
|
||||
FolderUID: folderUID,
|
||||
IsFolder: false,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
@ -1040,7 +1040,7 @@ func saveTestFolder(t *testing.T, title string, orgID int64, sqlStore db.DB) *da
|
||||
t.Helper()
|
||||
cmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: orgID,
|
||||
FolderID: 0,
|
||||
FolderID: 0, // nolint:staticcheck
|
||||
FolderUID: "",
|
||||
IsFolder: true,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
|
@ -139,7 +139,7 @@ func insertTestDashboard(t *testing.T, sqlStore db.DB, title string, orgId int64
|
||||
t.Helper()
|
||||
cmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: orgId,
|
||||
FolderID: folderId,
|
||||
FolderID: folderId, // nolint:staticcheck
|
||||
FolderUID: folderUID,
|
||||
IsFolder: isFolder,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
|
@ -101,7 +101,7 @@ func insertTestDashboard(t *testing.T, dashboardStore dashboards.Store, title st
|
||||
t.Helper()
|
||||
cmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: orgId,
|
||||
FolderID: folderID,
|
||||
FolderID: folderID, // nolint:staticcheck
|
||||
FolderUID: folderUID,
|
||||
IsFolder: false,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
@ -122,7 +122,7 @@ func insertTestFolder(t *testing.T, dashboardStore dashboards.Store, title strin
|
||||
t.Helper()
|
||||
cmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: orgId,
|
||||
FolderID: folderId,
|
||||
FolderID: folderId, // nolint:staticcheck
|
||||
FolderUID: folderUID,
|
||||
IsFolder: true,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
|
@ -291,7 +291,7 @@ func TestIntegrationUnauthenticatedUserCanGetPubdashPanelQueryData(t *testing.T)
|
||||
// Create Dashboard
|
||||
saveDashboardCmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
FolderUID: "1",
|
||||
IsFolder: false,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
|
@ -873,7 +873,7 @@ func insertTestDashboard(t *testing.T, dashboardStore dashboards.Store, title st
|
||||
t.Helper()
|
||||
cmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: orgId,
|
||||
FolderID: folderId,
|
||||
FolderID: folderId, // nolint:staticcheck
|
||||
FolderUID: folderUID,
|
||||
IsFolder: isFolder,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
|
@ -1855,7 +1855,7 @@ func insertTestDashboard(t *testing.T, dashboardStore dashboards.Store, title st
|
||||
|
||||
cmd := dashboards.SaveDashboardCommand{
|
||||
OrgID: orgId,
|
||||
FolderID: folderId,
|
||||
FolderID: folderId, // nolint:staticcheck
|
||||
FolderUID: folderUID,
|
||||
IsFolder: isFolder,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
|
@ -866,7 +866,7 @@ func setupNestedTest(t *testing.T, usr *user.SignedInUser, perms []accesscontrol
|
||||
// create dashboard under parent folder
|
||||
_, err = dashStore.SaveDashboard(context.Background(), dashboards.SaveDashboardCommand{
|
||||
OrgID: orgID,
|
||||
FolderID: parent.ID,
|
||||
FolderID: parent.ID, // nolint:staticcheck
|
||||
FolderUID: parent.UID,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
"title": "dashboard under parent folder",
|
||||
@ -877,7 +877,7 @@ func setupNestedTest(t *testing.T, usr *user.SignedInUser, perms []accesscontrol
|
||||
// create dashboard under subfolder
|
||||
_, err = dashStore.SaveDashboard(context.Background(), dashboards.SaveDashboardCommand{
|
||||
OrgID: orgID,
|
||||
FolderID: subfolder.ID,
|
||||
FolderID: subfolder.ID, // nolint:staticcheck
|
||||
FolderUID: subfolder.UID,
|
||||
Dashboard: simplejson.NewFromAny(map[string]any{
|
||||
"title": "dashboard under subfolder",
|
||||
|
Loading…
Reference in New Issue
Block a user