cloud/bmaas/bmdb/webug: rename .html to .gohtml
IntelliJ doesn't like overriding the type manually,
so lets just stick to their standard.
Change-Id: Ie533d884b06c62d6da6b8504051737b239fb8489
Reviewed-on: https://review.monogon.dev/c/monogon/+/1645
Reviewed-by: Serge Bazanski <serge@monogon.tech>
Tested-by: Jenkins CI
diff --git a/cloud/bmaas/bmdb/webug/BUILD.bazel b/cloud/bmaas/bmdb/webug/BUILD.bazel
index 172fd99..bbcaed4 100644
--- a/cloud/bmaas/bmdb/webug/BUILD.bazel
+++ b/cloud/bmaas/bmdb/webug/BUILD.bazel
@@ -8,12 +8,12 @@
"webug.go",
],
embedsrcs = [
- "templates/base.html",
- "templates/fragment_tag.html",
- "templates/fragment_tag_default.html",
- "templates/fragment_tag_provided.html",
- "templates/machines.html",
- "templates/machine.html",
+ "templates/base.gohtml",
+ "templates/fragment_tag.gohtml",
+ "templates/fragment_tag_default.gohtml",
+ "templates/fragment_tag_provided.gohtml",
+ "templates/machines.gohtml",
+ "templates/machine.gohtml",
],
importpath = "source.monogon.dev/cloud/bmaas/bmdb/webug",
visibility = ["//visibility:public"],
diff --git a/cloud/bmaas/bmdb/webug/templates/base.html b/cloud/bmaas/bmdb/webug/templates/base.gohtml
similarity index 93%
rename from cloud/bmaas/bmdb/webug/templates/base.html
rename to cloud/bmaas/bmdb/webug/templates/base.gohtml
index 3b8df8e..46dec82 100644
--- a/cloud/bmaas/bmdb/webug/templates/base.html
+++ b/cloud/bmaas/bmdb/webug/templates/base.gohtml
@@ -53,8 +53,9 @@
border-spacing: 0.2em;
}
- /* Colouring of the Work History log in machine.html. */
- tr.EventFailed td, tr.EventCanceled td {
+ /* Colouring of the Work History log in machine.gohtml. */
+ tr.EventFailed td,
+ tr.EventCanceled td {
background-color: #f8e8e8;
}
tr.EventFinished td {
diff --git a/cloud/bmaas/bmdb/webug/templates/fragment_tag.gohtml b/cloud/bmaas/bmdb/webug/templates/fragment_tag.gohtml
new file mode 100644
index 0000000..341cd78
--- /dev/null
+++ b/cloud/bmaas/bmdb/webug/templates/fragment_tag.gohtml
@@ -0,0 +1,5 @@
+{{- if eq .Type.Name "Provided" -}}
+ {{- template "fragment_tag_provided.gohtml" . -}}
+{{- else -}}
+ {{- template "fragment_tag_default.gohtml" . -}}
+{{- end -}}
diff --git a/cloud/bmaas/bmdb/webug/templates/fragment_tag.html b/cloud/bmaas/bmdb/webug/templates/fragment_tag.html
deleted file mode 100644
index f7ee320..0000000
--- a/cloud/bmaas/bmdb/webug/templates/fragment_tag.html
+++ /dev/null
@@ -1,5 +0,0 @@
-{{- if eq .Type.Name "Provided" -}}
- {{- template "fragment_tag_provided.html" . -}}
-{{- else -}}
- {{- template "fragment_tag_default.html" . -}}
-{{- end -}}
diff --git a/cloud/bmaas/bmdb/webug/templates/fragment_tag_default.html b/cloud/bmaas/bmdb/webug/templates/fragment_tag_default.gohtml
similarity index 100%
rename from cloud/bmaas/bmdb/webug/templates/fragment_tag_default.html
rename to cloud/bmaas/bmdb/webug/templates/fragment_tag_default.gohtml
diff --git a/cloud/bmaas/bmdb/webug/templates/fragment_tag_provided.html b/cloud/bmaas/bmdb/webug/templates/fragment_tag_provided.gohtml
similarity index 100%
rename from cloud/bmaas/bmdb/webug/templates/fragment_tag_provided.html
rename to cloud/bmaas/bmdb/webug/templates/fragment_tag_provided.gohtml
diff --git a/cloud/bmaas/bmdb/webug/templates/machine.html b/cloud/bmaas/bmdb/webug/templates/machine.gohtml
similarity index 97%
rename from cloud/bmaas/bmdb/webug/templates/machine.html
rename to cloud/bmaas/bmdb/webug/templates/machine.gohtml
index b13989d..73c8118 100644
--- a/cloud/bmaas/bmdb/webug/templates/machine.html
+++ b/cloud/bmaas/bmdb/webug/templates/machine.gohtml
@@ -1,4 +1,4 @@
-{{ template "base.html" .Base }}
+{{ template "base.gohtml" .Base }}
<h2>Machine {{ .Machine.ID }}</h2>
{{ $sessions := .Sessions }}
@@ -29,7 +29,7 @@
<table>
<tr>
<th colspan="2">
- {{ template "fragment_tag.html" $tag }}
+ {{ template "fragment_tag.gohtml" $tag }}
</th>
</tr>
{{ range $tag.Fields }}
diff --git a/cloud/bmaas/bmdb/webug/templates/machines.html b/cloud/bmaas/bmdb/webug/templates/machines.gohtml
similarity index 92%
rename from cloud/bmaas/bmdb/webug/templates/machines.html
rename to cloud/bmaas/bmdb/webug/templates/machines.gohtml
index 4650512..b31f9b6 100644
--- a/cloud/bmaas/bmdb/webug/templates/machines.html
+++ b/cloud/bmaas/bmdb/webug/templates/machines.gohtml
@@ -1,4 +1,4 @@
-{{ template "base.html" .Base }}
+{{ template "base.gohtml" .Base }}
<h2>Machine List</h2>
<p>
Click on a Machine ID to explore it further. Commonly viewed tags are expanded.
@@ -25,7 +25,7 @@
</td>
<td>
{{- range $name, $tag := .Tags -}}
- {{- template "fragment_tag.html" $tag -}}
+ {{- template "fragment_tag.gohtml" $tag -}}
{{- end -}}
</td>
</tr>
diff --git a/cloud/bmaas/bmdb/webug/views.go b/cloud/bmaas/bmdb/webug/views.go
index f47ece7..0cf34ac 100644
--- a/cloud/bmaas/bmdb/webug/views.go
+++ b/cloud/bmaas/bmdb/webug/views.go
@@ -14,7 +14,7 @@
)
// baseParams are passed to all rendered templates, and are consumed by tags in
-// templates/base.html.
+// templates/base.gohtml.
type baseParams struct {
// Address to display in page header.
BMDBAddress string
@@ -60,7 +60,7 @@
RenderTime time.Duration
TagCount map[string]int
}
- err = templates.ExecuteTemplate(w, "machines.html", ¶ms{
+ err = templates.ExecuteTemplate(w, "machines.gohtml", ¶ms{
Base: s.makeBase(),
Query: res.Query,
Machines: res.Data,
@@ -151,7 +151,7 @@
for i := 0; i < len(history); i += 1 {
p.History[i] = history[len(history)-(i+1)]
}
- if err := templates.ExecuteTemplate(w, "machine.html", &p); err != nil {
+ if err := templates.ExecuteTemplate(w, "machine.gohtml", &p); err != nil {
klog.Errorf("Template rendering failed: %v", err)
}
}
diff --git a/cloud/bmaas/bmdb/webug/webug.go b/cloud/bmaas/bmdb/webug/webug.go
index 91888d5..b377499 100644
--- a/cloud/bmaas/bmdb/webug/webug.go
+++ b/cloud/bmaas/bmdb/webug/webug.go
@@ -23,9 +23,9 @@
)
var (
- //go:embed templates/*html
+ //go:embed templates/*.gohtml
templateFS embed.FS
- templates = template.Must(template.New("base.html").Funcs(templateFuncs).ParseFS(templateFS, "templates/*"))
+ templates = template.Must(template.New("base.gohtml").Funcs(templateFuncs).ParseFS(templateFS, "templates/*"))
)
// server holds the state of an active webug interface.