mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 08:05:43 -06:00
Chore: Deprecate folderID from dashboardIdentity (#77650)
This commit is contained in:
parent
4e57324d58
commit
1c758ab5f2
@ -243,6 +243,7 @@ func (fr *FileReader) saveDashboard(ctx context.Context, path string, folderID i
|
||||
// keeps track of which UIDs and titles we have already provisioned
|
||||
dash := jsonFile.dashboard
|
||||
provisioningMetadata.uid = dash.Dashboard.UID
|
||||
// nolint:staticcheck
|
||||
provisioningMetadata.identity = dashboardIdentity{title: dash.Dashboard.Title, folderID: dash.Dashboard.FolderID}
|
||||
|
||||
// fix empty folder_uid from already provisioned dashboards
|
||||
@ -480,6 +481,7 @@ type provisioningMetadata struct {
|
||||
}
|
||||
|
||||
type dashboardIdentity struct {
|
||||
// Deprecated: use FolderUID instead
|
||||
folderID int64
|
||||
title string
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ func (c *duplicateValidator) logWarnings(duplicatesByOrg map[int64]duplicateEntr
|
||||
|
||||
for id, usage := range duplicates.Titles {
|
||||
if usage.Sum > 1 {
|
||||
// nolint:staticcheck
|
||||
c.logger.Warn("dashboard title is not unique in folder", "orgId", orgID, "title", id.title, "folderID", id.folderID, "times",
|
||||
usage.Sum, "providers", keysToSlice(usage.InvolvedReaders))
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ func TestDuplicatesValidator(t *testing.T) {
|
||||
folderID, _, err := r.getOrCreateFolder(context.Background(), cfg, fakeService, folderName)
|
||||
require.NoError(t, err)
|
||||
|
||||
// nolint:staticcheck
|
||||
identity := dashboardIdentity{folderID: folderID, title: "Grafana"}
|
||||
|
||||
cfg1 := &config{
|
||||
@ -95,6 +96,7 @@ func TestDuplicatesValidator(t *testing.T) {
|
||||
folderID, _, err := r.getOrCreateFolder(context.Background(), cfg, fakeService, folderName)
|
||||
require.NoError(t, err)
|
||||
|
||||
// nolint:staticcheck
|
||||
identity := dashboardIdentity{folderID: folderID, title: "Grafana"}
|
||||
|
||||
cfg1 := &config{
|
||||
@ -197,6 +199,7 @@ func TestDuplicatesValidator(t *testing.T) {
|
||||
folderID, _, err := r.getOrCreateFolder(context.Background(), cfg, fakeService, cfg1.Folder)
|
||||
require.NoError(t, err)
|
||||
|
||||
// nolint:staticcheck
|
||||
identity := dashboardIdentity{folderID: folderID, title: "Grafana"}
|
||||
|
||||
require.Equal(t, uint8(2), duplicates[1].UIDs["Z-phNqGmz"].Sum)
|
||||
@ -214,6 +217,7 @@ func TestDuplicatesValidator(t *testing.T) {
|
||||
folderID, _, err = r.getOrCreateFolder(context.Background(), cfg3, fakeService, cfg3.Folder)
|
||||
require.NoError(t, err)
|
||||
|
||||
// nolint:staticcheck
|
||||
identity = dashboardIdentity{folderID: folderID, title: "Grafana"}
|
||||
|
||||
require.Equal(t, uint8(2), duplicates[2].UIDs["Z-phNqGmz"].Sum)
|
||||
|
Loading…
Reference in New Issue
Block a user