Skip to content

Commit 9395248

Browse files
authored
Merge pull request #1621 from ankit1ank/master
Use different colors for table rows on ring status page
2 parents 1def96f + e4c9ccc commit 9395248

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/ring/http.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ const tpl = `
4040
</tr>
4141
</thead>
4242
<tbody>
43-
{{ range .Ingesters }}
43+
{{ range $i, $ing := .Ingesters }}
44+
{{ if mod $i 2 }}
4445
<tr>
46+
{{ else }}
47+
<tr bgcolor="#BEBEBE">
48+
{{ end }}
4549
<td>{{ .ID }}</td>
4650
<td>{{ .State }}</td>
4751
<td>{{ .Address }}</td>
@@ -61,7 +65,9 @@ const tpl = `
6165
var tmpl *template.Template
6266

6367
func init() {
64-
tmpl = template.Must(template.New("webpage").Parse(tpl))
68+
t := template.New("webpage")
69+
t.Funcs(template.FuncMap{"mod": func(i, j int) bool { return i%j == 0 }})
70+
tmpl = template.Must(t.Parse(tpl))
6571
}
6672

6773
func (r *Ring) forget(ctx context.Context, id string) error {

0 commit comments

Comments
 (0)