Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ If you want to test it locally, see [Docker](#docker).
| `ui.dark-mode` | Whether to enable dark mode by default. Note that this is superseded by the user's operating system theme preferences. | `true` |
| `ui.default-sort-by` | Default sorting option for endpoints in the dashboard. Can be `name`, `group`, or `health`. Note that user preferences override this. | `name` |
| `ui.default-filter-by` | Default filter option for endpoints in the dashboard. Can be `none`, `failing`, or `unstable`. Note that user preferences override this. | `none` |
| `ui.default-group-collapse` | Default collapse option for statuses in the dashboard. Can be either `true` or `false`. Note that user preferences override this. | `false` |
| `maintenance` | [Maintenance configuration](#maintenance). | `{}` |

If you want more verbose logging, you may set the `GATUS_LOG_LEVEL` environment variable to `DEBUG`.
Expand Down
9 changes: 8 additions & 1 deletion config/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ const (
)

var (
defaultDarkMode = true
defaultDarkMode = true
defaultGroupCollapse = true

ErrButtonValidationFailed = errors.New("invalid button configuration: missing required name or link")
ErrInvalidDefaultSortBy = errors.New("invalid default-sort-by value: must be 'name', 'group', or 'health'")
ErrInvalidDefaultFilterBy = errors.New("invalid default-filter-by value: must be 'none', 'failing', or 'unstable'")
ErrInvalidDefaultGroupCollapse = errors.New("invalid default-group-collapse value: must be a boolean")
)

// Config is the configuration for the UI of Gatus
Expand All @@ -40,6 +42,7 @@ type Config struct {
DarkMode *bool `yaml:"dark-mode,omitempty"` // DarkMode is a flag to enable dark mode by default
DefaultSortBy string `yaml:"default-sort-by,omitempty"` // DefaultSortBy is the default sort option ('name', 'group', 'health')
DefaultFilterBy string `yaml:"default-filter-by,omitempty"` // DefaultFilterBy is the default filter option ('none', 'failing', 'unstable')
DefaultGroupCollapse *bool `yaml:"default-group-collapse,omitempty"` // DefaultGroupCollapse is a flag to enable/disable collapsing of groups by default

//////////////////////////////////////////////
// Non-configurable - used for UI rendering //
Expand Down Expand Up @@ -80,6 +83,7 @@ func GetDefaultConfig() *Config {
DarkMode: &defaultDarkMode,
DefaultSortBy: defaultSortBy,
DefaultFilterBy: defaultFilterBy,
DefaultGroupCollapse: &defaultGroupCollapse,
MaximumNumberOfResults: storage.DefaultMaximumNumberOfResults,
}
}
Expand Down Expand Up @@ -117,6 +121,9 @@ func (cfg *Config) ValidateAndSetDefaults() error {
} else if cfg.DefaultFilterBy != "none" && cfg.DefaultFilterBy != "failing" && cfg.DefaultFilterBy != "unstable" {
return ErrInvalidDefaultFilterBy
}
if cfg.DefaultGroupCollapse == nil {
cfg.DefaultGroupCollapse = &defaultGroupCollapse
}
for _, btn := range cfg.Buttons {
if err := btn.Validate(); err != nil {
return err
Expand Down
Loading