mirror of
https://github.com/TwiN/gatus.git
synced 2026-02-15 20:50:04 +00:00
fix(ui): Replace filter value "nothing" by "none" (#1202)
This commit is contained in:
@@ -250,7 +250,7 @@ If you want to test it locally, see [Docker](#docker).
|
|||||||
| `ui.custom-css` | Custom CSS | `""` |
|
| `ui.custom-css` | Custom CSS | `""` |
|
||||||
| `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.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-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 `nothing`, `failing`, or `unstable`. Note that user preferences override this. | `nothing` |
|
| `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` |
|
||||||
| `maintenance` | [Maintenance configuration](#maintenance). | `{}` |
|
| `maintenance` | [Maintenance configuration](#maintenance). | `{}` |
|
||||||
|
|
||||||
If you want more verbose logging, you may set the `GATUS_LOG_LEVEL` environment variable to `DEBUG`.
|
If you want more verbose logging, you may set the `GATUS_LOG_LEVEL` environment variable to `DEBUG`.
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const (
|
|||||||
defaultLink = ""
|
defaultLink = ""
|
||||||
defaultCustomCSS = ""
|
defaultCustomCSS = ""
|
||||||
defaultSortBy = "name"
|
defaultSortBy = "name"
|
||||||
defaultFilterBy = "nothing"
|
defaultFilterBy = "none"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -25,7 +25,7 @@ var (
|
|||||||
|
|
||||||
ErrButtonValidationFailed = errors.New("invalid button configuration: missing required name or link")
|
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'")
|
ErrInvalidDefaultSortBy = errors.New("invalid default-sort-by value: must be 'name', 'group', or 'health'")
|
||||||
ErrInvalidDefaultFilterBy = errors.New("invalid default-filter-by value: must be 'nothing', 'failing', or 'unstable'")
|
ErrInvalidDefaultFilterBy = errors.New("invalid default-filter-by value: must be 'none', 'failing', or 'unstable'")
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config is the configuration for the UI of Gatus
|
// Config is the configuration for the UI of Gatus
|
||||||
@@ -39,7 +39,7 @@ type Config struct {
|
|||||||
CustomCSS string `yaml:"custom-css,omitempty"` // Custom CSS to include in the page
|
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
|
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')
|
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 ('nothing', 'failing', 'unstable')
|
DefaultFilterBy string `yaml:"default-filter-by,omitempty"` // DefaultFilterBy is the default filter option ('none', 'failing', 'unstable')
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
// Non-configurable - used for UI rendering //
|
// Non-configurable - used for UI rendering //
|
||||||
@@ -114,7 +114,7 @@ func (cfg *Config) ValidateAndSetDefaults() error {
|
|||||||
}
|
}
|
||||||
if len(cfg.DefaultFilterBy) == 0 {
|
if len(cfg.DefaultFilterBy) == 0 {
|
||||||
cfg.DefaultFilterBy = defaultFilterBy
|
cfg.DefaultFilterBy = defaultFilterBy
|
||||||
} else if cfg.DefaultFilterBy != "nothing" && cfg.DefaultFilterBy != "failing" && cfg.DefaultFilterBy != "unstable" {
|
} else if cfg.DefaultFilterBy != "none" && cfg.DefaultFilterBy != "failing" && cfg.DefaultFilterBy != "unstable" {
|
||||||
return ErrInvalidDefaultFilterBy
|
return ErrInvalidDefaultFilterBy
|
||||||
}
|
}
|
||||||
for _, btn := range cfg.Buttons {
|
for _, btn := range cfg.Buttons {
|
||||||
|
|||||||
@@ -155,10 +155,10 @@ func TestConfig_ValidateAndSetDefaults_DefaultFilterBy(t *testing.T) {
|
|||||||
ExpectedValue: defaultFilterBy,
|
ExpectedValue: defaultFilterBy,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "ValidDefaultFilterBy_nothing",
|
Name: "ValidDefaultFilterBy_none",
|
||||||
DefaultFilterBy: "nothing",
|
DefaultFilterBy: "none",
|
||||||
ExpectedError: nil,
|
ExpectedError: nil,
|
||||||
ExpectedValue: "nothing",
|
ExpectedValue: "none",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "ValidDefaultFilterBy_failing",
|
Name: "ValidDefaultFilterBy_failing",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<Select
|
<Select
|
||||||
v-model="filterBy"
|
v-model="filterBy"
|
||||||
:options="filterOptions"
|
:options="filterOptions"
|
||||||
placeholder="Nothing"
|
placeholder="None"
|
||||||
class="flex-1 sm:w-[140px] md:w-[160px]"
|
class="flex-1 sm:w-[140px] md:w-[160px]"
|
||||||
@update:model-value="handleFilterChange"
|
@update:model-value="handleFilterChange"
|
||||||
/>
|
/>
|
||||||
@@ -47,11 +47,11 @@ import { Input } from '@/components/ui/input'
|
|||||||
import { Select } from '@/components/ui/select'
|
import { Select } from '@/components/ui/select'
|
||||||
|
|
||||||
const searchQuery = ref('')
|
const searchQuery = ref('')
|
||||||
const filterBy = ref(localStorage.getItem('gatus:filter-by') || (typeof window !== 'undefined' && window.config?.defaultFilterBy) || 'nothing')
|
const filterBy = ref(localStorage.getItem('gatus:filter-by') || (typeof window !== 'undefined' && window.config?.defaultFilterBy) || 'none')
|
||||||
const sortBy = ref(localStorage.getItem('gatus:sort-by') || (typeof window !== 'undefined' && window.config?.defaultSortBy) || 'name')
|
const sortBy = ref(localStorage.getItem('gatus:sort-by') || (typeof window !== 'undefined' && window.config?.defaultSortBy) || 'name')
|
||||||
|
|
||||||
const filterOptions = [
|
const filterOptions = [
|
||||||
{ label: 'Nothing', value: 'nothing' },
|
{ label: 'None', value: 'none' },
|
||||||
{ label: 'Failing', value: 'failing' },
|
{ label: 'Failing', value: 'failing' },
|
||||||
{ label: 'Unstable', value: 'unstable' }
|
{ label: 'Unstable', value: 'unstable' }
|
||||||
]
|
]
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user