Skip to content

Commit

Permalink
fix: worker init
Browse files Browse the repository at this point in the history
  • Loading branch information
productdevbook committed Dec 5, 2024
1 parent 00c965a commit 07254a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
9 changes: 2 additions & 7 deletions src/runtime/handlers/dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { html } from '../templates/dashboard'

export function createDashboardHandler() {
const __dirname = fileURLToPath(new URL('.', import.meta.url))
const template = readFileSync(resolve(__dirname, '../templates/dashboard.html'), 'utf-8')

return async () => {
return template
return html
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
export const html = `<!DOCTYPE html>
<html lang="en" class="h-full">
<head>
<meta charset="UTF-8">
Expand Down Expand Up @@ -217,8 +217,8 @@ <h3 class="text-lg font-medium text-gray-900 dark:text-white">Recent Requests</h
logs.value = data.recentLogs || []
stats.value = [
{ label: 'Total Requests', value: data.summary.totalRequests },
{ label: 'Avg Response Time', value: `${Math.round(data.summary.averageResponseTime)}ms` },
{ label: 'Error Rate', value: `${(data.summary.errorRate * 100).toFixed(1)}%` },
{ label: 'Avg Response Time', value: \`\${Math.round(data.summary.averageResponseTime)}ms\` },
{ label: 'Error Rate', value: \`\${(data.summary.errorRate * 100).toFixed(1)}%\` },
{ label: 'Requests/min', value: data.summary.requestsPerMinute }
]
lastUpdate.value = new Date().toLocaleTimeString()
Expand Down Expand Up @@ -304,4 +304,5 @@ <h3 class="text-lg font-medium text-gray-900 dark:text-white">Recent Requests</h
app.mount('#app')
</script>
</body>
</html>
</html>
`

0 comments on commit 07254a5

Please sign in to comment.