Commit 7802eb7f authored by jan.koester's avatar jan.koester
Browse files

repiar added

parent d819125a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
mediadb (20260419+30) unstable; urgency=medium

  * Add Repair Index button to cluster.html UI.

 -- Jan Koester <jan.koester@tuxist.de>  Sun, 19 Apr 2026 17:15:00 +0200

mediadb (20260419+29) unstable; urgency=medium

  * Add `POST /api/cluster/repair` endpoint: scans all group IDs across 
+22 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ tr:hover{background:#1e1e1e}
  <button class="btn btn-primary" id="btnSync" style="background:#66bb6a">Sync from Cluster</button>
  <button class="btn btn-primary" id="btnScrub" style="background:#ffb74d;color:#111">Scrub</button>
  <button class="btn btn-primary" id="btnRebalance" style="background:#ffb74d;color:#111">Rebalance</button>
  <button class="btn btn-primary" id="btnRepair" style="background:#ef5350;color:#fff">Repair Index</button>
</div>
<table id="storesTable">
  <thead id="storesHead"><tr><th>Store</th></tr></thead>
@@ -364,6 +365,27 @@ document.getElementById('btnRebalance').onclick = async () => {
  finally { btn.disabled = false; btn.textContent = 'Rebalance'; }
};

document.getElementById('btnRepair').onclick = async () => {
  if (!confirm('Repair Index scannt alle Cluster-Peers und versucht verlorene Stores wiederherzustellen. Fortfahren?')) return;
  const btn = document.getElementById('btnRepair');
  btn.disabled = true; btn.textContent = 'Repairing…';
  try {
    const res = await fetch('/api/cluster/repair', {
      method: 'POST',
      headers: { 'Authorization': 'Bearer ' + getToken() }
    });
    if (res.status === 401) { location.href = '/login.html'; return; }
    const data = await res.json();
    if (res.ok) {
      showMsg('Repair complete: ' + data.stores + ' stores, ' + data.albums + ' albums, ' + data.media + ' media', false);
      await loadClusterStatus();
    } else {
      showMsg(data.error || 'Repair failed', true);
    }
  } catch (e) { showMsg('Repair error: ' + e.message, true); }
  finally { btn.disabled = false; btn.textContent = 'Repair Index'; }
};

if (!getToken()) { location.href = '/login.html'; }
else { loadClusterStatus(); }
</script>