You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This should never happen, because ui.ValidateAndSetDefaults validates that the template works.
29
27
logr.Errorf("[api.SinglePageApplication] Failed to parse template. This should never happen, because the template is validated on start. Error: %s", err.Error())
Copy file name to clipboardExpand all lines: config/ui/ui.go
+48-26Lines changed: 48 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@ package ui
2
2
3
3
import (
4
4
"bytes"
5
+
"encoding/json"
5
6
"errors"
6
7
"html/template"
7
8
@@ -10,16 +11,16 @@ import (
10
11
)
11
12
12
13
const (
13
-
defaultTitle="Health Dashboard | Gatus"
14
-
defaultDescription="Gatus is an advanced automated status page that lets you monitor your applications and configure alerts to notify you if there's an issue"
15
-
defaultHeader="Gatus"
16
-
defaultDashboardHeading="Health Dashboard"
17
-
defaultDashboardSubheading="Monitor the health of your endpoints in real-time"
18
-
defaultLogo=""
19
-
defaultLink=""
20
-
defaultCustomCSS=""
21
-
defaultSortBy="name"
22
-
defaultFilterBy="none"
14
+
defaultTitle="Health Dashboard | Gatus"
15
+
defaultDescription="Gatus is an advanced automated status page that lets you monitor your applications and configure alerts to notify you if there's an issue"
16
+
defaultHeader="Gatus"
17
+
defaultDashboardHeading="Health Dashboard"
18
+
defaultDashboardSubheading="Monitor the health of your endpoints in real-time"
19
+
defaultLogo=""
20
+
defaultLink=""
21
+
defaultCustomCSS=""
22
+
defaultSortBy="name"
23
+
defaultFilterBy="none"
23
24
)
24
25
25
26
var (
@@ -28,26 +29,28 @@ var (
28
29
ErrButtonValidationFailed=errors.New("invalid button configuration: missing required name or link")
29
30
ErrInvalidDefaultSortBy=errors.New("invalid default-sort-by value: must be 'name', 'group', or 'health'")
30
31
ErrInvalidDefaultFilterBy=errors.New("invalid default-filter-by value: must be 'none', 'failing', or 'unstable'")
32
+
33
+
uiTemplate*template.Template=nil
31
34
)
32
35
33
36
// Config is the configuration for the UI of Gatus
34
37
typeConfigstruct {
35
-
Titlestring`yaml:"title,omitempty"`// Title of the page
36
-
Descriptionstring`yaml:"description,omitempty"`// Meta description of the page
37
-
DashboardHeadingstring`yaml:"dashboard-heading,omitempty"`// Dashboard Title between header and endpoints
38
-
DashboardSubheadingstring`yaml:"dashboard-subheading,omitempty"`// Dashboard Description between header and endpoints
39
-
Headerstring`yaml:"header,omitempty"`// Header is the text at the top of the page
40
-
Logostring`yaml:"logo,omitempty"`// Logo to display on the page
41
-
Linkstring`yaml:"link,omitempty"`// Link to open when clicking on the logo
42
-
Buttons[]Button`yaml:"buttons,omitempty"`// Buttons to display below the header
43
-
CustomCSSstring`yaml:"custom-css,omitempty"`// Custom CSS to include in the page
44
-
DarkMode*bool`yaml:"dark-mode,omitempty"`// DarkMode is a flag to enable dark mode by default
45
-
DefaultSortBystring`yaml:"default-sort-by,omitempty"`// DefaultSortBy is the default sort option ('name', 'group', 'health')
46
-
DefaultFilterBystring`yaml:"default-filter-by,omitempty"`// DefaultFilterBy is the default filter option ('none', 'failing', 'unstable')
38
+
Titlestring`yaml:"title,omitempty" json:"-"`// Title of the page
39
+
Descriptionstring`yaml:"description,omitempty" json:"-"`// Meta description of the page
40
+
DashboardHeadingstring`yaml:"dashboard-heading,omitempty" json:"dashboardHeading,omitempty"`// Dashboard Title between header and endpoints
41
+
DashboardSubheadingstring`yaml:"dashboard-subheading,omitempty" json:"dashboardSubheading,omitempty"`// Dashboard Description between header and endpoints
42
+
Headerstring`yaml:"header,omitempty" json:"header,omitempty"`// Header is the text at the top of the page
43
+
Logostring`yaml:"logo,omitempty" json:"logo,omitempty"`// Logo to display on the page
44
+
Linkstring`yaml:"link,omitempty" json:"link,omitempty"`// Link to open when clicking on the logo
45
+
Buttons []Button`yaml:"buttons,omitempty" json:"buttons,omitempty"`// Buttons to display below the header
46
+
CustomCSSstring`yaml:"custom-css,omitempty" json:"-"`// Custom CSS to include in the page
47
+
DarkMode*bool`yaml:"dark-mode,omitempty" json:"-"`// DarkMode is a flag to enable dark mode by default
48
+
DefaultSortBystring`yaml:"default-sort-by,omitempty" json:"defaultSortBy,omitempty"`// DefaultSortBy is the default sort option ('name', 'group', 'health')
49
+
DefaultFilterBystring`yaml:"default-filter-by,omitempty" json:"defaultFilterBy,omitempty"`// DefaultFilterBy is the default filter option ('none', 'failing', 'unstable')
47
50
//////////////////////////////////////////////
48
51
// Non-configurable - used for UI rendering //
49
52
//////////////////////////////////////////////
50
-
MaximumNumberOfResultsint`yaml:"-"`// MaximumNumberOfResults to display on the page, it's not configurable because we're passing it from the storage config
53
+
MaximumNumberOfResultsint`yaml:"-" json:"maximumNumberOfResults,omitempty"`// MaximumNumberOfResults to display on the page, it's not configurable because we're passing it from the storage config
0 commit comments