feat(viewer): compact status and severity table icons
This commit is contained in:
22
web/embed.go
22
web/embed.go
@@ -12,8 +12,9 @@ import (
|
||||
var content embed.FS
|
||||
|
||||
var pageTemplate = template.Must(template.New("view.html").Funcs(template.FuncMap{
|
||||
"statusClass": statusClass,
|
||||
"joinLines": joinLines,
|
||||
"statusClass": statusClass,
|
||||
"severityClass": severityClass,
|
||||
"joinLines": joinLines,
|
||||
}).ParseFS(content, "templates/view.html"))
|
||||
|
||||
var uploadTemplate = template.Must(template.New("upload.html").ParseFS(content, "templates/upload.html"))
|
||||
@@ -59,6 +60,23 @@ func statusClass(value string) string {
|
||||
}
|
||||
}
|
||||
|
||||
func severityClass(value string) string {
|
||||
switch strings.ToUpper(strings.TrimSpace(value)) {
|
||||
case "INFO", "INFORMATIONAL":
|
||||
return "severity-info"
|
||||
case "WARNING", "WARN":
|
||||
return "severity-warning"
|
||||
case "ERROR":
|
||||
return "severity-error"
|
||||
case "CRITICAL", "FATAL":
|
||||
return "severity-critical"
|
||||
case "DEBUG", "TRACE":
|
||||
return "severity-debug"
|
||||
default:
|
||||
return "severity-unknown"
|
||||
}
|
||||
}
|
||||
|
||||
func joinLines(value string) []string {
|
||||
if strings.TrimSpace(value) == "" {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user