Files
unraid-podman/webui/plugins/podman/javascript/images.js
T
maggesandClaude Sonnet 5 e2fefcdf9c
Build Packages / Build .txz packages (push) Failing after 9s
Lint / ShellCheck (push) Failing after 43s
Lint / Validate .plg XML (push) Successful in 10s
Lint / EditorConfig (push) Failing after 6s
Add reproducible build system, native Unraid plugin, and WebUI
- versions.env pins podman, conmon, crun, netavark, aardvark-dns, passt,
  and fuse-overlayfs to verified upstream source checksums; SlackBuild
  recipes, scripts/build-packages.sh, checksums.sh, release.sh, and
  update-versions.sh implement the reproducible pipeline; GitHub Actions
  workflows build in a Slackware container and publish releases without
  committing any binaries.

- plugin/podman.plg installs/updates/removes all eight packages (the
  seven components plus the plugin's own unraid-podman scaffolding
  package) via upgradepkg, using the official Unraid array-event hook
  mechanism (event/disks_mounted, event/stopping) instead of editing
  /boot/config/go. rc.podman and the sbin/ helper scripts implement
  storage creation, config seeding/sync, preflight checks, autostart
  with per-container Safe-Mode, and package verify/update/rollback.

- webui/plugins/podman implements the Dashboard, Containers, Pods,
  Images, Volumes, Networks, Logs, Terminal, Compose, and Settings
  panels against the approved mockup (webui/mockups/prototype.html),
  talking to podman system service exclusively via PodmanClient.php
  (libpod REST API over the Unix socket), with two documented
  exceptions: Terminal's one-shot exec model and Compose's use of the
  podman compose CLI, since libpod has no REST equivalent for either.

- docs/ARCHITECTURE.md and docs/ROADMAP.md record the design decisions
  and honest current status (syntax-checked, unit- and
  integration-tested against fake sockets/servers; not yet run against
  a real Unraid/Podman/Slackware system).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-11 10:51:14 +00:00

70 lines
2.4 KiB
JavaScript

/**
* javascript/images.js
*
* Images panel: table + a "Pull Image" action, backed by ajax/images.php.
*/
(function () {
'use strict';
const P = window.Podman;
let images = [];
function rowHtml(img) {
const created = img.createdAt ? P.formatRelativeTime(img.createdAt) : '&mdash;';
return '' +
'<tr data-id="' + P.escapeHtml(img.id) + '">' +
'<td>' + P.escapeHtml(img.repository) + '</td>' +
'<td class="mono">' + P.escapeHtml(img.tag) + '</td>' +
'<td class="mono podman-row-sub">' + P.escapeHtml(img.shortId) + '</td>' +
'<td class="tnum">' + P.escapeHtml(img.sizeFormatted) + '</td>' +
'<td class="tnum">' + created + '</td>' +
'<td class="tnum">' + img.usedBy + '</td>' +
'<td class="podman-actions"><button class="podman-btn podman-btn-icon" data-action="remove"' +
(img.usedBy > 0 ? ' disabled title="In use by a container"' : ' title="Remove"') + '>&#128465;</button></td>' +
'</tr>';
}
function render() {
const tbody = P.el('images-tbody');
tbody.innerHTML = images.length
? images.map(rowHtml).join('')
: '<tr><td colspan="7" class="podman-empty-note">No images.</td></tr>';
}
function load() {
const tbody = P.el('images-tbody');
tbody.innerHTML = P.loadingRow(7);
return P.get('images', 'list').then(function (data) {
images = data;
render();
}).catch(function (err) {
tbody.innerHTML = P.errorRow(7, err.message);
});
}
function init() {
P.el('images-pull-btn').addEventListener('click', function () {
const reference = prompt('Image to pull (e.g. docker.io/library/postgres:16):');
if (!reference) return;
P.post('images', 'pull', { reference: reference }).then(load).catch(function (err) {
alert('Pull failed: ' + err.message);
});
});
P.el('images-tbody').addEventListener('click', function (e) {
const btn = e.target.closest('button[data-action="remove"]');
if (!btn || btn.disabled) return;
const id = btn.closest('tr').dataset.id;
if (!confirm('Remove this image?')) return;
btn.disabled = true;
P.post('images', 'remove', { id: id }).then(load).catch(function (err) {
alert('Remove failed: ' + err.message);
btn.disabled = false;
});
});
return load();
}
P.registerPanel('images', { init: init, refresh: load });
})();