-
Notifications
You must be signed in to change notification settings - Fork 0
/
log_rule_summary.templ
40 lines (37 loc) · 1004 Bytes
/
log_rule_summary.templ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -*- html -*-
package main
import "strconv"
templ rsSortedHeader(st State, h *rsSortHeader, c mainConfig) {
<th scope="col">
<a href={ h.ActionLink("/", c.RSSort) }>
{ h.Title }
if h.ID() == c.RSSort {
<i class="bi bi-arrow-down"></i>
}
if h.ID() == -c.RSSort {
<i class="bi bi-arrow-up"></i>
}
</a>
</th>
}
templ RuleSummary(st State, c mainConfig) {
<!-- TODO: Should this be here or in separate sub-tab? -->
<table class="table table-striped table-hover">
<thead>
@rsSortedHeader(st, rsSource, c)
@rsSortedHeader(st, rsRules, c)
@rsSortedHeader(st, rsHits, c)
@rsSortedHeader(st, rsHitsPerRule, c)
</thead>
<tbody>
for _, rstat := range rsSortedRules(st.RuleStats(), c.RSSort) {
<tr>
<td><a href={ rstat.SearchLink() }>{ rstat.Source }</a></td>
<td>{ strconv.Itoa(rstat.RuleCount) }</td>
<td>{ strconv.Itoa(rstat.Hits) }</td>
<td>{ strconv.Itoa(rstat.Hits / rstat.RuleCount) }</td>
</tr>
}
</tbody>
</table>
}