Skip to content

Commit f939468

Browse files
committed
feat(ui): Persist show average response time
1 parent 15a8055 commit f939468

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

web/app/src/views/EndpointDetails.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<Button
6767
variant="ghost"
6868
size="icon"
69-
@click="showAverageResponseTime = !showAverageResponseTime"
69+
@click="toggleShowAverageResponseTime"
7070
:title="showAverageResponseTime ? 'Show min-max response time' : 'Show average response time'"
7171
>
7272
<Activity v-if="showAverageResponseTime" class="h-5 w-5" />
@@ -224,7 +224,7 @@ const events = ref([])
224224
const currentPage = ref(1)
225225
const resultPageSize = 50
226226
const showResponseTimeChartAndBadges = ref(false)
227-
const showAverageResponseTime = ref(false)
227+
const showAverageResponseTime = ref(localStorage.getItem('gatus:show-average-response-time') !== 'false')
228228
const selectedChartDuration = ref('24h')
229229
const isRefreshing = ref(false)
230230
@@ -245,6 +245,11 @@ const hostname = computed(() => {
245245
return latestResult.value?.hostname || null
246246
})
247247
248+
const toggleShowAverageResponseTime = () => {
249+
showAverageResponseTime.value = !showAverageResponseTime.value
250+
localStorage.setItem('gatus:show-average-response-time', showAverageResponseTime.value ? 'true' : 'false')
251+
}
252+
248253
const pageAverageResponseTime = computed(() => {
249254
// Use endpointStatus for current page's average response time
250255
if (!endpointStatus.value || !endpointStatus.value.results || endpointStatus.value.results.length === 0) {

web/app/src/views/Home.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ const itemsPerPage = 96
219219
const searchQuery = ref('')
220220
const showOnlyFailing = ref(false)
221221
const showRecentFailures = ref(false)
222-
const showAverageResponseTime = ref(true)
222+
const showAverageResponseTime = ref(localStorage.getItem('gatus:show-average-response-time') !== 'false')
223223
const groupByGroup = ref(false)
224224
const sortBy = ref(localStorage.getItem('gatus:sort-by') || 'name')
225225
const uncollapsedGroups = ref(new Set())
@@ -483,6 +483,7 @@ const goToPage = (page) => {
483483
484484
const toggleShowAverageResponseTime = () => {
485485
showAverageResponseTime.value = !showAverageResponseTime.value
486+
localStorage.setItem('gatus:show-average-response-time', showAverageResponseTime.value ? 'true' : 'false')
486487
}
487488
488489
const showTooltip = (result, event, action = 'hover') => {

0 commit comments

Comments
 (0)