mirror of
https://github.com/prymitive/karma
synced 2026-05-09 03:36:44 +00:00
Merge pull request #63 from cloudflare/inhibited-green
If we only have silenced or inhibited alerts make the whole alert gro…
This commit is contained in:
@@ -186,7 +186,7 @@
|
||||
<script type="application/json" id="alert-group">
|
||||
<div class="incident" id="<%= group.id %>" data-hash="<%= group.hash %>">
|
||||
<% var cls_panel = 'panel-success' %>
|
||||
<% if (group.unsilencedCount > 0) { cls_panel = 'panel-danger' } %>
|
||||
<% if (group.activeCount > 0) { cls_panel = 'panel-danger' } %>
|
||||
<div class="panel <%= cls_panel %>">
|
||||
<div class="panel-heading text-center">
|
||||
<%= Templates.Render('alertGroupTitle', {group: group}) %>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -67,12 +67,11 @@ func (a AlertList) Less(i, j int) bool {
|
||||
// There is a hash computed from all alerts, it's used by UI to quickly tell
|
||||
// if there was any change in a group and it needs to refresh it
|
||||
type AlertGroup struct {
|
||||
Labels map[string]string `json:"labels"`
|
||||
Alerts AlertList `json:"alerts"`
|
||||
ID string `json:"id"`
|
||||
Hash string `json:"hash"`
|
||||
SilencedCount int `json:"silencedCount"`
|
||||
UnsilencedCount int `json:"unsilencedCount"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
Alerts AlertList `json:"alerts"`
|
||||
ID string `json:"id"`
|
||||
Hash string `json:"hash"`
|
||||
ActiveCount int `json:"activeCount"`
|
||||
}
|
||||
|
||||
// Filter holds returned data on any filter passed by the user as part of the query
|
||||
|
||||
6
views.go
6
views.go
@@ -159,15 +159,17 @@ func alerts(c *gin.Context) {
|
||||
if silence := store.Store.GetSilence(alert.Silenced); silence != nil {
|
||||
silences[alert.Silenced] = *silence
|
||||
}
|
||||
agCopy.SilencedCount++
|
||||
countLabel(counters, "@silenced", "true")
|
||||
} else {
|
||||
agCopy.UnsilencedCount++
|
||||
countLabel(counters, "@silenced", "false")
|
||||
}
|
||||
|
||||
countLabel(counters, "@inhibited", strconv.FormatBool(alert.Inhibited))
|
||||
|
||||
if alert.Silenced == "" && !alert.Inhibited {
|
||||
agCopy.ActiveCount++
|
||||
}
|
||||
|
||||
for key, value := range alert.Labels {
|
||||
if keyMap, foundKey := store.Store.Colors[key]; foundKey {
|
||||
if color, foundColor := keyMap[value]; foundColor {
|
||||
|
||||
Reference in New Issue
Block a user