fix: utiliser l'API Proxmox pour la liste des LXC + check auto au chargement

- Remplace pct list SSH (permissions aléatoires) par /api/proxmox/lxc
- Lance checkAll() automatiquement à l'arrivée sur la page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
enzo 2026-03-21 01:16:37 +01:00
parent 82e3b850d0
commit 53c535844e

View file

@ -171,6 +171,7 @@ const anyRunning = computed(() => targets.value.some(t => t.updating))
onMounted(async () => {
await loadTargets()
await loadHistory()
checkAll()
})
onUnmounted(() => wsConnection?.close())
@ -178,23 +179,29 @@ onUnmounted(() => wsConnection?.close())
async function loadTargets() {
loadingTargets.value = true
try {
const res = await fetch('/api/updates/targets', {
const list: Target[] = [
{ id: 'host', name: 'Proxmox Host', status: 'running', packages: null, checking: false, updating: false, showPackages: false, error: null },
]
const res = await fetch('/api/proxmox/lxc', {
headers: { Authorization: `Bearer ${authStore.accessToken}` },
})
if (res.ok) {
const data: any[] = await res.json() || []
targets.value = data.map(t => ({
id: t.id,
name: t.name,
status: t.status,
vmid: t.vmid,
const lxcs: any[] = await res.json() || []
for (const lxc of lxcs) {
list.push({
id: `lxc:${lxc.vmid}`,
name: lxc.name || `LXC ${lxc.vmid}`,
status: lxc.status,
vmid: lxc.vmid,
packages: null,
checking: false,
updating: false,
showPackages: false,
error: null,
}))
})
}
}
targets.value = list
} finally {
loadingTargets.value = false
}