diff --git a/web/alerts.go b/web/alerts.go index 430f17d30..5e88024ae 100644 --- a/web/alerts.go +++ b/web/alerts.go @@ -21,7 +21,8 @@ import ( ) type AlertStatus struct { - AlertingRules []*rules.AlertingRule + AlertingRules []*rules.AlertingRule + AlertStateToRowClass map[rules.AlertState]string } type AlertsHandler struct { @@ -56,6 +57,11 @@ func (h *AlertsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { alertStatus := AlertStatus{ AlertingRules: alertsSorter.alerts, + AlertStateToRowClass: map[rules.AlertState]string{ + rules.INACTIVE: "success", + rules.PENDING: "warning", + rules.FIRING: "error", + }, } executeTemplate(w, "alerts", alertStatus) } diff --git a/web/static/css/alerts.css b/web/static/css/alerts.css index 5c57ed237..ea95be1f4 100644 --- a/web/static/css/alerts.css +++ b/web/static/css/alerts.css @@ -1,48 +1,19 @@ -.alert_wrapper { - padding: 2px; -} - .alert_header { - padding: 3px; cursor: pointer; } -.alert_content { - padding: 3px; +.alert_details { display: none; } -.alert_header.firing { - background-color: #ff7673; -} - -.alert_header.pending { - background-color: #ffcf40; -} - -.alert_header.inactive { - background-color: #92ed6b; +.alert_rule { + padding: 5px; + color: #333; + background-color: #ddd; + font-family: monospace; + font-weight: normal; } .alert_description { - margin-left: 3px; padding: 8px 0 8px 0; } - -.alert_active_elements { - border: 1px solid #dddddd; -} - -.alert_active_elements th { - background-color: #dddddd; - padding: 0 5px 0 5px; -} - -.alert_active_elements td { - background-color: #eebbbb; - padding: 0 5px 0 5px; -} - -.alert_active_elements tr:hover td { - background-color: #ffcf40; -} diff --git a/web/static/css/prometheus.css b/web/static/css/prometheus.css index f4cd6119f..035153a12 100644 --- a/web/static/css/prometheus.css +++ b/web/static/css/prometheus.css @@ -1,12 +1,5 @@ body { - font-family: Arial, sans-serif; - font-size: 14px; - line-height: 20px; - color: #333; - background-color: #f2f2f2; - margin: 0px; - padding: 40px 0 0 0; - + padding-top: 40px; } .error_text { diff --git a/web/static/js/alerts.js b/web/static/js/alerts.js index b66c82b02..25fc07b46 100644 --- a/web/static/js/alerts.js +++ b/web/static/js/alerts.js @@ -1,5 +1,14 @@ function init() { - $(".alert_header").click(function() {$(this).next().toggle(); }); + $(".alert_header").click(function() { + var expanderIcon = $(this).find("i.icon-chevron-down"); + if (expanderIcon.length != 0) { + expanderIcon.removeClass("icon-chevron-down").addClass("icon-chevron-up"); + } else { + var collapserIcon = $(this).find("i.icon-chevron-up"); + collapserIcon.removeClass("icon-chevron-up").addClass("icon-chevron-down"); + } + $(this).next().toggle(); + }); } $(init); diff --git a/web/templates/alerts.html b/web/templates/alerts.html index 0f7407496..6219ebd19 100644 --- a/web/templates/alerts.html +++ b/web/templates/alerts.html @@ -4,28 +4,31 @@ {{end}} {{define "content"}} -

Alerts

-
- {{range .AlertingRules}} +
+

Alerts

+ + + {{$alertStateToRowClass := .AlertStateToRowClass}} + {{range .AlertingRules}} {{$activeAlerts := .ActiveAlerts}} -
-
- {{.Name}} ({{len $activeAlerts}} active) -
-
+
+ + + + + + {{end}} + +
{{.Name}} ({{len $activeAlerts}} active)
- Rule: {{.HTMLSnippet}} + {{.HTMLSnippet}}
{{if $activeAlerts}} - - +
+ {{range $activeAlerts}} - + @@ -34,8 +37,10 @@ {{end}}
Labels State Active Since Value
{{.Labels}} {{.State}} {{.ActiveSince}}
{{end}} - - - {{end}} - +
+
{{end}}