diff --git a/README.md b/README.md index 6faa6b312..4dc28cfbb 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/config/ui/ui.go b/config/ui/ui.go index 649007a34..0822bb179 100644 --- a/config/ui/ui.go +++ b/config/ui/ui.go @@ -21,25 +21,28 @@ 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'") + 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 type Config struct { - Title string `yaml:"title,omitempty"` // Title of the page - Description string `yaml:"description,omitempty"` // Meta description of the page - Header string `yaml:"header,omitempty"` // Header is the text at the top of the page - Logo string `yaml:"logo,omitempty"` // Logo to display on the page - Link string `yaml:"link,omitempty"` // Link to open when clicking on the logo - Buttons []Button `yaml:"buttons,omitempty"` // Buttons to display below the header - CustomCSS string `yaml:"custom-css,omitempty"` // Custom CSS to include in the page - 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') + Title string `yaml:"title,omitempty"` // Title of the page + Description string `yaml:"description,omitempty"` // Meta description of the page + Header string `yaml:"header,omitempty"` // Header is the text at the top of the page + Logo string `yaml:"logo,omitempty"` // Logo to display on the page + Link string `yaml:"link,omitempty"` // Link to open when clicking on the logo + Buttons []Button `yaml:"buttons,omitempty"` // Buttons to display below the header + CustomCSS string `yaml:"custom-css,omitempty"` // Custom CSS to include in the page + 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 // @@ -80,6 +83,7 @@ func GetDefaultConfig() *Config { DarkMode: &defaultDarkMode, DefaultSortBy: defaultSortBy, DefaultFilterBy: defaultFilterBy, + DefaultGroupCollapse: &defaultGroupCollapse, MaximumNumberOfResults: storage.DefaultMaximumNumberOfResults, } } @@ -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 diff --git a/web/app/public/index.html b/web/app/public/index.html index 5655ef755..6be5dc467 100644 --- a/web/app/public/index.html +++ b/web/app/public/index.html @@ -3,7 +3,7 @@
\ No newline at end of file + diff --git a/web/static/index.html b/web/static/index.html index 703607b7c..cd4c1ca74 100644 --- a/web/static/index.html +++ b/web/static/index.html @@ -1,4 +1,4 @@ -