Merge branch 'master' into hotfix: Bring branch up to date

This commit is contained in:
Christoph Kluge
2023-06-23 10:41:59 +02:00
18 changed files with 113 additions and 92 deletions

View File

@@ -17,15 +17,9 @@
<div class="container">
<div class="row">
<div class="col-4 mx-auto">
{{if .Error}}
<div class="alert alert-warning" role="alert">
{{.Error}}
</div>
{{end}}
{{if .Info}}
<div class="alert alert-success" role="alert">
{{.Info}}
{{if .MsgType}}
<div class="alert {{.MsgType}}" role="alert">
{{.Message}}
</div>
{{end}}

View File

@@ -0,0 +1,17 @@
{{define "content"}}
<div class="row justify-content-center">
<div class="col-4">
<div class="alert {{.MsgType}} p-3 text-center fs-3" role="alert">
{{if eq .MsgType "alert-info"}}
<i class="bi-info-circle-fill me-3"></i>
{{else if eq .MsgType "alert-warning"}}
<i class="bi-question-circle-fill me-3"></i>
{{else if eq .MsgType "alert-danger"}}
<i class="bi-exclamation-circle-fill me-3"></i>
{{end}}
{{.Message}}
</div>
</div>
</div>
{{end}}

View File

@@ -90,8 +90,8 @@ type Build struct {
type Page struct {
Title string // Page title
Error string // For generic use (e.g. the exact error message on /login)
Info string // For generic use (e.g. "Logout successfull" on /login)
MsgType string // For generic use in message boxes
Message string // For generic use in message boxes
User auth.User // Information about the currently logged in user (Full User Info)
Roles map[string]auth.Role // Available roles for frontend render checks
Build Build // Latest information about the application
@@ -104,8 +104,7 @@ type Page struct {
func RenderTemplate(rw http.ResponseWriter, r *http.Request, file string, page *Page) {
t, ok := templates[file]
if !ok {
log.Fatalf("WEB/WEB > template '%s' not found", file)
panic("template not found")
log.Errorf("WEB/WEB > template '%s' not found", file)
}
if page.Clusters == nil {
@@ -114,7 +113,7 @@ func RenderTemplate(rw http.ResponseWriter, r *http.Request, file string, page *
}
}
log.Infof("Page config : %v\n", page.Config)
log.Debugf("Page config : %v\n", page.Config)
if err := t.Execute(rw, page); err != nil {
log.Errorf("Template error: %s", err.Error())
}