fix(ui): Show correct oldest result timestamp (#1405)
* fix(ui): Show correct oldest result timestamp * fix(ui): Request correct result page size in home view * refactor(ui): Use constant for result page size --------- Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
@@ -154,7 +154,8 @@ const formattedResponseTime = computed(() => {
|
||||
|
||||
const oldestResultTime = computed(() => {
|
||||
if (!props.endpoint.results || props.endpoint.results.length === 0) return ''
|
||||
return generatePrettyTimeAgo(props.endpoint.results[0].timestamp)
|
||||
const oldestResultIndex = Math.max(0, props.endpoint.results.length - props.maxResults)
|
||||
return generatePrettyTimeAgo(props.endpoint.results[oldestResultIndex].timestamp)
|
||||
})
|
||||
|
||||
const newestResultTime = computed(() => {
|
||||
|
||||
@@ -89,13 +89,13 @@
|
||||
<EndpointCard
|
||||
v-if="endpointStatus"
|
||||
:endpoint="endpointStatus"
|
||||
:maxResults="50"
|
||||
:maxResults="resultPageSize"
|
||||
:showAverageResponseTime="showAverageResponseTime"
|
||||
@showTooltip="showTooltip"
|
||||
class="border-0 shadow-none bg-transparent p-0"
|
||||
/>
|
||||
<div v-if="endpointStatus && endpointStatus.key" class="pt-4 border-t">
|
||||
<Pagination @page="changePage" :numberOfResultsPerPage="50" :currentPageProp="currentPage" />
|
||||
<Pagination @page="changePage" :numberOfResultsPerPage="resultPageSize" :currentPageProp="currentPage" />
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
@@ -224,6 +224,7 @@ const endpointStatus = ref(null) // For paginated historical data
|
||||
const currentStatus = ref(null) // For current/latest status (always page 1)
|
||||
const events = ref([])
|
||||
const currentPage = ref(1)
|
||||
const resultPageSize = 50
|
||||
const showResponseTimeChartAndBadges = ref(false)
|
||||
const showAverageResponseTime = ref(false)
|
||||
const selectedChartDuration = ref('24h')
|
||||
@@ -304,7 +305,7 @@ const lastCheckTime = computed(() => {
|
||||
const fetchData = async () => {
|
||||
isRefreshing.value = true
|
||||
try {
|
||||
const response = await fetch(`${serverUrl}/api/v1/endpoints/${route.params.key}/statuses?page=${currentPage.value}&pageSize=50`, {
|
||||
const response = await fetch(`${serverUrl}/api/v1/endpoints/${route.params.key}/statuses?page=${currentPage.value}&pageSize=${resultPageSize}`, {
|
||||
credentials: 'include'
|
||||
})
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
v-for="suite in items.suites"
|
||||
:key="suite.key"
|
||||
:suite="suite"
|
||||
:maxResults="50"
|
||||
:maxResults="resultPageSize"
|
||||
@showTooltip="showTooltip"
|
||||
/>
|
||||
</div>
|
||||
@@ -96,7 +96,7 @@
|
||||
v-for="endpoint in items.endpoints"
|
||||
:key="endpoint.key"
|
||||
:endpoint="endpoint"
|
||||
:maxResults="50"
|
||||
:maxResults="resultPageSize"
|
||||
:showAverageResponseTime="showAverageResponseTime"
|
||||
@showTooltip="showTooltip"
|
||||
/>
|
||||
@@ -116,7 +116,7 @@
|
||||
v-for="suite in paginatedSuites"
|
||||
:key="suite.key"
|
||||
:suite="suite"
|
||||
:maxResults="50"
|
||||
:maxResults="resultPageSize"
|
||||
@showTooltip="showTooltip"
|
||||
/>
|
||||
</div>
|
||||
@@ -130,7 +130,7 @@
|
||||
v-for="endpoint in paginatedEndpoints"
|
||||
:key="endpoint.key"
|
||||
:endpoint="endpoint"
|
||||
:maxResults="50"
|
||||
:maxResults="resultPageSize"
|
||||
:showAverageResponseTime="showAverageResponseTime"
|
||||
@showTooltip="showTooltip"
|
||||
/>
|
||||
@@ -225,6 +225,7 @@ const showAverageResponseTime = ref(true)
|
||||
const groupByGroup = ref(false)
|
||||
const sortBy = ref(localStorage.getItem('gatus:sort-by') || 'name')
|
||||
const uncollapsedGroups = ref(new Set())
|
||||
const resultPageSize = 50
|
||||
|
||||
const filteredEndpoints = computed(() => {
|
||||
let filtered = [...endpointStatuses.value]
|
||||
@@ -433,7 +434,7 @@ const fetchData = async () => {
|
||||
}
|
||||
try {
|
||||
// Fetch endpoints
|
||||
const endpointResponse = await fetch(`${SERVER_URL}/api/v1/endpoints/statuses?page=1&pageSize=100`, {
|
||||
const endpointResponse = await fetch(`${SERVER_URL}/api/v1/endpoints/statuses?page=1&pageSize=${resultPageSize}`, {
|
||||
credentials: 'include'
|
||||
})
|
||||
if (endpointResponse.status === 200) {
|
||||
@@ -444,7 +445,7 @@ const fetchData = async () => {
|
||||
}
|
||||
|
||||
// Fetch suites
|
||||
const suiteResponse = await fetch(`${SERVER_URL}/api/v1/suites/statuses?page=1&pageSize=100`, {
|
||||
const suiteResponse = await fetch(`${SERVER_URL}/api/v1/suites/statuses?page=1&pageSize=${resultPageSize}`, {
|
||||
credentials: 'include'
|
||||
})
|
||||
if (suiteResponse.status === 200) {
|
||||
|
||||
Reference in New Issue
Block a user