Add manual Watchtower trigger
All checks were successful
Build & Push Docker Image to Gitea Registry / build-and-push (push) Successful in 13s

This commit is contained in:
Kroonk
2026-05-21 16:43:59 +02:00
parent 10ad368214
commit e98130d274
3 changed files with 95 additions and 3 deletions

View File

@@ -19,6 +19,7 @@ const saveLocalButton = document.querySelector('#saveLocalButton');
const resetLocalButton = document.querySelector('#resetLocalButton');
const downloadConfigButton = document.querySelector('#downloadConfigButton');
const refreshOpsButton = document.querySelector('#refreshOpsButton');
const runWatchtowerButton = document.querySelector('#runWatchtowerButton');
const diskStatus = document.querySelector('#diskStatus');
const watchtowerStatus = document.querySelector('#watchtowerStatus');
const containerStatus = document.querySelector('#containerStatus');
@@ -404,6 +405,41 @@ async function restartContainer(row) {
}
}
async function runWatchtowerOnce() {
const confirmed = window.confirm('Watchtower jetzt manuell starten? Je nach Updates koennen Dienste kurz neu starten.');
if (!confirmed) return;
const previousText = runWatchtowerButton.textContent;
runWatchtowerButton.disabled = true;
runWatchtowerButton.textContent = 'Laeuft...';
watchtowerStatus.innerHTML = '<div class="ops-line"><strong>Manueller Lauf</strong><span>Gestartet...</span></div>';
try {
const response = await fetch('/api/watchtower/run-once', {
method: 'POST',
headers: {
Authorization: `Bearer ${tokenSet.id_token}`
}
});
const payload = await response.json().catch(() => ({}));
if (!response.ok) throw new Error(payload.error || `HTTP ${response.status}`);
watchtowerStatus.innerHTML = `
<div class="ops-line"><strong>Manueller Lauf</strong><span>Gestartet</span></div>
<div class="ops-line"><strong>Container</strong><span>${payload.name}</span></div>
`;
window.clearTimeout(opsRefreshTimer);
opsRefreshTimer = window.setTimeout(refreshOps, 25000);
} catch (error) {
watchtowerStatus.textContent = `Watchtower konnte nicht gestartet werden: ${error.message}`;
} finally {
window.setTimeout(() => {
runWatchtowerButton.disabled = false;
runWatchtowerButton.textContent = previousText;
}, 5000);
}
}
async function refreshOps() {
diskStatus.textContent = 'Lade...';
watchtowerStatus.textContent = 'Lade...';
@@ -476,6 +512,7 @@ resetLocalButton.addEventListener('click', () => {
downloadConfigButton.addEventListener('click', downloadConfig);
refreshOpsButton.addEventListener('click', refreshOps);
runWatchtowerButton.addEventListener('click', runWatchtowerOnce);
boot().catch((error) => {
loginMessage.textContent = `Adminseite konnte nicht starten: ${error.message}`;