diff --git a/internal/models/api.go b/internal/models/api.go index b998d790c..0d59c5c4a 100644 --- a/internal/models/api.go +++ b/internal/models/api.go @@ -33,15 +33,16 @@ type LabelsCountMap map[string]map[string]int // AlertsResponse is the structure of JSON response UI will use to get alert data type AlertsResponse struct { - Status string `json:"status"` - Timestamp string `json:"timestamp"` - Version string `json:"version"` - Upstreams AlertmanagerAPISummary `json:"upstreams"` - AlertGroups map[string]AlertGroup `json:"groups"` - TotalAlerts int `json:"totalAlerts"` - Colors LabelsColorMap `json:"colors"` - Filters []Filter `json:"filters"` - Counters LabelsCountMap `json:"counters"` + Status string `json:"status"` + Timestamp string `json:"timestamp"` + Version string `json:"version"` + Upstreams AlertmanagerAPISummary `json:"upstreams"` + AlertGroups map[string]AlertGroup `json:"groups"` + TotalAlerts int `json:"totalAlerts"` + Colors LabelsColorMap `json:"colors"` + Filters []Filter `json:"filters"` + Counters LabelsCountMap `json:"counters"` + StaticColorLabels []string `json:"staticColorLabels"` } // Autocomplete is the structure of autocomplete object for filter hints diff --git a/views.go b/views.go index 864b1f84c..588faab39 100644 --- a/views.go +++ b/views.go @@ -8,6 +8,7 @@ import ( "time" "github.com/prymitive/unsee/internal/alertmanager" + "github.com/prymitive/unsee/internal/config" "github.com/prymitive/unsee/internal/models" "github.com/prymitive/unsee/internal/slices" @@ -50,6 +51,7 @@ func alerts(c *gin.Context) { resp.Timestamp = string(ts) resp.Version = version resp.Upstreams = getUpstreams() + resp.StaticColorLabels = config.Config.Labels.Color.Static // use full URI (including query args) as cache key cacheKey := c.Request.RequestURI