Move towards selectable time ranges in the dashboard

- Add the installation date to frontend and backend
- Add an error page to help with the upgrade from the previous version
- Avoid querying history if installation date is not set
- Make the fillMissing function work for periods of different lenght than than 8 days
This commit is contained in:
MassiveBox 2022-12-04 12:50:11 +01:00
parent 66e2a2de1a
commit 6dc8fa3750
8 changed files with 61 additions and 21 deletions

View file

@ -28,6 +28,7 @@ func main() {
engine := html.New("./templates/"+config.Dashboard.Theme, ".html")
engine.AddFunc("divide", templateDivide)
engine.AddFunc("HTMLDateFormat", templateHTMLDateFormat)
app := fiber.New(fiber.Config{
Views: engine,
@ -45,9 +46,7 @@ func main() {
})
app.Get("/accuracy-notice", func(c *fiber.Ctx) error {
return c.Render("accuracy-notice", fiber.Map{
"Defaults": config.getTemplateDefaults(),
}, "base")
return c.Render("accuracy-notice", config.templateDefaultsMap(), "base")
})
app.All("/admin", config.adminEndpoint)
@ -58,9 +57,7 @@ func main() {
time.Sleep(time.Second)
os.Exit(1)
}()
return c.Render("restart", fiber.Map{
"Defaults": config.getTemplateDefaults(),
}, "base")
return c.Render("restart", config.templateDefaultsMap(), "base")
}
return c.Redirect("./", 307)
})