prometheus/web/ui/templates/rules.html
Julius Volz 3470ee1fbf
Make React UI the default, keep old UI under /classic (#8142)
The React app's assets are now served under /assets, while all old
custom web assets (including the ones for console templates) are now
served from /classic/static.

I tested different combinations of --web.external-url and
--web.route-prefix with proxies in front, and I couldn't find a problem
yet with the routing. Console templates also still work.

While migrating old endpoints to /classic, I noticed that /version was
being treated like a lot of the old UI pages, with readiness check
handler in front of it, etc. I kept it in /version and removed that
readiness wrapper, since it doesn't seem to be needed for that endpoint.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2020-11-03 14:51:48 +01:00

55 lines
1.9 KiB
HTML

{{define "head"}}
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/classic/static/css/rules.css?v={{ buildVersion }}">
{{end}}
{{define "content"}}
<div class="container-fluid">
<h2>Rules</h2>
<table class="table table-bordered">
{{range .RuleGroups}}
<thead>
<tr>
<td colspan="3"><h2><a href="#{{reReplaceAll "([^a-zA-Z0-9])" "$1" .Name}}" id="{{reReplaceAll "([^a-zA-Z0-9])" "$1" .Name}}">{{.Name}}</a></h2></td>
<td><h2>{{if .GetLastEvaluation.IsZero}}Never{{else}}{{since .GetLastEvaluation}} ago{{end}}</h2></td>
<td><h2>{{humanizeDuration .GetEvaluationTime.Seconds}}</h2></td>
</tr>
</thead>
<tbody>
<tr>
<td style="font-weight:bold">Rule</td>
<td style="font-weight:bold">State</td>
<td style="font-weight:bold">Error</td>
<td style="font-weight:bold">Last Evaluation</td>
<td style="font-weight:bold">Evaluation Time</td>
</tr>
{{range .Rules}}
<tr>
<td class="rule_cell">{{.HTMLSnippet (print pathPrefix (print pathPrefix "/classic"))}}</td>
<td class="state">
<span class="alert alert-{{ .Health | ruleHealthToClass }} state_indicator text-uppercase">
{{.Health}}
</span>
</td>
<td class="errors">
{{if .LastError}}
<span class="alert alert-danger state_indicator">{{.LastError}}</span>
{{end}}
</td>
<td>
{{if .GetEvaluationTimestamp.IsZero}}Never{{else}}{{since .GetEvaluationTimestamp}} ago{{end}}
</td>
<td>{{humanizeDuration .GetEvaluationDuration.Seconds}}</td>
</tr>
{{end}}
{{else}}
<tr>
<td>
No rules defined
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{end}}