fix(ui): Show correct avg response time for N/A value (#1407)

* fix(ui): Show correct avg response time not applicable value

* refactor(ui): Convert to milliseconds after loop

---------

Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
PythonGermany
2025-11-29 01:56:02 +01:00
committed by GitHub
parent ee01adb603
commit 0c3231713f

View File

@@ -35,7 +35,7 @@
<CardTitle class="text-sm font-medium text-muted-foreground">Avg Response Time</CardTitle>
</CardHeader>
<CardContent>
<div class="text-2xl font-bold">{{ pageAverageResponseTime }}ms</div>
<div class="text-2xl font-bold">{{ pageAverageResponseTime }}</div>
</CardContent>
</Card>
@@ -262,7 +262,7 @@ const pageAverageResponseTime = computed(() => {
}
}
if (count === 0) return 'N/A'
return Math.round(total / count / 1000000)
return `${Math.round(total / count / 1000000)}ms`
})
const pageResponseTimeRange = computed(() => {
@@ -275,17 +275,17 @@ const pageResponseTimeRange = computed(() => {
let hasData = false
for (const result of endpointStatus.value.results) {
if (result.duration) {
const durationMs = result.duration / 1000000
min = Math.min(min, durationMs)
max = Math.max(max, durationMs)
const duration = result.duration
if (duration) {
min = Math.min(min, duration)
max = Math.max(max, duration)
hasData = true
}
}
if (!hasData) return 'N/A'
const minMs = Math.round(min)
const maxMs = Math.round(max)
const minMs = Math.round(min / 1000000)
const maxMs = Math.round(max / 1000000)
// If min and max are the same, show single value
if (minMs === maxMs) {
return `${minMs}ms`