Commit 2d9bf670 authored by jan.koester's avatar jan.koester
Browse files

test

parent a110bb5f
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -131,7 +131,10 @@ async function loadClusterStatus() {
    apiFetch('/api/cluster/stores')
  ]);
  if (!health || !stores) return;
  renderClusterData(health, stores);
}

function renderClusterData(health, stores) {
  const summary = document.getElementById('summary');
  summary.innerHTML = '';

@@ -424,6 +427,24 @@ document.getElementById('btnVacuum').onclick = async () => {

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

// Auto-refresh every 2s while an import is running
let importPollTimer = null;

loadClusterStatus = async function() {
  const [health, stores] = await Promise.all([
    apiFetch('/api/cluster/status'),
    apiFetch('/api/cluster/stores')
  ]);
  if (!health || !stores) return;
  renderClusterData(health, stores);
  if (health.import_running && !importPollTimer) {
    importPollTimer = setInterval(() => loadClusterStatus(), 2000);
  } else if (!health.import_running && importPollTimer) {
    clearInterval(importPollTimer);
    importPollTimer = null;
  }
};
</script>
</body>
</html>