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 () => { onMounted(async () => {
await loadTargets() await loadTargets()
await loadHistory() await loadHistory()
checkAll()
}) })
onUnmounted(() => wsConnection?.close()) onUnmounted(() => wsConnection?.close())
@ -178,23 +179,29 @@ onUnmounted(() => wsConnection?.close())
async function loadTargets() { async function loadTargets() {
loadingTargets.value = true loadingTargets.value = true
try { 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}` }, headers: { Authorization: `Bearer ${authStore.accessToken}` },
}) })
if (res.ok) { if (res.ok) {
const data: any[] = await res.json() || [] const lxcs: any[] = await res.json() || []
targets.value = data.map(t => ({ for (const lxc of lxcs) {
id: t.id, list.push({
name: t.name, id: `lxc:${lxc.vmid}`,
status: t.status, name: lxc.name || `LXC ${lxc.vmid}`,
vmid: t.vmid, status: lxc.status,
vmid: lxc.vmid,
packages: null, packages: null,
checking: false, checking: false,
updating: false, updating: false,
showPackages: false, showPackages: false,
error: null, error: null,
})) })
} }
}
targets.value = list
} finally { } finally {
loadingTargets.value = false loadingTargets.value = false
} }