fix(ui): Replace filter value "nothing" by "none" (#1202)
This commit is contained in:
5 files changed
+12
-12
No files matched your search
@@ -250,7 +250,7 @@ If you want to test it locally, see [Docker](#docker).
|
||||
| `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.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). | `{}` |
|
||||
|
||||
If you want more verbose logging, you may set the `GATUS_LOG_LEVEL` environment variable to `DEBUG`.
|
||||
|
||||
+4
-4
@@ -17,7 +17,7 @@ const (
|
||||
defaultLink = ""
|
||||
defaultCustomCSS = ""
|
||||
defaultSortBy = "name"
|
||||
defaultFilterBy = "nothing"
|
||||
defaultFilterBy = "none"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -25,7 +25,7 @@ var (
|
||||
|
||||
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 '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
|
||||
@@ -39,7 +39,7 @@ type Config struct {
|
||||
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 ('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 //
|
||||
@@ -114,7 +114,7 @@ func (cfg *Config) ValidateAndSetDefaults() error {
|
||||
}
|
||||
if len(cfg.DefaultFilterBy) == 0 {
|
||||
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
|
||||
}
|
||||
for _, btn := range cfg.Buttons {
|
||||
|
||||
@@ -155,10 +155,10 @@ func TestConfig_ValidateAndSetDefaults_DefaultFilterBy(t *testing.T) {
|
||||
ExpectedValue: defaultFilterBy,
|
||||
},
|
||||
{
|
||||
Name: "ValidDefaultFilterBy_nothing",
|
||||
DefaultFilterBy: "nothing",
|
||||
Name: "ValidDefaultFilterBy_none",
|
||||
DefaultFilterBy: "none",
|
||||
ExpectedError: nil,
|
||||
ExpectedValue: "nothing",
|
||||
ExpectedValue: "none",
|
||||
},
|
||||
{
|
||||
Name: "ValidDefaultFilterBy_failing",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<Select
|
||||
v-model="filterBy"
|
||||
:options="filterOptions"
|
||||
placeholder="Nothing"
|
||||
placeholder="None"
|
||||
class="flex-1 sm:w-[140px] md:w-[160px]"
|
||||
@update:model-value="handleFilterChange"
|
||||
/>
|
||||
@@ -47,11 +47,11 @@ import { Input } from '@/components/ui/input'
|
||||
import { Select } from '@/components/ui/select'
|
||||
|
||||
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 filterOptions = [
|
||||
{ label: 'Nothing', value: 'nothing' },
|
||||
{ label: 'None', value: 'none' },
|
||||
{ label: 'Failing', value: 'failing' },
|
||||
{ label: 'Unstable', value: 'unstable' }
|
||||
]
|
||||
|
||||
@@ -1 +1 @@
|
||||
(function(){"use strict";var e={682:function(e,t,a){a.d(t,{L:function(){return vl}});var l=a(963),s=a(252),n=a(577),o=a(262),r=a.p+"img/logo.svg",i=a(201),u=a(507),d=a(970),c=a(135),m=a(3),g=a(512),v=a(388);function p(...e){return(0,v.m6)((0,g.W)(e))}const f=["disabled"];var w={__name:"Button",props:{variant:{type:String,default:"default"},size:{type:String,default:"default"},disabled:{type:Boolean,default:!1}},setup(e){const t=(0,m.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}});return(a,l)=>((0,s.wg)(),(0,s.iD)("button",{class:(0,n.C_)((0,o.SU)(p)((0,o.SU)(t)({variant:e.variant,size:e.size}),a.$attrs.class??"")),disabled:e.disabled},[(0,s.WI)(a.$slots,"default")],10,f))}};const h=w;var x=h,b={__name:"Card",setup(e){return(e,t)=>((0,s.wg)(),(0,s.iD)("div",{class:(0,n.C_)((0,o.SU)(p)("rounded-lg border bg-card text-card-foreground shadow-sm",e.$attrs.class??""))},[(0,s.WI)(e.$slots,"default")],2))}};const y=b;var _=y,k={__name:"CardHeader",setup(e){return(e,t)=>((0,s.wg)(),(0,s.iD)("div",{class:(0,n.C_)((0,o.SU)(p)("flex flex-col space-y-1.5 p-6",e.$attrs.class??""))},[(0,s.WI)(e.$slots,"default")],2))}};const S=k;var U=S,D={__name:"CardTitle",setup(e){return(e,t)=>((0,s.wg)(),(0,s.iD)("h3",{class:(0,n.C_)((0,o.SU)(p)("text-2xl font-semibold leading-none tracking-tight",e.$attrs.class??""))},[(0,s.WI)(e.$slots,"default")],2))}};const W=D;var H=W,z={__name:"CardContent",setup(e){return(e,t)=>((0,s.wg)(),(0,s.iD)("div",{class:(0,n.C_)((0,o.SU)(p)("p-6 pt-0",e.$attrs.class??""))},[(0,s.WI)(e.$slots,"default")],2))}};const j=z;var C=j;const T={id:"social"};function R(e,t){return(0,s.wg)(),(0,s.iD)("div",T,t[0]||(t[0]=[(0,s._)("a",{href:"https://github.com/TwiN/gatus",target:"_blank",title:"Gatus on GitHub"},[(0,s._)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 16 16",class:"hover:scale-110"},[(0,s._)("path",{fill:"gray",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})])],-1)]))}var F=a(744);const $={},A=(0,F.Z)($,[["render",R],["__scopeId","data-v-788af9ce"]]);var E=A;const M={methods:{generatePrettyTimeAgo(e){let t=(new Date).getTime()-new Date(e).getTime();if(t<500)return"now";if(t>2592e5){let e=(t/864e5).toFixed(0);return e+" day"+("1"!==e?"s":"")+" ago"}if(t>36e5){let e=(t/36e5).toFixed(0);return e+" hour"+("1"!==e?"s":"")+" ago"}if(t>6e4){let e=(t/6e4).toFixed(0);return e+" minute"+("1"!==e?"s":"")+" ago"}let a=(t/1e3).toFixed(0);return a+" second"+("1"!==a?"s":"")+" ago"},generatePrettyTimeDifference(e,t){let a=Math.ceil((new Date(e)-new Date(t))/1e3/60);return a+(1===a?" minute":" minutes")},prettifyTimestamp(e){let t=new Date(e),a=t.getFullYear(),l=(t.getMonth()+1<10?"0":"")+(t.getMonth()+1),s=(t.getDate()<10?"0":"")+t.getDate(),n=(t.getHours()<10?"0":"")+t.getHours(),o=(t.getMinutes()<10?"0":"")+t.getMinutes(),r=(t.getSeconds()<10?"0":"")+t.getSeconds();return a+"-"+l+"-"+s+" "+n+":"+o+":"+r}}},I={key:0,class:"space-y-2"},L={class:"font-mono text-xs"},N={class:"font-mono text-xs"},P={key:0},q={class:"font-mono text-xs space-y-0.5"},O={class:"break-all"},Y={key:1},Z={class:"font-mono text-xs space-y-0.5"};var V={__name:"Tooltip",props:{event:{type:[Event,Object],default:null},result:{type:Object,default:null}},setup(e){const t=e,a=(0,o.iH)(!0),l=(0,o.iH)(0),r=(0,o.iH)(0),i=(0,o.iH)(null),{prettifyTimestamp:u}=M.methods,d=async()=>{if(t.event&&t.event.type)if(await(0,s.Y3)(),"mouseenter"===t.event.type&&i.value){const e=t.event.target,n=e.getBoundingClientRect();a.value=!1,await(0,s.Y3)();const o=i.value.getBoundingClientRect();let u=n.bottom+8,d=n.left;const c=window.innerHeight-n.bottom,m=n.top;c<o.height+20&&(u=m>o.height+20?n.top-o.height-8Line truncated
|
||||
(function(){"use strict";var e={682:function(e,t,a){a.d(t,{L:function(){return vl}});var l=a(963),s=a(252),n=a(577),o=a(262),r=a.p+"img/logo.svg",i=a(201),u=a(507),d=a(970),c=a(135),m=a(3),g=a(512),v=a(388);function p(...e){return(0,v.m6)((0,g.W)(e))}const f=["disabled"];var w={__name:"Button",props:{variant:{type:String,default:"default"},size:{type:String,default:"default"},disabled:{type:Boolean,default:!1}},setup(e){const t=(0,m.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}});return(a,l)=>((0,s.wg)(),(0,s.iD)("button",{class:(0,n.C_)((0,o.SU)(p)((0,o.SU)(t)({variant:e.variant,size:e.size}),a.$attrs.class??"")),disabled:e.disabled},[(0,s.WI)(a.$slots,"default")],10,f))}};const h=w;var x=h,b={__name:"Card",setup(e){return(e,t)=>((0,s.wg)(),(0,s.iD)("div",{class:(0,n.C_)((0,o.SU)(p)("rounded-lg border bg-card text-card-foreground shadow-sm",e.$attrs.class??""))},[(0,s.WI)(e.$slots,"default")],2))}};const y=b;var _=y,k={__name:"CardHeader",setup(e){return(e,t)=>((0,s.wg)(),(0,s.iD)("div",{class:(0,n.C_)((0,o.SU)(p)("flex flex-col space-y-1.5 p-6",e.$attrs.class??""))},[(0,s.WI)(e.$slots,"default")],2))}};const S=k;var U=S,D={__name:"CardTitle",setup(e){return(e,t)=>((0,s.wg)(),(0,s.iD)("h3",{class:(0,n.C_)((0,o.SU)(p)("text-2xl font-semibold leading-none tracking-tight",e.$attrs.class??""))},[(0,s.WI)(e.$slots,"default")],2))}};const W=D;var H=W,z={__name:"CardContent",setup(e){return(e,t)=>((0,s.wg)(),(0,s.iD)("div",{class:(0,n.C_)((0,o.SU)(p)("p-6 pt-0",e.$attrs.class??""))},[(0,s.WI)(e.$slots,"default")],2))}};const j=z;var C=j;const T={id:"social"};function R(e,t){return(0,s.wg)(),(0,s.iD)("div",T,t[0]||(t[0]=[(0,s._)("a",{href:"https://github.com/TwiN/gatus",target:"_blank",title:"Gatus on GitHub"},[(0,s._)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 16 16",class:"hover:scale-110"},[(0,s._)("path",{fill:"gray",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})])],-1)]))}var F=a(744);const $={},A=(0,F.Z)($,[["render",R],["__scopeId","data-v-788af9ce"]]);var E=A;const M={methods:{generatePrettyTimeAgo(e){let t=(new Date).getTime()-new Date(e).getTime();if(t<500)return"now";if(t>2592e5){let e=(t/864e5).toFixed(0);return e+" day"+("1"!==e?"s":"")+" ago"}if(t>36e5){let e=(t/36e5).toFixed(0);return e+" hour"+("1"!==e?"s":"")+" ago"}if(t>6e4){let e=(t/6e4).toFixed(0);return e+" minute"+("1"!==e?"s":"")+" ago"}let a=(t/1e3).toFixed(0);return a+" second"+("1"!==a?"s":"")+" ago"},generatePrettyTimeDifference(e,t){let a=Math.ceil((new Date(e)-new Date(t))/1e3/60);return a+(1===a?" minute":" minutes")},prettifyTimestamp(e){let t=new Date(e),a=t.getFullYear(),l=(t.getMonth()+1<10?"0":"")+(t.getMonth()+1),s=(t.getDate()<10?"0":"")+t.getDate(),n=(t.getHours()<10?"0":"")+t.getHours(),o=(t.getMinutes()<10?"0":"")+t.getMinutes(),r=(t.getSeconds()<10?"0":"")+t.getSeconds();return a+"-"+l+"-"+s+" "+n+":"+o+":"+r}}},I={key:0,class:"space-y-2"},L={class:"font-mono text-xs"},N={class:"font-mono text-xs"},P={key:0},q={class:"font-mono text-xs space-y-0.5"},O={class:"break-all"},Y={key:1},Z={class:"font-mono text-xs space-y-0.5"};var V={__name:"Tooltip",props:{event:{type:[Event,Object],default:null},result:{type:Object,default:null}},setup(e){const t=e,a=(0,o.iH)(!0),l=(0,o.iH)(0),r=(0,o.iH)(0),i=(0,o.iH)(null),{prettifyTimestamp:u}=M.methods,d=async()=>{if(t.event&&t.event.type)if(await(0,s.Y3)(),"mouseenter"===t.event.type&&i.value){const e=t.event.target,n=e.getBoundingClientRect();a.value=!1,await(0,s.Y3)();const o=i.value.getBoundingClientRect();let u=n.bottom+8,d=n.left;const c=window.innerHeight-n.bottom,m=n.top;c<o.height+20&&(u=m>o.height+20?n.top-o.height-8Line truncated
|
||||
Reference in new issue
Block a user