Theming support

This commit is contained in:
Magnus Åhall 2024-06-25 08:59:07 +02:00
parent e86c96d78f
commit 58e0b2f081
99 changed files with 1839 additions and 1094 deletions

14
main.go
View file

@ -152,6 +152,12 @@ func main() { // {{{
go nodataLoop()
err = SmonConfigInit()
if err != nil {
logger.Error("configuration", "error", werr.Wrap(err))
os.Exit(1)
}
err = service.Start()
if err != nil {
logger.Error("webserver", "error", werr.Wrap(err))
@ -366,6 +372,7 @@ func pageIndex(w http.ResponseWriter, _ *http.Request, _ *session.T) { // {{{
page := Page{
LAYOUT: "main",
PAGE: "index",
CONFIG: smonConfig.Settings,
}
page.Render(w)
} // }}}
@ -481,6 +488,7 @@ func pageProblems(w http.ResponseWriter, _ *http.Request, _ *session.T) { // {{{
page := Page{
LAYOUT: "main",
PAGE: "problems",
CONFIG: smonConfig.Settings,
}
problems, err := ProblemsRetrieve()
@ -555,6 +563,7 @@ func pageDatapoints(w http.ResponseWriter, r *http.Request, _ *session.T) { // {
page := Page{
LAYOUT: "main",
PAGE: "datapoints",
CONFIG: smonConfig.Settings,
}
datapoints, err := DatapointsRetrieve()
@ -599,6 +608,7 @@ func pageDatapointEdit(w http.ResponseWriter, r *http.Request, _ *session.T) { /
page := Page{
LAYOUT: "main",
PAGE: "datapoint_edit",
CONFIG: smonConfig.Settings,
MENU: "datapoints",
Icon: "datapoints",
Label: "Datapoint",
@ -679,6 +689,7 @@ func pageDatapointValues(w http.ResponseWriter, r *http.Request, _ *session.T) {
page := Page{
LAYOUT: "main",
PAGE: "datapoint_values",
CONFIG: smonConfig.Settings,
MENU: "datapoints",
Icon: "datapoints",
Label: "Values for " + datapoint.Name,
@ -706,6 +717,7 @@ func pageTriggers(w http.ResponseWriter, _ *http.Request, _ *session.T) { // {{{
page := Page{
LAYOUT: "main",
PAGE: "triggers",
CONFIG: smonConfig.Settings,
Data: map[string]any{
"Areas": areas,
},
@ -790,6 +802,7 @@ func pageTriggerEdit(w http.ResponseWriter, r *http.Request, _ *session.T) { //
LAYOUT: "main",
PAGE: "trigger_edit",
MENU: "triggers",
CONFIG: smonConfig.Settings,
Label: "Trigger",
Icon: "triggers",
Data: map[string]any{
@ -934,6 +947,7 @@ func pageConfiguration(w http.ResponseWriter, _ *http.Request, _ *session.T) { /
page := Page{
LAYOUT: "main",
PAGE: "configuration",
CONFIG: smonConfig.Settings,
Data: map[string]any{
"Areas": areas,
},