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:
parent
82e3b850d0
commit
53c535844e
1 changed files with 20 additions and 13 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue