feat: add logs ansi render

This commit is contained in:
engigu
2026-03-11 11:59:03 +08:00
parent db2bbd5d4d
commit b7522bc47c
7 changed files with 74 additions and 12 deletions
+7 -1
View File
@@ -56,10 +56,16 @@ const isWsLoading = ref(false)
let logSocket: WebSocket | null = null
import { ansiToHtml } from '@/utils/ansi'
const decompressedOutput = computed(() => {
return wsContent.value || '无输出'
})
const renderedOutput = computed(() => {
return ansiToHtml(decompressedOutput.value)
})
async function loadLogs() {
try {
const params: { page: number; page_size: number; task_id?: string; task_name?: string; status?: string } = {
@@ -566,7 +572,7 @@ watch(() => route.query, (newQuery) => {
</div>
<div class="flex-1 overflow-auto bg-muted/5 min-h-[160px]">
<pre
class="p-4 text-xs font-mono whitespace-pre-wrap break-all log-pre leading-relaxed">{{ decompressedOutput }}</pre>
class="p-4 text-xs font-mono whitespace-pre-wrap break-all log-pre leading-relaxed" v-html="renderedOutput"></pre>
<div v-if="isWsLoading" class="p-4 text-sm text-muted-foreground italic">连接中...</div>
</div>
</div>