mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Deprecate ID from Folder (#78281)
* Chore: Deprecate ID from Folder * chore: add more linter comments * chore: add missing lint comment
This commit is contained in:
@@ -161,6 +161,7 @@ func (srv RulerSrv) RouteGetNamespaceRulesConfig(c *contextmodel.ReqContext, nam
|
||||
result := apimodels.NamespaceConfigResponse{}
|
||||
|
||||
for groupKey, rules := range ruleGroups {
|
||||
// nolint:staticcheck
|
||||
result[namespaceTitle] = append(result[namespaceTitle], toGettableRuleGroupConfig(groupKey.RuleGroup, rules, namespace.ID, provenanceRecords))
|
||||
}
|
||||
|
||||
@@ -190,6 +191,7 @@ func (srv RulerSrv) RouteGetRulesGroupConfig(c *contextmodel.ReqContext, namespa
|
||||
}
|
||||
|
||||
result := apimodels.RuleGroupConfigResponse{
|
||||
// nolint:staticcheck
|
||||
GettableRuleGroupConfig: toGettableRuleGroupConfig(ruleGroup, rules, namespace.ID, provenanceRecords),
|
||||
}
|
||||
return response.JSON(http.StatusAccepted, result)
|
||||
@@ -239,6 +241,7 @@ func (srv RulerSrv) RouteGetRulesConfig(c *contextmodel.ReqContext) response.Res
|
||||
continue
|
||||
}
|
||||
namespace := folder.Title
|
||||
// nolint:staticcheck
|
||||
result[namespace] = append(result[namespace], toGettableRuleGroupConfig(groupKey.RuleGroup, rules, folder.ID, provenanceRecords))
|
||||
}
|
||||
return response.JSON(http.StatusOK, result)
|
||||
|
||||
@@ -85,7 +85,7 @@ func validGroup(cfg *setting.UnifiedAlertingSettings, rules ...apimodels.Postabl
|
||||
|
||||
func randFolder() *folder.Folder {
|
||||
return &folder.Folder{
|
||||
ID: rand.Int63(),
|
||||
ID: rand.Int63(), // nolint:staticcheck
|
||||
UID: util.GenerateShortUID(),
|
||||
Title: "TEST-FOLDER-" + util.GenerateShortUID(),
|
||||
// URL: "",
|
||||
|
||||
@@ -103,6 +103,7 @@ func (om *OrgMigration) getOrCreateMigratedFolder(ctx context.Context, l log.Log
|
||||
|
||||
// Check if the dashboard has custom permissions. If it does, we need to create a new folder for it.
|
||||
// This folder will be cached for re-use for each dashboard in the folder with the same permissions.
|
||||
// nolint:staticcheck
|
||||
permissionsToFolder, ok := om.permissionsMap[parentFolder.ID]
|
||||
if !ok {
|
||||
permissionsToFolder = make(map[permissionHash]*folder.Folder)
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
func Test_subscribeToFolderChanges(t *testing.T) {
|
||||
orgID := rand.Int63()
|
||||
folder := &folder.Folder{
|
||||
ID: 0,
|
||||
ID: 0, // nolint:staticcheck
|
||||
UID: util.GenerateShortUID(),
|
||||
Title: "Folder" + util.GenerateShortUID(),
|
||||
}
|
||||
@@ -42,7 +42,7 @@ func Test_subscribeToFolderChanges(t *testing.T) {
|
||||
err := bus.Publish(context.Background(), &events.FolderTitleUpdated{
|
||||
Timestamp: time.Now(),
|
||||
Title: "Folder" + util.GenerateShortUID(),
|
||||
ID: folder.ID,
|
||||
ID: folder.ID, // nolint:staticcheck
|
||||
UID: folder.UID,
|
||||
OrgID: orgID,
|
||||
})
|
||||
|
||||
@@ -458,7 +458,7 @@ func (st DBstore) GetUserVisibleNamespaces(ctx context.Context, orgID int64, use
|
||||
continue
|
||||
}
|
||||
namespaceMap[hit.UID] = &folder.Folder{
|
||||
ID: hit.ID,
|
||||
ID: hit.ID, // nolint:staticcheck
|
||||
UID: hit.UID,
|
||||
Title: hit.Title,
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ func withUIDs(uids map[string]*models.AlertRule) func(rule *models.AlertRule) {
|
||||
|
||||
func randFolder() *folder.Folder {
|
||||
return &folder.Folder{
|
||||
ID: rand.Int63(),
|
||||
ID: rand.Int63(), // nolint:staticcheck
|
||||
UID: util.GenerateShortUID(),
|
||||
Title: "TEST-FOLDER-" + util.GenerateShortUID(),
|
||||
URL: "",
|
||||
|
||||
@@ -68,7 +68,7 @@ mainloop:
|
||||
}
|
||||
if existing == nil {
|
||||
folders = append(folders, &folder.Folder{
|
||||
ID: rand.Int63(),
|
||||
ID: rand.Int63(), // nolint:staticcheck
|
||||
UID: r.NamespaceUID,
|
||||
Title: "TEST-FOLDER-" + util.GenerateShortUID(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user