cloud/bmaas: implement webug

Webug (pronounced: /wɛbʌɡ/, not /wiːbʌɡ/) is a web debug interface for
BMDB, inspired by the great web debug interfaces of old.

It uses the new BMDB reflection API to access most
machine/tag/work/backoff information, plus sqlc queries to access
session information.

Change-Id: If0e65b6fc33ad92baef9c6d98333f90a02efa1b3
Reviewed-on: https://review.monogon.dev/c/monogon/+/1132
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/cloud/bmaas/bmdb/webug/templates/machines.html b/cloud/bmaas/bmdb/webug/templates/machines.html
new file mode 100644
index 0000000..d8658a1
--- /dev/null
+++ b/cloud/bmaas/bmdb/webug/templates/machines.html
@@ -0,0 +1,36 @@
+{{ template "base.html" .Base }}
+<h2>Machine List</h2>
+<p>
+    Click on a Machine ID to explore it further. Commonly viewed tags are expanded.
+</p>
+<table>
+    <tr>
+        <th>Machine ID</th>
+        <th>Work</th>
+        <th>Backoffs</th>
+        <th>Tags</th>
+    </tr>
+    {{ range .Machines -}}
+    <tr>
+        <td class="mono"><a href="/machine/{{ .ID }}">{{ .ID }}</a></td>
+        <td>
+            {{- range $process, $work := .Work -}}
+            <b><a href="/session/{{ $work.SessionID }}">{{ $process }}</a></b>
+            {{- end -}}
+        </td>
+        <td>
+            {{- range $process, $backoff := .Backoffs -}}
+            <b>{{ $backoff.Process }}</b>(<span class="small">{{ summarizeError .Cause }}</span>)
+            {{- end -}}
+        </td>
+        <td>
+            {{- range $name, $tag := .Tags -}}
+            {{- template "fragment_tag.html" $tag -}}
+            {{- end -}}
+        </td>
+    </tr>
+    {{ end -}}
+</table>
+<p class="small faint mono">
+    {{ .NMachines }} rows, rendered in {{ .RenderTime }}. Query: {{ .Query }}
+</p>
\ No newline at end of file