Compare commits

..

6 Commits

Author SHA1 Message Date
Andrej Vaňo
3e713dfee3 docs(alerting): Fix the homeassistant event structure example (#1213)
docs(Homeassistant): Fix the event structure in the example
2025-08-19 13:03:59 -04:00
TwiN
2f99eccf5f fix(ui): Collapse groups by default (#1212) 2025-08-19 10:15:35 -04:00
TwiN
d37f71eee7 fix(ui): Move announcements above endpoints search bar (#1210) 2025-08-19 07:32:04 -04:00
Salim B
6d579a4b48 docs: improve extra-labels description (#1208)
* docs: improve `extra-labels` description

* Update README.md

* Update README.md

---------

Co-authored-by: TwiN <twin@linux.com>
2025-08-18 14:18:57 -04:00
TwiN
2c42aa8087 fix(ui): Update endpoints in-place instead of reloading every time (#1209)
* fix(ui): Update endpoints in-place instead of reloading every time

Fixes #1207

* Regenerate static assets
2025-08-18 12:36:16 -04:00
TwiN
12825a2b6f ci: Fix typo in if statement 2025-08-18 12:18:24 -04:00
9 changed files with 68 additions and 39 deletions

View File

@@ -32,7 +32,7 @@ jobs:
if [[ $TITLE == *"alerting"* || $TITLE == *"provider"* || $TITLE == *"alert"* ]]; then
gh issue edit "$NUMBER" --add-label "area/alerting"
fi
if [[ $TITLE == *"(ui)"* $TITLE == *"ui:"* || ]]; then
if [[ $TITLE == *"(ui)"* || $TITLE == *"ui:"* ]]; then
gh issue edit "$NUMBER" --add-label "area/ui"
fi
if [[ $TITLE == *"storage"* || $TITLE == *"postgres"* || $TITLE == *"sqlite"* ]]; then

View File

@@ -1070,13 +1070,13 @@ automation:
action:
- service: notify.notify
data_template:
title: "Gatus Alert: {{ trigger.event.data.endpoint }}"
title: "Gatus Alert: {{ trigger.event.data.event_data.endpoint }}"
message: >
Status: {{ trigger.event.data.status }}
{% if trigger.event.data.description %}
Description: {{ trigger.event.data.description }}
Status: {{ trigger.event.data.event_data.status }}
{% if trigger.event.data.event_data.description %}
Description: {{ trigger.event.data.event_data.description }}
{% endif %}
{% for condition in trigger.event.data.conditions %}
{% for condition in trigger.event.data.event_data.conditions %}
{{ '✅' if condition.success else '❌' }} {{ condition.condition }}
{% endfor %}
```
@@ -1991,7 +1991,7 @@ See [examples/docker-compose-grafana-prometheus](.examples/docker-compose-grafan
#### Custom Labels
Added a Labels field to the Config and Endpoint structs to support key-value pairs for metrics. Updated the Prometheus metrics initialization to include dynamic labels from the configuration. See the example below:
You can add custom labels to your endpoints Prometheus metrics by defining keyvalue pairs under the `extra-labels` field. For example:
```yaml
endpoints:

View File

@@ -1,5 +1,5 @@
<template>
<div v-if="announcements && announcements.length" class="announcement-container mb-4">
<div v-if="announcements && announcements.length" class="announcement-container mb-6">
<div
:class="[
'rounded-lg border bg-card text-card-foreground shadow-sm transition-all duration-200',
@@ -9,7 +9,7 @@
<!-- Header -->
<div
:class="[
'px-4 py-3 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors',
'announcement-header px-4 py-3 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors',
isCollapsed ? 'rounded-lg' : 'rounded-t-lg border-b border-gray-200 dark:border-gray-600'
]"
@click="toggleCollapsed"
@@ -34,7 +34,7 @@
<!-- Timeline Content -->
<div
v-if="!isCollapsed"
class="p-4 transition-all duration-200 rounded-b-lg"
class="announcement-content p-4 transition-all duration-200 rounded-b-lg"
>
<div class="relative">
<!-- Announcements -->

View File

@@ -1,5 +1,5 @@
<template>
<Card class="endpoint hover:shadow-lg transition-shadow cursor-pointer h-full flex flex-col">
<Card class="endpoint h-full flex flex-col transition hover:shadow-lg hover:scale-[1.01] dark:hover:border-gray-700">
<CardHeader class="endpoint-header px-3 sm:px-6 pt-3 sm:pt-6 pb-2 space-y-0">
<div class="flex items-start justify-between gap-2 sm:gap-3">
<div class="flex-1 min-w-0 overflow-hidden">

View File

@@ -1,7 +1,7 @@
<template>
<div class="dashboard-container bg-background">
<div class="container mx-auto px-4 py-8 max-w-7xl">
<div class="mb-8">
<div class="mb-6">
<Button variant="ghost" class="mb-4" @click="goBack">
<ArrowLeft class="h-4 w-4 mr-2" />
Back to Dashboard

View File

@@ -1,7 +1,7 @@
<template>
<div class="dashboard-container bg-background">
<div class="container mx-auto px-4 py-8 max-w-7xl">
<div class="mb-8">
<div class="mb-6">
<div class="flex items-center justify-between mb-6">
<div>
<h1 class="text-4xl font-bold tracking-tight">Health Dashboard</h1>
@@ -22,7 +22,9 @@
</Button>
</div>
</div>
<!-- Announcement Banner -->
<AnnouncementBanner :announcements="props.announcements" />
<!-- Search bar -->
<SearchBar
@search="handleSearch"
@update:showOnlyFailing="showOnlyFailing = $event"
@@ -33,11 +35,6 @@
/>
</div>
<!-- Announcements Banner -->
<AnnouncementBanner :announcements="props.announcements" />
<div>
</div>
<div v-if="loading" class="flex items-center justify-center py-20">
<Loading size="lg" />
</div>
@@ -62,7 +59,7 @@
class="endpoint-group-header flex items-center justify-between p-4 bg-card border-b cursor-pointer hover:bg-accent/50 transition-colors"
>
<div class="flex items-center gap-3">
<ChevronDown v-if="!collapsedGroups.has(group)" class="h-5 w-5 text-muted-foreground" />
<ChevronDown v-if="uncollapsedGroups.has(group)" class="h-5 w-5 text-muted-foreground" />
<ChevronUp v-else class="h-5 w-5 text-muted-foreground" />
<h2 class="text-xl font-semibold text-foreground">{{ group }}</h2>
</div>
@@ -76,7 +73,7 @@
</div>
<!-- Group Content -->
<div v-if="!collapsedGroups.has(group)" class="endpoint-group-content p-4">
<div v-if="uncollapsedGroups.has(group)" class="endpoint-group-content p-4">
<div class="grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3">
<EndpointCard
v-for="endpoint in endpoints"
@@ -172,7 +169,7 @@ const showRecentFailures = ref(false)
const showAverageResponseTime = ref(true)
const groupByGroup = ref(false)
const sortBy = ref(localStorage.getItem('gatus:sort-by') || 'name')
const collapsedGroups = ref(new Set())
const uncollapsedGroups = ref(new Set())
const filteredEndpoints = computed(() => {
let filtered = [...endpointStatuses.value]
@@ -280,26 +277,55 @@ const visiblePages = computed(() => {
})
const fetchData = async () => {
loading.value = true
// Don't show loading state on refresh to prevent UI flicker
const isInitialLoad = endpointStatuses.value.length === 0
if (isInitialLoad) {
loading.value = true
}
try {
const response = await fetch(`${SERVER_URL}/api/v1/endpoints/statuses?page=1&pageSize=100`, {
credentials: 'include'
})
if (response.status === 200) {
const data = await response.json()
endpointStatuses.value = data
// If this is the initial load, just set the data
if (isInitialLoad) {
endpointStatuses.value = data
} else {
// Check if endpoints have been added or removed
const currentKeys = new Set(endpointStatuses.value.map(ep => ep.key))
const newKeys = new Set(data.map(ep => ep.key))
const hasAdditions = data.some(ep => !currentKeys.has(ep.key))
const hasRemovals = endpointStatuses.value.some(ep => !newKeys.has(ep.key))
if (hasAdditions || hasRemovals) {
// Endpoints have changed, reset the array to maintain proper order
endpointStatuses.value = data
} else {
// Only statuses/results have changed, update in place to preserve scroll
const endpointMap = new Map(data.map(ep => [ep.key, ep]))
endpointStatuses.value.forEach((endpoint, index) => {
const updated = endpointMap.get(endpoint.key)
if (updated) {
// Update in place to preserve Vue's reactivity and scroll position
Object.assign(endpointStatuses.value[index], updated)
}
})
}
}
} else {
console.error('[Home][fetchData] Error:', await response.text())
}
} catch (error) {
console.error('[Home][fetchData] Error:', error)
} finally {
loading.value = false
if (isInitialLoad) {
loading.value = false
}
}
}
const refreshData = () => {
endpointStatuses.value = [];
fetchData()
}
@@ -330,26 +356,29 @@ const calculateUnhealthyCount = (endpoints) => {
}
const toggleGroupCollapse = (groupName) => {
if (collapsedGroups.value.has(groupName)) {
collapsedGroups.value.delete(groupName)
if (uncollapsedGroups.value.has(groupName)) {
uncollapsedGroups.value.delete(groupName)
} else {
collapsedGroups.value.add(groupName)
uncollapsedGroups.value.add(groupName)
}
// Save to localStorage
const collapsed = Array.from(collapsedGroups.value)
localStorage.setItem('gatus:collapsed-groups', JSON.stringify(collapsed))
const uncollapsed = Array.from(uncollapsedGroups.value)
localStorage.setItem('gatus:uncollapsed-groups', JSON.stringify(uncollapsed))
localStorage.removeItem('gatus:collapsed-groups') // Remove old key if it exists
}
const initializeCollapsedGroups = () => {
// Get saved collapsed groups from localStorage
// Get saved uncollapsed groups from localStorage
try {
const saved = localStorage.getItem('gatus:collapsed-groups')
const saved = localStorage.getItem('gatus:uncollapsed-groups')
if (saved) {
collapsedGroups.value = new Set(JSON.parse(saved))
uncollapsedGroups.value = new Set(JSON.parse(saved))
}
// If no saved state, uncollapsedGroups stays empty (all collapsed by default)
} catch (e) {
console.warn('Failed to parse saved collapsed groups:', e)
localStorage.removeItem('gatus:collapsed-groups')
console.warn('Failed to parse saved uncollapsed groups:', e)
localStorage.removeItem('gatus:uncollapsed-groups')
// On error, uncollapsedGroups stays empty (all collapsed by default)
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -137,7 +137,7 @@ const u=({name:e,iconNode:t,absoluteStrokeWidth:n,"absolute-stroke-width":s,stro
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const o=(0,r.Z)("log-in",[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]])},104:function(e,t,n){n.d(t,{Z:function(){return o}});var r=n(264);
*/const o=(0,r.Z)("log-in",[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]])},507:function(e,t,n){n.d(t,{Z:function(){return o}});var r=n(264);
/**
* @license lucide-vue-next v0.539.0 - ISC
*