Update ashboard, dashboard (~2)

This commit is contained in:
Echo
2026-02-15 23:25:18 +00:00
parent 2eca94abaf
commit 22806c826b
2 changed files with 36 additions and 0 deletions

View File

@@ -84,6 +84,8 @@ class TaskBoardHandler(SimpleHTTPRequestHandler):
self.handle_eco_sessions_clear()
elif self.path == '/api/eco/git-commit':
self.handle_eco_git_commit()
elif self.path == '/api/eco/restart-taskboard':
self.handle_eco_restart_taskboard()
else:
self.send_error(404)
@@ -2403,6 +2405,18 @@ class TaskBoardHandler(SimpleHTTPRequestHandler):
except Exception as e:
self.send_json({'success': False, 'error': str(e)}, 500)
def handle_eco_restart_taskboard(self):
"""Restart the taskboard itself. Sends response then exits; systemd restarts."""
import threading
self.send_json({'success': True, 'message': 'Restarting taskboard in 1s...'})
def _exit():
import time
time.sleep(1)
os._exit(0)
threading.Thread(target=_exit, daemon=True).start()
def handle_eco_sessions_clear(self):
"""Clear active sessions (all or specific channel)."""
try:

View File

@@ -649,6 +649,10 @@
<i data-lucide="refresh-cw"></i>
Refresh
</button>
<button class="btn btn-secondary btn-warning" onclick="restartTaskboard()" title="Restart Taskboard">
<i data-lucide="rotate-cw"></i>
Restart TB
</button>
</div>
<!-- Services -->
@@ -1237,6 +1241,24 @@
}
}
// ── Taskboard Restart ─────────────────────────────────────
async function restartTaskboard() {
if (!confirm('Restart taskboard? Pagina va fi indisponibila ~5 secunde.')) return;
try {
await fetch('/echo/api/eco/restart-taskboard', { method: 'POST' });
} catch (e) { /* expected — server dies */ }
// Wait for restart, then reload
setTimeout(() => {
const check = setInterval(async () => {
try {
const r = await fetch('/echo/api/status');
if (r.ok) { clearInterval(check); location.reload(); }
} catch (e) { /* still restarting */ }
}, 1000);
}, 2000);
}
// ── Init ────────────────────────────────────────────────
loadStatus();