Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/app/src/components/EndpointCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ const formattedResponseTime = computed(() => {
return `~${avgMs}ms`
} else {
// Show min-max range
const minMs = Math.round(min)
const maxMs = Math.round(max)
const minMs = Math.trunc(min)
const maxMs = Math.trunc(max)
// If min and max are the same, show single value
if (minMs === maxMs) {
return `${minMs}ms`
Expand Down
4 changes: 2 additions & 2 deletions web/app/src/components/SuiteCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<div>
<div class="flex items-center justify-between mb-1">
<p class="text-xs text-muted-foreground">Success Rate: {{ successRate }}%</p>
<p class="text-xs text-muted-foreground" v-if="averageDuration">{{ averageDuration }}ms avg</p>
<p class="text-xs text-muted-foreground" v-if="averageDuration !== null">{{ averageDuration }}ms avg</p>
</div>
<div class="flex gap-0.5">
<div
Expand Down Expand Up @@ -126,7 +126,7 @@ const averageDuration = computed(() => {
const total = props.suite.results.reduce((sum, r) => sum + (r.duration || 0), 0)
// Convert nanoseconds to milliseconds
return Math.round((total / props.suite.results.length) / 1000000)
return Math.trunc((total / props.suite.results.length) / 1000000)
})
const oldestResultTime = computed(() => {
Expand Down
4 changes: 2 additions & 2 deletions web/app/src/components/Tooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
{{ endpoint.success ? '✓' : '✗' }}
</span>
<span class="truncate">{{ endpoint.name }}</span>
<span class="text-muted-foreground">({{ (endpoint.duration / 1000000).toFixed(0) }}ms)</span>
<span class="text-muted-foreground">({{ Math.trunc(endpoint.duration / 1000000) }}ms)</span>
</div>
<div v-if="result.endpointResults.length > 5" class="text-xs text-muted-foreground">
... and {{ result.endpointResults.length - 5 }} more
Expand All @@ -60,7 +60,7 @@
{{ isSuiteResult ? 'Total Duration' : 'Response Time' }}
</div>
<div class="font-mono text-xs">
{{ isSuiteResult ? (result.duration / 1000000).toFixed(0) : (result.duration / 1000000).toFixed(0) }}ms
{{ Math.trunc(result.duration / 1000000) }}ms
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion web/app/src/utils/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const formatDuration = (duration) => {
const durationMs = duration / 1000000

if (durationMs < 1000) {
return `${durationMs.toFixed(0)}ms`
return `${Math.trunc(durationMs)}ms`
} else {
return `${(durationMs / 1000).toFixed(2)}s`
}
Expand Down
4 changes: 2 additions & 2 deletions web/app/src/views/EndpointDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ const pageResponseTimeRange = computed(() => {
}

if (!hasData) return 'N/A'
const minMs = Math.round(min / 1000000)
const maxMs = Math.round(max / 1000000)
const minMs = Math.trunc(min / 1000000)
const maxMs = Math.trunc(max / 1000000)
// If min and max are the same, show single value
if (minMs === maxMs) {
return `${minMs}ms`
Expand Down
14 changes: 1 addition & 13 deletions web/app/src/views/SuiteDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ import StepDetailsModal from '@/components/StepDetailsModal.vue'
import Settings from '@/components/Settings.vue'
import Loading from '@/components/Loading.vue'
import { generatePrettyTimeAgo } from '@/utils/time'
import { formatDuration } from '@/utils/format'
const router = useRouter()
const route = useRoute()
Expand Down Expand Up @@ -238,19 +239,6 @@ const formatTimestamp = (timestamp) => {
return date.toLocaleString()
}
const formatDuration = (duration) => {
if (!duration && duration !== 0) return 'N/A'
// Convert nanoseconds to milliseconds
const durationMs = duration / 1000000
if (durationMs < 1000) {
return `${durationMs.toFixed(0)}ms`
} else {
return `${(durationMs / 1000).toFixed(2)}s`
}
}
const calculateSuccessRate = (result) => {
if (!result || !result.endpointResults || result.endpointResults.length === 0) {
return 0
Expand Down
Loading