Improve display of silence labels in index view.

This commit is contained in:
Julius Volz 2013-08-09 16:02:05 +02:00
parent aaf3b8b942
commit 5fabdee4b0
3 changed files with 11 additions and 7 deletions

View File

@ -22,8 +22,10 @@ import (
type Filters []*Filter
type Filter struct {
Name *regexp.Regexp
Value *regexp.Regexp
Name *regexp.Regexp
Value *regexp.Regexp
NamePattern string
ValuePattern string
fingerprint uint64
}
@ -33,9 +35,11 @@ func NewFilter(namePattern string, valuePattern string) *Filter {
fmt.Fprintf(summer, namePattern, valuePattern)
return &Filter{
Name: regexp.MustCompile("^" + namePattern + "$"),
Value: regexp.MustCompile("^" + valuePattern + "$"),
fingerprint: summer.Sum64(),
Name: regexp.MustCompile("^" + namePattern + "$"),
Value: regexp.MustCompile("^" + valuePattern + "$"),
NamePattern: namePattern,
ValuePattern: valuePattern,
fingerprint: summer.Sum64(),
}
}

View File

@ -35,7 +35,7 @@
<td>
{{range $label, $value := .Event.Labels}}
{{if not (eq $label "alertname")}}
<span class="label label-info"><b>{{$label}}</b>="{{$value}}"</span>
<span class="label label-info">{{$label}}="{{$value}}"</span>
{{end}}
{{end}}
<form class="add_silence_form">

View File

@ -25,7 +25,7 @@
<td>{{.Id}}</td>
<td>
{{range .Filters}}
<b>{{.Name}}</b>="{{.Value}}",
<span class="label label-info">{{.NamePattern}}="{{.ValuePattern}}"</span>
{{end}}
</td>
<td>{{.CreatedBy}}</td>