optimize gui loader

This commit is contained in:
team2
2026-02-23 20:55:13 +01:00
parent c047c401df
commit 0aff4d5f3b
3 changed files with 34 additions and 29 deletions

View File

@@ -24,27 +24,27 @@
if (status === 'RUNNING') {
el.innerHTML = `
<div class="alert alert-info d-flex justify-content-between align-items-center">
<div><strong>Rebuild läuft…</strong></div>
<div><strong>Dokument-Tag-Rebuild läuft…</strong></div>
<div class="spinner-border spinner-border-sm"></div>
</div>
`;
} else if (status === 'QUEUED') {
el.innerHTML = `
<div class="alert alert-secondary">
Rebuild in Warteschlange…
Dokument-Tag-Rebuild in Warteschlange…
</div>
`;
} else if (status === 'COMPLETED') {
el.innerHTML = `
<div class="alert alert-success">
Rebuild abgeschlossen.
<div class="alert alert-success fw-bold">
Dokument-Tag-Rebuild erfolgreich abgeschlossen.
</div>
`;
stopPolling();
} else if (status === 'FAILED') {
el.innerHTML = `
<div class="alert alert-danger">
Rebuild fehlgeschlagen.
Dokument-Tag-Rebuild fehlgeschlagen.
</div>
`;
stopPolling();

View File

@@ -81,7 +81,10 @@
{# Fehlerbereich #}
<div id="job-error"
class="alert alert-danger mt-3 d-none">
class="alert alert-danger mt-3 {% if not job.errorMessage %}d-none{% endif %}">
{% if job.errorMessage %}
{{ job.errorMessage }}
{% endif %}
</div>
</div>
@@ -160,7 +163,7 @@
// Initial render from server state
renderBadge("{{ job.status|upper }}");
if (["QUEUED","RUNNING"].includes("{{ job.status|upper }}")) {
if (["QUEUED", "RUNNING"].includes("{{ job.status|upper }}")) {
loaderEl.classList.remove('d-none');
timer = setInterval(poll, 2000);
}

View File

@@ -11,12 +11,20 @@
{# ========================================================= #}
{# Flash Messages #}
{# ========================================================= #}
{#{% if app.flashes('success') %}
<ul class="alert alert-success shadow-sm">
{% for message in app.flashes('success') %}
<div class="alert alert-success shadow-sm">{{ message }}</div>
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% if app.flashes('danger') %}
<ul class="alert alert-danger shadow-sm">
{% for message in app.flashes('danger') %}
<div class="alert alert-danger shadow-sm">{{ message }}</div>
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}#}
{# ========================================================= #}
{# LIVE REBUILD STATUS (SSE) #}
@@ -44,34 +52,28 @@
html = `
<div class="alert alert-info shadow-sm d-flex justify-content-between align-items-center">
<div>
<strong>Rebuild läuft</strong><br>
<strong>Tag-Rebuild läuft</strong><br>
${data.startedAt ? 'Gestartet: ' + new Date(data.startedAt).toLocaleString() : ''}
</div>
<div class="spinner-border spinner-border-sm"></div>
</div>
`;
}
else if (data.status === '{{ statusQueued }}') {
} else if (data.status === '{{ statusQueued }}') {
html = `
<div class="alert alert-secondary shadow-sm">
<strong>Rebuild in Warteschlange</strong>
<strong>Tag-Rebuild in Warteschlange</strong>
</div>
`;
}
else if (data.status === '{{ statusCompleted }}') {
} else if (data.status === '{{ statusCompleted }}') {
html = `
<div class="alert alert-success shadow-sm">
<strong>Rebuild erfolgreich abgeschlossen</strong>
<strong>Tag-Rebuild erfolgreich abgeschlossen</strong>
</div>
`;
}
else if (data.status === '{{ statusFailed }}') {
} else if (data.status === '{{ statusFailed }}') {
html = `
<div class="alert alert-danger shadow-sm">
<strong>Rebuild fehlgeschlagen</strong><br>
<strong>Tag-Rebuild fehlgeschlagen</strong><br>
${data.error ? '<code>' + data.error + '</code>' : ''}
</div>
`;
@@ -100,7 +102,7 @@
<input class="form-control form-control-sm"
name="label"
placeholder="z. B. Testomat 808"
required />
required/>
</div>
<div class="col-md-3">
@@ -108,14 +110,14 @@
<input class="form-control form-control-sm"
name="slug"
placeholder="z. B. testomat-808"
required />
required/>
</div>
<div class="col-md-4">
<label class="form-label small text-muted">Beschreibung</label>
<input class="form-control form-control-sm"
name="description"
placeholder="Optional" />
placeholder="Optional"/>
</div>
<div class="col-md-2 d-grid align-items-end">