Add Tag view including required changes.

This commit is contained in:
Jan Eitzinger
2022-02-10 18:48:58 +01:00
parent 27fd3c4e5a
commit 14693ad32b
6 changed files with 170 additions and 2 deletions

View File

@@ -58,6 +58,14 @@
</a>
</li>
{{end}}
{{block "navitem_tags" .}}
<li class="nav-item">
<a class="nav-link fs-5" href="/monitoring/tags/">
<span class="cc-nav-text">Tags</span>
<i class="bi-tag-fill"></i>
</a>
</li>
{{end}}
{{else}}
{{block "navitem_stats" .}}
<li class="nav-item">

View File

@@ -0,0 +1,17 @@
{{define "content"}}
<div class="container">
<div class="row justify-content-center">
<div class="col-10">
{{ range $tagType, $tagList := .Infos.tagmap }}
<div class="my-3 p-2 bg-secondary text-white text-capitalize">
{{ $tagType }}
</div>
{{ range $tagList }}
<a class="btn btn-lg btn-warning" href="/monitoring/jobs/?tag={{ .id }}" role="button">
{{ .name }} <span class="badge bg-light text-dark">{{ .count }}</span> </a>
{{end}}
{{end}}
</div>
</div>
</div>
{{end}}

View File

@@ -22,13 +22,20 @@ type Page struct {
}
func init() {
templatesDir = "./templates/"
bp := "./"
ebp := os.Getenv("BASEPATH")
if ebp != "" {
bp = ebp
}
templatesDir = bp + "templates/"
base := template.Must(template.ParseFiles(templatesDir + "base.tmpl"))
files := []string{
"home.tmpl", "404.tmpl", "login.tmpl",
"imprint.tmpl", "privacy.tmpl",
"monitoring/jobs.tmpl",
"monitoring/job.tmpl",
"monitoring/taglist.tmpl",
"monitoring/list.tmpl",
"monitoring/user.tmpl",
"monitoring/systems.tmpl",