Alerting: Validate that tags are 100 characters or less (#62335) (#62594)

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
(cherry picked from commit 0dacb11a12)
This commit is contained in:
George Robinson
2023-01-31 14:39:56 +00:00
committed by GitHub
parent a63895ff24
commit 1c6fcb8ed4
3 changed files with 30 additions and 11 deletions
+11 -2
View File
@@ -92,8 +92,17 @@ type Alert struct {
Settings *simplejson.Json
}
func (a *Alert) ValidToSave() bool {
return a.DashboardId != 0 && a.OrgId != 0 && a.PanelId != 0
func (a *Alert) ValidDashboardPanel() bool {
return a.OrgId != 0 && a.DashboardId != 0 && a.PanelId != 0
}
func (a *Alert) ValidTags() bool {
for _, tag := range a.GetTagsFromSettings() {
if len(tag.Key) > 100 || len(tag.Value) > 100 {
return false
}
}
return true
}
func (a *Alert) ContainsUpdates(other *Alert) bool {