mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Update rules version when folder title is updated (#53013)
* remove support for bus from scheduler * rename event to FolderTitleUpdated and fire only if title has changed * add method to increase version of all rules that belong to a folder * update ngalert service to subscribe to folder title change event call data store and update scheduler * add tests
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/data"
|
||||
|
||||
models2 "github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
)
|
||||
|
||||
@@ -132,6 +133,18 @@ func WithSequentialGroupIndex() AlertRuleMutator {
|
||||
}
|
||||
}
|
||||
|
||||
func WithOrgID(orgId int64) AlertRuleMutator {
|
||||
return func(rule *AlertRule) {
|
||||
rule.OrgID = orgId
|
||||
}
|
||||
}
|
||||
|
||||
func WithNamespace(namespace *models2.Folder) AlertRuleMutator {
|
||||
return func(rule *AlertRule) {
|
||||
rule.NamespaceUID = namespace.Uid
|
||||
}
|
||||
}
|
||||
|
||||
func GenerateAlertLabels(count int, prefix string) data.Labels {
|
||||
labels := make(data.Labels, count)
|
||||
for i := 0; i < count; i++ {
|
||||
|
||||
Reference in New Issue
Block a user