ConnLogs: return object with _diag for troubleshooting + frontend compat

API now returns:
{
  "logs": [...],    // ConnectionLog array (same fields as before)
  "_diag": [...]    // status.log paths/existence/parse status per instance
}

Frontend updated to handle both array (legacy) and object format.

This makes it easy to diagnose:
- Which status.log paths the backend looked at
- Whether files exist and their sizes
- How many entries were parsed
- Any parse errors

User just needs to: git pull && rebuild && restart on production.
This commit is contained in:
cnbugs
2026-08-10 00:12:00 +08:00
parent 81544d2335
commit 1706552b33
2 changed files with 29 additions and 8 deletions
+5 -1
View File
@@ -33,7 +33,11 @@ const list = ref([])
const instances = ref([])
const instanceId = ref('')
async function load() { list.value = await Logs.conns(instanceId.value) }
async function load() {
const r = await Logs.conns(instanceId.value)
// 后端可能返回数组(旧)或 {logs:[...], _diag:[...]}(新)
list.value = Array.isArray(r) ? r : (r.logs || [])
}
function fmt(n) {
if (!n) return '0'
const u = ['B','KB','MB','GB','TB']; let i=0,v=n