diff --git a/webui/html/assets/js/tabs/volumes.js b/webui/html/assets/js/tabs/volumes.js index c7181ad..e02ea9b 100644 --- a/webui/html/assets/js/tabs/volumes.js +++ b/webui/html/assets/js/tabs/volumes.js @@ -11,12 +11,29 @@ async function loadVolumes() { volumesData = Array.isArray(volumes) ? volumes : []; - // Bouw volume → containers mapping op basis van Mounts + // containers-dashboard geeft Mounts als strings (destination paden). + // Volledige mount-info (Type + Name) zit alleen in de inspect endpoint. + // Haal inspect op voor alle containers met niet-lege Mounts, parallel. + const containerList = Array.isArray(containers) ? containers : []; + const withMounts = containerList.filter(c => (c.Mounts || []).length > 0); + const inspectResults = await Promise.all( + withMounts.map(c => { + const name = (c.Names && c.Names[0]) || ""; + if (!name) return Promise.resolve(null); + return fetch("/api/containers/inspect/" + encodeURIComponent(name)) + .then(r => r.ok ? r.json() : null) + .catch(() => null); + }) + ); + + // Bouw volume → containers mapping: filter op Type === "volume" volumeContainersMap = {}; - for (const c of (Array.isArray(containers) ? containers : [])) { - const cname = (c.Names && c.Names[0]) || ""; - for (const m of (c.Mounts || [])) { - if (m.Name) { + for (let i = 0; i < withMounts.length; i++) { + const inspect = inspectResults[i]; + if (!inspect) continue; + const cname = (withMounts[i].Names && withMounts[i].Names[0]) || ""; + for (const m of (inspect.Mounts || [])) { + if (m.Type === "volume" && m.Name) { (volumeContainersMap[m.Name] = volumeContainersMap[m.Name] || []).push(cname); } }