From 815d16f8720fdf447ae75aa6c98b903b5e49e645 Mon Sep 17 00:00:00 2001 From: kodi Date: Sat, 21 Feb 2026 12:33:10 +0100 Subject: [PATCH] feat(ui): image tabblad toegevoegd --- webui/html/assets/css/app.css | 27 +++++++++ webui/html/assets/js/tabs/images.js | 92 +++++++++++++++++++++++++++++ webui/html/index.html | 39 +++++++++++- 3 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 webui/html/assets/js/tabs/images.js diff --git a/webui/html/assets/css/app.css b/webui/html/assets/css/app.css index e03a102..3cd39ac 100644 --- a/webui/html/assets/css/app.css +++ b/webui/html/assets/css/app.css @@ -390,4 +390,31 @@ pre{ .file-folder-files{ margin-left: 18px; +} +.data-table { + width: 100%; + border-collapse: collapse; +} + +.data-table th, +.data-table td { + padding: 8px; + border-bottom: 1px solid #ddd; + text-align: left; +} + +.badge { + padding: 4px 8px; + border-radius: 4px; + font-size: 12px; +} + +.badge-green { + background: #2ecc71; + color: white; +} + +.badge-yellow { + background: #f1c40f; + color: black; } \ No newline at end of file diff --git a/webui/html/assets/js/tabs/images.js b/webui/html/assets/js/tabs/images.js new file mode 100644 index 0000000..382ea59 --- /dev/null +++ b/webui/html/assets/js/tabs/images.js @@ -0,0 +1,92 @@ +async function loadImages() { + const res = await fetch("/api/images"); + const images = await res.json(); + renderImages(images); +} + +function renderImages(images) { + const tbody = document.getElementById("images-tbody"); + tbody.innerHTML = ""; + + images.forEach(img => { + const tr = document.createElement("tr"); + + const repoTag = (img.RepoTags && img.RepoTags.length > 0) + ? img.RepoTags[0] + : ""; + + const shortId = img.Id.substring(0, 12); + const sizeMB = (img.Size / 1024 / 1024).toFixed(1); + const containers = img.Containers || 0; + const fullId = img.Id; + + const status = containers > 0 + ? `In use` + : `Unused`; + + const disabled = containers > 0 ? "disabled" : ""; + + tr.innerHTML = ` + + + + ${repoTag} + ${shortId} + ${sizeMB} MB + ${containers} + ${status} + + + + `; + + tbody.appendChild(tr); + }); +} + +function toggleSelectAllImages(master) { + document.querySelectorAll(".image-checkbox:not(:disabled)") + .forEach(cb => cb.checked = master.checked); +} + +async function removeSingleImage(id) { + if (!confirm("Image verwijderen?")) return; + + await fetch("/api/images/" + encodeURIComponent(id), { + method: "DELETE" + }); + + await loadImages(); +} + +async function removeSelectedImages() { + const selected = Array.from(document.querySelectorAll(".image-checkbox:checked")) + .map(cb => cb.value); + + if (!selected.length) { + alert("Geen images geselecteerd."); + return; + } + + if (!confirm("Geselecteerde images verwijderen?")) return; + + await fetch("/api/images/remove", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ images: selected }) + }); + + await loadImages(); +} + +async function pruneUnusedImages() { + if (!confirm("Alle unused images verwijderen?")) return; + + await fetch("/api/images/prune?all=true", { + method: "POST" + }); + + await loadImages(); +} \ No newline at end of file diff --git a/webui/html/index.html b/webui/html/index.html index c36a454..2f9249e 100644 --- a/webui/html/index.html +++ b/webui/html/index.html @@ -51,6 +51,9 @@
🌐Netwerk
+
+ 📦Images +
📁Files
@@ -142,6 +145,37 @@ + +