- 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>
96 lines
3.7 KiB
JavaScript
96 lines
3.7 KiB
JavaScript
/**
|
|
* javascript/settings.js
|
|
*
|
|
* Settings panel: reads/writes unraid-podman's own configuration via
|
|
* ajax/settings.php (podman.cfg + the autostart list) — not a
|
|
* PodmanClient/libpod concern, see that file's header comment.
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
const P = window.Podman;
|
|
let autostartNames = [];
|
|
|
|
function renderAutostart() {
|
|
const tbody = P.el('autostart-tbody');
|
|
tbody.innerHTML = autostartNames.length
|
|
? autostartNames.map(function (name, i) {
|
|
return '<tr data-index="' + i + '">' +
|
|
'<td class="tnum">' + (i + 1) + '</td>' +
|
|
'<td>' + P.escapeHtml(name) + '</td>' +
|
|
'<td class="podman-actions">' +
|
|
'<button class="podman-btn podman-btn-icon" data-action="up"' + (i === 0 ? ' disabled' : '') + ' title="Move up">↑</button>' +
|
|
'<button class="podman-btn podman-btn-icon" data-action="down"' + (i === autostartNames.length - 1 ? ' disabled' : '') + ' title="Move down">↓</button>' +
|
|
'<button class="podman-btn podman-btn-icon" data-action="remove" title="Remove from autostart">🗑</button>' +
|
|
'</td></tr>';
|
|
}).join('')
|
|
: '<tr><td colspan="3" class="podman-empty-note">No containers in the autostart chain.</td></tr>';
|
|
}
|
|
|
|
function saveAutostart() {
|
|
return P.post('settings', 'autostart_save', { names: autostartNames }).catch(function (err) {
|
|
alert('Could not save autostart order: ' + err.message);
|
|
});
|
|
}
|
|
|
|
function fillForm(settings) {
|
|
P.el('settings-storage-path').value = settings.storagePath;
|
|
P.el('settings-storage-size').value = settings.storageImageSizeGb;
|
|
P.el('settings-enabled').checked = settings.enabled;
|
|
P.el('settings-stop-timeout').value = settings.stopTimeoutSeconds;
|
|
|
|
autostartNames = settings.autostart.slice();
|
|
renderAutostart();
|
|
|
|
const versions = settings.packageVersions || {};
|
|
const order = ['PODMAN', 'CONMON', 'CRUN', 'NETAVARK', 'AARDVARK_DNS', 'PASST', 'FUSE_OVERLAYFS'];
|
|
P.el('settings-package-versions').textContent = order
|
|
.map(function (k) { return k.toLowerCase().replace('_', '-') + ' ' + (versions[k + '_INSTALLED_VERSION'] || '?'); })
|
|
.join(' · ');
|
|
}
|
|
|
|
function load() {
|
|
return P.get('settings', 'get').then(fillForm).catch(function (err) {
|
|
alert('Could not load settings: ' + err.message);
|
|
});
|
|
}
|
|
|
|
function save() {
|
|
const body = {
|
|
storagePath: P.el('settings-storage-path').value.trim(),
|
|
storageImageSizeGb: parseInt(P.el('settings-storage-size').value, 10) || 20,
|
|
enabled: P.el('settings-enabled').checked,
|
|
stopTimeoutSeconds: parseInt(P.el('settings-stop-timeout').value, 10) || 10,
|
|
};
|
|
return P.post('settings', 'save', body).then(function () {
|
|
alert('Saved. Restart podman (rc.podman restart) to apply storage/enabled changes.');
|
|
}).catch(function (err) {
|
|
alert('Save failed: ' + err.message);
|
|
});
|
|
}
|
|
|
|
function init() {
|
|
P.el('settings-save-btn').addEventListener('click', save);
|
|
|
|
P.el('autostart-tbody').addEventListener('click', function (e) {
|
|
const btn = e.target.closest('button[data-action]');
|
|
if (!btn) return;
|
|
const i = parseInt(btn.closest('tr').dataset.index, 10);
|
|
const action = btn.dataset.action;
|
|
|
|
if (action === 'remove') {
|
|
autostartNames.splice(i, 1);
|
|
} else if (action === 'up' && i > 0) {
|
|
[autostartNames[i - 1], autostartNames[i]] = [autostartNames[i], autostartNames[i - 1]];
|
|
} else if (action === 'down' && i < autostartNames.length - 1) {
|
|
[autostartNames[i + 1], autostartNames[i]] = [autostartNames[i], autostartNames[i + 1]];
|
|
}
|
|
renderAutostart();
|
|
saveAutostart();
|
|
});
|
|
|
|
return load();
|
|
}
|
|
|
|
P.registerPanel('settings', { init: init, refresh: load });
|
|
})();
|