git » gofer » commit 2bcc3b0

nettrace: Tidy up templates, and include all links

author Alberto Bertogli
2022-11-13 11:14:38 UTC
committer Alberto Bertogli
2023-01-22 21:56:59 UTC
parent 38e5e5539188be004e39c1207fe4c421d2072744

nettrace: Tidy up templates, and include all links

nettrace/templates/_latency.html.tmpl +4 -5
nettrace/templates/index.html.tmpl +24 -24
nettrace/templates/style.css +5 -1

diff --git a/nettrace/templates/_latency.html.tmpl b/nettrace/templates/_latency.html.tmpl
index 8ca3819..07c026a 100644
--- a/nettrace/templates/_latency.html.tmpl
+++ b/nettrace/templates/_latency.html.tmpl
@@ -11,15 +11,14 @@
 {{range .Latencies.Counts}}
 <tr>
   <td>
-	{{if gt .Count 0}}<a href="?fam={{$.Family}}&b={{.BucketIdx}}">
-		&ge;{{.Start}}</a>
-	{{else}}<span class="muted">&ge;{{.Start}}</span>
-	{{end}}
+    <a href="?fam={{$.Family}}&b={{.BucketIdx}}"
+       {{if eq .Count 0}}class="muted"{{end}}>
+        &ge;{{.Start}}</a>
   </td>
   <td>{{.Count}}</td>
   <td>{{.Percent | printf "%5.2f"}}%</td>
   <td><meter max="100" value="{{.Percent}}">
-  	{{.Percent | printf "%.2f"}}%</meter>
+      {{.Percent | printf "%.2f"}}%</meter>
   <td>{{.CumPct | printf "%5.2f"}}%</td>
 </tr>
 {{end}}
diff --git a/nettrace/templates/index.html.tmpl b/nettrace/templates/index.html.tmpl
index 3ebd899..8909c34 100644
--- a/nettrace/templates/index.html.tmpl
+++ b/nettrace/templates/index.html.tmpl
@@ -22,46 +22,46 @@
 {{range $name, $ftr := .FamTraces}}
 <tr>
   <td class="family">
+    <a href="?fam={{$name}}&b=0&all=true">
     {{if eq $name $.Family}}<u>{{end}}
-	{{$name}}
-	{{if eq $name $.Family}}</u>{{end}}
+    {{$name}}
+    {{if eq $name $.Family}}</u>{{end}}
+    </a>
   </td>
 
   <td class="bucket active">
-  	{{$n := $ftr.LenActive}}
-	{{if and (eq $name $.Family) (eq "active" $.BucketStr)}}<u>{{end}}
+    {{$n := $ftr.LenActive}}
+    {{if and (eq $name $.Family) (eq "active" $.BucketStr)}}<u>{{end}}
 
-	{{if gt $n 0}}<a href="?fam={{$name}}&b=-1&all={{$.AllGT}}">
-		{{$n}} active</a>
-	{{else}}<span class="muted">0 active</span>
-	{{end}}
+    <a href="?fam={{$name}}&b=-1&all={{$.AllGT}}"
+       {{if eq $n 0}}class="muted"{{end}}>
+        {{$n}} active</a>
 
-	{{if and (eq $name $.Family) (eq "active" $.BucketStr)}}</u>{{end}}
+    {{if and (eq $name $.Family) (eq "active" $.BucketStr)}}</u>{{end}}
   </td>
 
   {{range $i, $b := $.Buckets}}
   <td class="bucket">
-  	{{$n := $ftr.LenBucket $i}}
-	{{if and (eq $name $.Family) (eq $b.String $.BucketStr)}}<u>{{end}}
+    {{$n := $ftr.LenBucket $i}}
+    {{if and (eq $name $.Family) (eq $b.String $.BucketStr)}}<u>{{end}}
 
-	{{if gt $n 0}}<a href="?fam={{$name}}&b={{$i}}&all={{$.AllGT}}">
-		&ge;{{$b}}</a>
-	{{else}}<span class="muted">&ge;{{$b}}</span>
-	{{end}}
+    <a href="?fam={{$name}}&b={{$i}}&all={{$.AllGT}}"
+       {{if eq $n 0}}class="muted"{{end}}>
+        &ge;{{$b}}</a>
 
-	{{if and (eq $name $.Family) (eq $b.String $.BucketStr)}}</u>{{end}}
+    {{if and (eq $name $.Family) (eq $b.String $.BucketStr)}}</u>{{end}}
   </td>
   {{end}}
 
   <td class="bucket">
-  	{{$n := $ftr.LenErrors}}
-	{{if and (eq $name $.Family) (eq "errors" $.BucketStr)}}<u>{{end}}
-	
-	{{if gt $n 0}}<a href="?fam={{$name}}&b=-2&all={{$.AllGT}}">errors</a>
-	{{else}}<span class="muted">errors</span>
-	{{end}}
-
-	{{if and (eq $name $.Family) (eq "errors" $.BucketStr)}}</u>{{end}}
+    {{$n := $ftr.LenErrors}}
+    {{if and (eq $name $.Family) (eq "errors" $.BucketStr)}}<u>{{end}}
+
+    <a href="?fam={{$name}}&b=-2&all={{$.AllGT}}"
+       {{if eq $n 0}}class="muted"{{end}}>
+        errors</a>
+
+    {{if and (eq $name $.Family) (eq "errors" $.BucketStr)}}</u>{{end}}
   </td>
 
   <td class="bucket">
diff --git a/nettrace/templates/style.css b/nettrace/templates/style.css
index b76c8cd..077db1e 100644
--- a/nettrace/templates/style.css
+++ b/nettrace/templates/style.css
@@ -84,6 +84,10 @@ a:hover {
     color: var(--link-hover);
 }
 
+.family a {
+    color: var(--text-color);
+}
+
 u {
     text-decoration-color: var(--underline-color);
 }
@@ -116,7 +120,7 @@ table.index a {
     text-decoration: none;
 }
 
-span.muted {
+a.muted {
     color: var(--muted-color);
 }