Add Status Report to Info page
This commit is contained in:
parent
cda68d3454
commit
f5c5999f44
11 changed files with 361 additions and 20 deletions
|
|
@ -2,6 +2,8 @@ package status
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
|
|
@ -15,6 +17,10 @@ type WissKI struct {
|
|||
Slug string // slug
|
||||
URL string // complete URL, including http(s)
|
||||
|
||||
// golang html requirements.
|
||||
// Note that the html in templates may contain dirty html.
|
||||
Requirements []Requirement
|
||||
|
||||
Locked bool // Is this instance currently locked?
|
||||
|
||||
// Information about the running instance
|
||||
|
|
@ -40,6 +46,30 @@ type WissKI struct {
|
|||
Grants []models.Grant
|
||||
}
|
||||
|
||||
// Requirement represents a drupal requirement or status check.
|
||||
type Requirement struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Weight int `json:"weight"`
|
||||
Severity int `json:"severity"`
|
||||
Value template.HTML `json:"value"`
|
||||
Description template.HTML `json:"description"`
|
||||
}
|
||||
|
||||
func (req Requirement) Level() template.HTML {
|
||||
switch req.Severity {
|
||||
case -1:
|
||||
return "<span style='background-color: gray; color: #fff;' class='info-chip'>Note</span>"
|
||||
case 0:
|
||||
return "<span style='background-color: green; color: #fff;' class='info-chip'>Info</span>"
|
||||
case 1:
|
||||
return "<span style='background-color: yellow; color: #000;' class='info-chip'>Warning</span>"
|
||||
case 2:
|
||||
return "<span style='background-color: red; color: #000;' class='info-chip'>Error</span>"
|
||||
}
|
||||
return template.HTML(strconv.Itoa(req.Severity))
|
||||
}
|
||||
|
||||
// Statistics holds statistics generated by the WissKI module
|
||||
type Statistics struct {
|
||||
Activity struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue